View Full Version : Cannot make OpenCL work with Qt Creator

28th January 2017, 06:51
I am trying to run the "Valar" benchmark applications on my system through Qt Creator and am getting errors when I build the code:


I typed the command
autoreconf -ivf and got the following output:

autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
aclocal: couldn't open directory `m4': No such file or directory
autoreconf: aclocal failed with exit status: 1

All my errors were connected to the file m4 so I created an empty directory and named it m4. After that I was able to run the command
autoreconf --install and I no longer kept getting the same error. Moreover, Makefile.in was also generated along with many other files.

The image shows the state of the directory after I ran
autoreconf --install:


I ran the command
qmake --project on the command line and the
.pro file was generated.

I opened the newly generated .pro file in Qt Creator and linked the OpenCL libraries in addition to the other OpenCL files in the "bin" directory.



This picture indicates the errors I have been getting:


The following is the information I have regarding the qmake I am using:

Qmake version: 1.07a (Qt 3.3.8b)
Qmake is free software from Trolltech ASA.

Please help me in building and building my OpenCL applications successfully. Please point out to me what exactly I am doing/have done wrong.

28th January 2017, 16:32
Your screenshots are illegible and probably don't show anything useful anyway. If you get error listings, post the listing, not a screenshot of a listing.

First, update to a current version of Qt. Qt 3.3 is probably 10 years or more old. Also ensure you have up to date compilers that support OpenCL.

Then, instead of trying to integrate a complex project that requires autoreconf and a dozen other steps, find a simple OpenCL example that uses nothing except a few source code files and the OpenCL framework. Get that working and remember what you did. Then maybe you can integrate a more complex project.

There are probably a dozen places where something could have gone wrong. Start with a simple example, get it working, and bootstrap your way up.

28th January 2017, 17:36
Thank you d_stranz for your reply.

I have included the errors I got when I tried to compile the project.


I cannot edit my first post so I am including the errors I got here. Since the images I posted weren't readable, I'll post the links to the images here:

My files after I ran autoreconf:


The libraries for OpenCL that I included:


My workspace:


The errors I got:

17:27:13: Running steps for project valar-bench...
17:27:13: Configuration unchanged, skipping qmake step.
17:27:13: Starting: "/usr/bin/make"
Makefile:941: warning: overriding commands for target `eventlist.o'
Makefile:875: warning: ignoring old commands for target `eventlist.o'
Makefile:1014: warning: overriding commands for target `main.o'
Makefile:960: warning: ignoring old commands for target `main.o'
g++ -c -pipe -g -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I../valar-bench -I. -I../valar-bench -I../valar-bench/clhaptic/libmisc -I../valar-bench/fir -I../valar-bench/clhaptic/libanalysis-devices -I../valar-bench/clhaptic/libprofiler -I../valar-bench/clhaptic/libtopology -I../valar-bench/clhaptic/librules -I../valar-bench/clhaptic/libinterceptor -I../valar-bench/clsurf/src -I../valar-bench/particles/Common/Base -I../valar-bench/particles/Common/Math -I../valar-bench/particles/TestBed/Demos -I../valar-bench/particles/Common/Utils -I../valar-bench/particles/TestBed -I../valar-bench/particles/Common/DeviceUtils -I../valar-bench/particles/Common/Geometry -I../valar-bench/particles -I/root/Downloads/valar-bench/valar-bench/../../usr/local/cuda-7.0/lib64 -I/root/Downloads/valar-bench/valar-bench/../../usr/local/cuda-7.0/include -I/opt/QtInstallation/5.6/gcc_64/include -I/opt/QtInstallation/5.6/gcc_64/include/QtGui -I/opt/QtInstallation/5.6/gcc_64/include/QtCore -I. -I/opt/QtInstallation/5.6/gcc_64/mkspecs/linux-g++ -o FIR_tapchange.o ../valar-bench/fir/FIR_tapchange.cpp
../valar-bench/fir/FIR_tapchange.cpp:16:19: error: CL/cl.h: No such file or directory
In file included from ../valar-bench/fir/FIR_tapchange.cpp:18:
../valar-bench/clhaptic/libmisc/opencl_utils.h:40: error: 'cl_device_id' was not declared in this scope
../valar-bench/clhaptic/libmisc/opencl_utils.h:42: error: variable or field 'ad_sync' declared void
../valar-bench/clhaptic/libmisc/opencl_utils.h:42: error: 'cl_command_queue' was not declared in this scope
17:27:13: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project valar-bench (kit: Desktop Qt 5.6.0 GCC 64bit)
When executing step "Make"
17:27:13: Elapsed time: 00:00.

I got many other errors but I have not included them because I will be exceeding the word limit of my message. Qt is essentially not recognizing the OpenCL library.
Please let me know if my new post provides helpful information about my problem.