- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi to everyone!...
I am working with a random number generator for OpenCL (MTGP32 http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MTGP/ ) and I am having several "undefined reference" errors when I try to compile the program. For example, here is an extract from the make process:
/tmp/cc8w8niK.o: In function `cl::detail::ReferenceHandler<_cl_context*>::retain(_cl_context*)':
/usr/include/CL/cl.hpp:1030: undefined reference to `clRetainContext'
/tmp/cc8w8niK.o: In function `cl::detail::ReferenceHandler<_cl_context*>::release(_cl_context*)':
/usr/include/CL/cl.hpp:1032: undefined reference to `clReleaseContext'
/tmp/cc8w8niK.o: In function `cl::detail::ReferenceHandler<_cl_command_queue*>::retain(_cl_command_queue*)':
/usr/include/CL/cl.hpp:1039: undefined reference to `clRetainCommandQueue'
/tmp/cc8w8niK.o: In function `cl::detail::ReferenceHandler<_cl_command_queue*>::release(_cl_command_queue*)':
/usr/include/CL/cl.hpp:1041: undefined reference to `clReleaseCommandQueue'
/tmp/cc8w8niK.o: In function `cl::detail::ReferenceHandler<_cl_mem*>::retain(_cl_mem*)':
/usr/include/CL/cl.hpp:1048: undefined reference to `clRetainMemObject'
/tmp/cc8w8niK.o: In function `cl::detail::ReferenceHandler<_cl_mem*>::release(_cl_mem*)':
This program uses the OpenCL C++ Wrapper. I am working in Ubuntu 12.04 LTS in a ThinkPad Twist with a Core i5 3317U and the Intel® SDK for OpenCL* Applications XE 2013 R2 64-bit. The strange thing is that error does not happens with other OpenCL SDKs (for example, in my office I have a PC with AMD OpenCL SDK under Fedora 19) and a laptop with the Intel SDK 2012 and this program runs without problems... also, other opencl examples, that use the C++ Wrapper, do not present these errors.
I attach a sample of the code, the program must be compiled inside the openCL_sample subfolder. Thanks for your help!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found a solution for this problem... I just have to put the "-lOpenCL" flag at the end of the compilation line...
Originaly this appeared in the command line:
g++ -g -O0 -m64 -I../ -lOpenCL -o mtgp32-sample mtgp32-sample.cpp \
parse_opt.o \
../mtgp32-fast.o \
../mtgp32-param-fast.o
I modified the Makefile, so now it can be read:
g++ -g -O0 -m64 -I../ -o mtgp32-sample mtgp32-sample.cpp \
parse_opt.o \
../mtgp32-fast.o \
../mtgp32-param-fast.o \
-lOpenCL
well, I would feel very gratefull if someone could explain this situation. The strange thing is that the original command works with other machines and/or OpenCL SDKs, but not with Ubuntu 12.04 with Intel OpenCL SDK... weird.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page