Compile QtOpenCl.dll with Qt (64bit)



  • Hey Community,

    i am a real newb in understanding whats going on with linkers, compilers, headers, dynamic libraries and all that stuff, so please forgive me for the following.
    i just installed Qt 64bit on win7 x64 guided by this: "http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/":http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/

    i just got a few memories what i had to do when creating the qtopencl libraries with 32bit compiler.
    all i did for now is, downloading the "sourcecode":http://qt.gitorious.org/qt-labs/opencl as a .tar.gz, unzip it and try to qmake the opencl.pro file within my qtcreator ( using MSVC C++ compiler 10.0 (x64) )
    if i try to, i just get the LNK2001 errors which tell me that they cant find all the important .obj files like "qclvector.obj"
    i remember that i need to copy paste my opencl.dll (out of the system32 folder or from my nvidia driver) to somewhere like the release folder of the qt-opencl project...

    as i guess the information i just write down here is insufficient for you... so please ask me questions or give me somehow a solution for me.
    i hope to compile the QtOpenCl.dll is a standard task so you can help me out... thanks for reading!


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you show what errors you get ?

    You don't need to move the OpenCL dll however you need the OpenCL lib file(s) to link to.

    Do you have them ?



  • it just says that it cannot find all the following .obj files.
    how do i get the OpenCL lib file(s) ?
    (sry its the german client >_<)

    @Bibliothek "....\bin\QtOpenCL.lib" und Objekt "....\bin\QtOpenCL.exp" werden erstellt.
    qclsampler.obj : error LNK2001: Nicht aufgelöstes externes Symbol "clRetainEvent".
    qcluserevent.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "clRetainEvent" in Funktion ""public: __cdecl QCLEvent::QCLEvent(class QCLEvent const &)" (??0QCLEvent@@QEAA@AEBV0@@Z)".
    qclvector.obj : error LNK2001: Nicht aufgelöstes externes Symbol "clRetainEvent".
    qclimage.obj : error LNK2001: Nicht aufgelöstes externes Symbol "clRetainEvent".
    qclkernel.obj : error LNK2001: Nicht aufgelöstes externes Symbol "clRetainEvent".
    qclmemoryobject.obj : error LNK2001: Nicht aufgelöstes externes Symbol "clRetainEvent".
    qclprogram.obj : error LNK2001: Nicht aufgelöstes externes Symbol "clRetainEvent".
    qclbuffer.obj : error LNK2001: Nicht aufgelöstes externes Symbol "clRetainEvent".
    qclcommandqueue.obj : error LNK2001: Nicht aufgelöstes externes Symbol "clRetainEvent".
    qclcontext.obj : error LNK2001: Nicht aufgelöstes externes Symbol "clRetainEvent".
    qclevent.obj : error LNK2001: Nicht aufgelöstes externes Symbol "clRetainEvent".
    qclsampler.obj : error LNK2001: Nicht aufgelöstes externes Symbol "clReleaseEvent".
    qcluserevent.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "clReleaseEvent" in Funktion ""public: __cdecl QCLEvent::~QCLEvent(void)" (??1QCLEvent@@QEAA@XZ)".
    @ ...about 180 failures later...
    @
    qclprogram.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "clCreateKernelsInProgram" in Funktion ""public: class QList<class QCLKernel> __cdecl QCLProgram::createKernels(void)const " (?createKernels@QCLProgram@@QEBA?AV?$QList@VQCLKernel@@@@XZ)".
    qclprogram.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "clBuildProgram" in Funktion ""public: bool __cdecl QCLProgram::build(class QList<class QCLDevice> const &,class QString const &)" (?build@QCLProgram@@QEAA_NAEBV?$QList@VQCLDevice@@@@AEBVQString@@@Z)".
    qclsampler.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "clGetSamplerInfo" in Funktion ""public: bool __cdecl QCLSampler::normalizedCoordinates(void)const " (?normalizedCoordinates@QCLSampler@@QEBA_NXZ)".
    ....\bin\QtOpenCL.dll : fatal error LNK1120: 61 nicht aufgelöste externe Verweise.
    NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\link.EXE"": Rückgabe-Code "0x460"
    Stop.
    NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\nmake.exe"": Rückgabe-Code "0x2"
    Stop.
    NMAKE : fatal error U1077: "cd": Rückgabe-Code "0x2"
    Stop.
    NMAKE : fatal error U1077: "cd": Rückgabe-Code "0x2"
    Stop.
    10:32:47: Der Prozess "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\nmake.exe" wurde mit dem Rückgabewert 2 beendet.
    Fehler beim Erstellen des Projekts opencl(Ziel: Desktop)
    Bei der Ausführung von Build-Schritt 'Make'@


  • Lifetime Qt Champion

    Looks like you're missing the OpenCL development libraries



  • can you tell me what to do ?


  • Lifetime Qt Champion

    Install the OpenCL drivers and SDK from your graphics card manufacturer. AFAIK, for e.g. Nvidia you can install the CUDA SDK and it should come with it



  • i have cuda installed... where to finde all needed files?


  • Lifetime Qt Champion

    I don't have a windows computer at hand but doing a search in the CUDA sdk folder should tell you where the OpenCL libs can be found



  • where to paste the opencl.lib and the opencl.h ?


  • Lifetime Qt Champion

    No need to past them anywhere, just put the right paths in your pro file



  • omfg, i just realized that i got a new graphics card...
    its amd and i just can find so called amd_opencl32.dll or 64.dll in sum drivers folders...but nothing in the catalyst folders nor ATI Technologies folders.


  • Lifetime Qt Champion

    Did you install the AMD OpenCL SDK ?



  • well i did now.... can you tell me what to execute or how to link and which files need to be linked ?
    omfg im such a noob :D


  • Lifetime Qt Champion

    Before that did you retry to build QtOpenCL from scratch ?



  • the failures above still come up, if thats what you ask for



  • mb i've got the wrong sdk.... named APP AMD SDK.
    there is a so called OpenCLService.exe which i installed via prompt
    OpenCLService.exe -i and run it via -s


  • Lifetime Qt Champion

    So, it is working now ?



  • no its not, still the same errors


  • Lifetime Qt Champion

    Do you have any OpenCL something lib file in the AMD sdk ?



  • nope
    just kernels for examples and stuff


  • Lifetime Qt Champion

    Strange, did you do a global disk search ? Sometimes there are things are dispatched in both Program Files and Program Files (x86)

    Just to be sure did you download "that":http://developer.amd.com/tools-and-sdks/opencl-zone/opencl-tools-sdks/amd-accelerated-parallel-processing-app-sdk/ sdk ?



  • yes, thats what i installed...
    i did searched for opencl files... and as i posted before i just found strange files like AMD_opencl64.dl_
    i always throught the only thing i need is the opencl.dll (no matter from which source) and compile it with the needed compiler, in my case the amdx64 compiler of msvs10.0


  • Lifetime Qt Champion

    no .lib or .a file ?



  • the only .lib or .a files are named glew32 and 64 or glut32 64.


  • Lifetime Qt Champion

    I wonder if the SDK has installed correctly



  • did you see the lib files if you take a look at it ?



  • ololol, i searched them manually and found them
    dunno why the autosearch cant track them.... OpenCL.lib and libOpenCL.a
    what to do now ?


  • Lifetime Qt Champion

    Depending on your compiler link to either OpenCL.libg (Visual Studio) or libOpenCL.a if you are using MinGW



  • i use MSVS compiler for 64bit... how to link libs in the pro file?


  • Lifetime Qt Champion

    You can use Qt Creator built in dialog for that.

    Or add

    @
    LIBS += -Lpath/to/sdk/ -lOpenCL
    @

    If you want to be independent from the SDK installation path, you can use the environment variables to generate the proper path



  • well, thank you so far... now the compiler says:
    @NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\link.EXE"": Rückgabe-Code "0x49d"
    Stop.
    NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\nmake.exe"": Rückgabe-Code "0x2"
    Stop.
    NMAKE : fatal error U1077: "cd": Rückgabe-Code "0x2"
    Stop.
    NMAKE : fatal error U1077: "cd": Rückgabe-Code "0x2"
    Stop.@

    i just added the following:
    @LIBS += -LC:/Program Files (x86)/AMD APP SDK/2.9/lib/x86_64 -lOpenCL@


  • Lifetime Qt Champion

    Spaces are really bad on windows

    try

    @LIBS += -L$$quote("C:/Program Files (x86)/AMD APP SDK/2.9/lib/x86_64"@

    If that doesn't work, use the 8.3 naming scheme



  • if i just use this advice, i get the same errors like i got at the very beginning.
    then i tried to copy paste the whole folder to another path without spaces and get still the same errors.
    8.3 naming scheme means to give the files in particular like ?:

    @LIBS += -L$$quote("C:/Program Files (x86)/AMD APP SDK/2.9/lib/x86_64/libOpenCL.a") -lOpenCl@


  • Lifetime Qt Champion

    No, the path itself and don't add the library name since you also pass the -lOpenCL option.

    @LIBS += -LC:/PROGRA~1/AMDAPP~1/2.9/lib/x86_64@

    Please check the both on the command line with dir /x



  • i just checkd and saw that its PROGRA~2 cuz of the standard Programms folder and the x86 one but the errors dont change.


  • Lifetime Qt Champion

    Can you post the current content of your pro file ?



  • @TEMPLATE = lib
    TARGET = QtOpenCL
    gcov {
    CONFIG += staticlib
    } else {
    CONFIG += dll
    }
    CONFIG += warn_on
    win32 {
    DESTDIR = ../../bin
    !static:DEFINES += QT_MAKEDLL
    }
    else:DESTDIR = ../../lib

    win32 {
    !isEmpty(QMAKE_INCDIR_OPENCL) {
    QMAKE_CXXFLAGS += -I$$QMAKE_INCDIR_OPENCL
    }
    !isEmpty(QMAKE_LIBDIR_OPENCL) {
    LIBS += -L$$QMAKE_LIBDIR_OPENCL
    }
    !isEmpty(QMAKE_LIBS_OPENCL) {
    LIBS += $$QMAKE_LIBS_OPENCL
    } else {
    LIBS += -lOpenCL
    }
    }

    macx:!opencl_configure {
    LIBS += -framework OpenCL
    }

    LIBS += -LC:/PROGRA~2/AMDAPP~1/2.9/lib/x86_64

    HEADERS +=
    qclbuffer.h
    qclcommandqueue.h
    qclcontext.h
    qcldevice.h
    qclevent.h
    qclglobal.h
    qclimage.h
    qclimageformat.h
    qclkernel.h
    qclmemoryobject.h
    qclplatform.h
    qclprogram.h
    qclsampler.h
    qcluserevent.h
    qclvector.h
    qclworksize.h

    SOURCES +=
    qclbuffer.cpp
    qclcommandqueue.cpp
    qclcontext.cpp
    qcldevice.cpp
    qclevent.cpp
    qclimage.cpp
    qclimageformat.cpp
    qclkernel.cpp
    qclmemoryobject.cpp
    qclplatform.cpp
    qclprogram.cpp
    qclsampler.cpp
    qcluserevent.cpp
    qclvector.cpp
    qclworksize.cpp

    PRIVATE_HEADERS +=
    qclext_p.h

    HEADERS += $$PRIVATE_HEADERS
    DEFINES += QT_BUILD_CL_LIB

    opencl_1_1 {
    DEFINES += QT_OPENCL_1_1
    }

    @


  • Lifetime Qt Champion

    Just to be sure I understand you correctly, you are again getting the missing symbols error ?



  • [quote author="SGaist" date="1402867816"]Just to be sure I understand you correctly, you are again getting the missing symbols error ?[/quote]

    yes



  • maybe this is an interessting information...
    i just used the 32bit Qt 4.7.1 and the compiled qtopencl libraries... is it possible that there are just older files or installations of whatsoever which causes failures like that?
    i simply followed the instructions and maybe this is a reason why is just dont work out as it should.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.