This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ARM Mali SDK compile error Hello World OpenCL sample code

Hello,

I am trying to compile some sample code from ARM Mali SDK (I am using a cross-compiler). I am trying to compile on a Linux Ubuntu system. The sample code is 'Hello_World_OpenCL' and when I tried to compile, I saw this error (I copied the error message directly from the Linux terminal):

hello_world_opencl.cpp: In function ‘int main()’:

hello_world_opencl.cpp:167:42: warning: narrowing conversion of ‘arraySize’ from ‘cl_int {aka int}’ to ‘size_t {aka unsigned int}’ inside { } [-Wnarrowing]

size_t globalWorksize[1] = {arraySize};

^

/tmp/ccFGhUGl.o: In function `main':

hello_world_opencl.cpp:(.text+0x3c): undefined reference to `createContext(_cl_context**)'

hello_world_opencl.cpp:(.text+0x5e): undefined reference to `cleanUpOpenCL(_cl_context*, _cl_command_queue*, _cl_program*, _cl_kernel*, _cl_mem**, int)'

hello_world_opencl.cpp:(.text+0xc2): undefined reference to `createCommandQueue(_cl_context*, _cl_command_queue**, _cl_device_id**)'

hello_world_opencl.cpp:(.text+0xe4): undefined reference to `cleanUpOpenCL(_cl_context*, _cl_command_queue*, _cl_program*, _cl_kernel*, _cl_mem**, int)'

hello_world_opencl.cpp:(.text+0x16c): undefined reference to `createProgram(_cl_context*, _cl_device_id*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, _cl_program**)'

hello_world_opencl.cpp:(.text+0x1a2): undefined reference to `cleanUpOpenCL(_cl_context*, _cl_command_queue*, _cl_program*, _cl_kernel*, _cl_mem**, int)'

hello_world_opencl.cpp:(.text+0x20a): undefined reference to `clCreateKernel'

hello_world_opencl.cpp:(.text+0x216): undefined reference to `checkSuccess(int)'

hello_world_opencl.cpp:(.text+0x238): undefined reference to `cleanUpOpenCL(_cl_context*, _cl_command_queue*, _cl_program*, _cl_kernel*, _cl_mem**, int)'

hello_world_opencl.cpp:(.text+0x2bc): undefined reference to `clCreateBuffer'

hello_world_opencl.cpp:(.text+0x2c8): undefined reference to `checkSuccess(int)'

hello_world_opencl.cpp:(.text+0x2f8): undefined reference to `clCreateBuffer'

hello_world_opencl.cpp:(.text+0x304): undefined reference to `checkSuccess(int)'

hello_world_opencl.cpp:(.text+0x334): undefined reference to `clCreateBuffer'

hello_world_opencl.cpp:(.text+0x340): undefined reference to `checkSuccess(int)'

hello_world_opencl.cpp:(.text+0x374): undefined reference to `cleanUpOpenCL(_cl_context*, _cl_command_queue*, _cl_program*, _cl_kernel*, _cl_mem**, int)'

hello_world_opencl.cpp:(.text+0x3fa): undefined reference to `clEnqueueMapBuffer'

hello_world_opencl.cpp:(.text+0x406): undefined reference to `checkSuccess(int)'

hello_world_opencl.cpp:(.text+0x448): undefined reference to `clEnqueueMapBuffer'

hello_world_opencl.cpp:(.text+0x454): undefined reference to `checkSuccess(int)'

hello_world_opencl.cpp:(.text+0x488): undefined reference to `cleanUpOpenCL(_cl_context*, _cl_command_queue*, _cl_program*, _cl_kernel*, _cl_mem**, int)'

hello_world_opencl.cpp:(.text+0x51a): undefined reference to `clEnqueueUnmapMemObject'

hello_world_opencl.cpp:(.text+0x522): undefined reference to `checkSuccess(int)'

hello_world_opencl.cpp:(.text+0x544): undefined reference to `cleanUpOpenCL(_cl_context*, _cl_command_queue*, _cl_program*, _cl_kernel*, _cl_mem**, int)'

hello_world_opencl.cpp:(.text+0x5aa): undefined reference to `clEnqueueUnmapMemObject'

hello_world_opencl.cpp:(.text+0x5b2): undefined reference to `checkSuccess(int)'

hello_world_opencl.cpp:(.text+0x5d4): undefined reference to `cleanUpOpenCL(_cl_context*, _cl_command_queue*, _cl_program*, _cl_kernel*, _cl_mem**, int)'

hello_world_opencl.cpp:(.text+0x638): undefined reference to `clSetKernelArg'

hello_world_opencl.cpp:(.text+0x640): undefined reference to `checkSuccess(int)'

hello_world_opencl.cpp:(.text+0x662): undefined reference to `clSetKernelArg'

hello_world_opencl.cpp:(.text+0x66a): undefined reference to `checkSuccess(int)'

hello_world_opencl.cpp:(.text+0x68c): undefined reference to `clSetKernelArg'

hello_world_opencl.cpp:(.text+0x694): undefined reference to `checkSuccess(int)'

hello_world_opencl.cpp:(.text+0x6c8): undefined reference to `cleanUpOpenCL(_cl_context*, _cl_command_queue*, _cl_program*, _cl_kernel*, _cl_mem**, int)'

hello_world_opencl.cpp:(.text+0x746): undefined reference to `clEnqueueNDRangeKernel'

hello_world_opencl.cpp:(.text+0x74e): undefined reference to `checkSuccess(int)'

hello_world_opencl.cpp:(.text+0x770): undefined reference to `cleanUpOpenCL(_cl_context*, _cl_command_queue*, _cl_program*, _cl_kernel*, _cl_mem**, int)'

hello_world_opencl.cpp:(.text+0x7ca): undefined reference to `clFinish'

hello_world_opencl.cpp:(.text+0x7d2): undefined reference to `checkSuccess(int)'

hello_world_opencl.cpp:(.text+0x7f4): undefined reference to `cleanUpOpenCL(_cl_context*, _cl_command_queue*, _cl_program*, _cl_kernel*, _cl_mem**, int)'

hello_world_opencl.cpp:(.text+0x84e): undefined reference to `printProfilingInfo(_cl_event*)'

hello_world_opencl.cpp:(.text+0x856): undefined reference to `clReleaseEvent'

hello_world_opencl.cpp:(.text+0x85e): undefined reference to `checkSuccess(int)'

hello_world_opencl.cpp:(.text+0x880): undefined reference to `cleanUpOpenCL(_cl_context*, _cl_command_queue*, _cl_program*, _cl_kernel*, _cl_mem**, int)'

hello_world_opencl.cpp:(.text+0x902): undefined reference to `clEnqueueMapBuffer'

hello_world_opencl.cpp:(.text+0x90e): undefined reference to `checkSuccess(int)'

hello_world_opencl.cpp:(.text+0x930): undefined reference to `cleanUpOpenCL(_cl_context*, _cl_command_queue*, _cl_program*, _cl_kernel*, _cl_mem**, int)'

hello_world_opencl.cpp:(.text+0x996): undefined reference to `clEnqueueUnmapMemObject'

hello_world_opencl.cpp:(.text+0x99e): undefined reference to `checkSuccess(int)'

hello_world_opencl.cpp:(.text+0x9c0): undefined reference to `cleanUpOpenCL(_cl_context*, _cl_command_queue*, _cl_program*, _cl_kernel*, _cl_mem**, int)'

hello_world_opencl.cpp:(.text+0xa28): undefined reference to `cleanUpOpenCL(_cl_context*, _cl_command_queue*, _cl_program*, _cl_kernel*, _cl_mem**, int)'

collect2: error: ld returned 1 exit status

 

Any advice? Any help? What should I do to fix this issue?

Thanks for your time,

David

Parents
  • Hello Peter. Thanks for the reply. I will explain with as much detail as I can.
    I am using a laptop with Ubuntu.
    First, I installed the Linux version of the ARM Mali OpenCL on the laptop.
    Next, using the terminal, I went in the /Documents/Mali_OpenCL_SDK_v1.1.0/samples/hello_world_opencl directory.
    Next, I tried to execute the make file using this command as shown in the Quick Start Guide: make install.
    I got an error message stating: 'arm-none-linux-gnueabi-g++ -c -Wall -I../../include -I../../common -I. hello_world_opencl.cpp -o hello_world_opencl.o make: arm-none-linux-gnueabi-g++: Command not found Makefile:30: recipe for target 'hello_world_opencl.o' failed make: *** [hello_world_opencl.o] Error 127
    I tried to install the arm linux gnueabi g++ compiler but I ran into issues there as well.
    Next, I realized that Ubuntu has already installed the arm-linux-gnueabihf cross-compiler.
    Next, I used that compiler and I executed this code: arm-linux-gnueabi-gcc hello_world_opencl.cpp -o hello_world_opencl
    At this point, I got the errors I mentioned before.

    Any advice? Any ideas?
    Thanks for your time,
    David
Reply
  • Hello Peter. Thanks for the reply. I will explain with as much detail as I can.
    I am using a laptop with Ubuntu.
    First, I installed the Linux version of the ARM Mali OpenCL on the laptop.
    Next, using the terminal, I went in the /Documents/Mali_OpenCL_SDK_v1.1.0/samples/hello_world_opencl directory.
    Next, I tried to execute the make file using this command as shown in the Quick Start Guide: make install.
    I got an error message stating: 'arm-none-linux-gnueabi-g++ -c -Wall -I../../include -I../../common -I. hello_world_opencl.cpp -o hello_world_opencl.o make: arm-none-linux-gnueabi-g++: Command not found Makefile:30: recipe for target 'hello_world_opencl.o' failed make: *** [hello_world_opencl.o] Error 127
    I tried to install the arm linux gnueabi g++ compiler but I ran into issues there as well.
    Next, I realized that Ubuntu has already installed the arm-linux-gnueabihf cross-compiler.
    Next, I used that compiler and I executed this code: arm-linux-gnueabi-gcc hello_world_opencl.cpp -o hello_world_opencl
    At this point, I got the errors I mentioned before.

    Any advice? Any ideas?
    Thanks for your time,
    David
Children
  • Try to edit the platform.mk near the root source folder (/Documents/Mali_OpenCL_SDK_v1.1.0/ here, I guess) and set the CC command to one that makes sense for your system (arm-linux-gnueabi-g++ here), then run make in the samples folders again.

  • Hello Myy,
    I edited the 'platform.mk' file and I added 'arm-linux-gnueabihf-g++' to 'CC' in that file. I executed the make file in the terminal in the hello_world_opencl folder. Now I am seeing some new errors. Here are the errors that I am seeing in the terminal window.

    cd ../../lib ; make libOpenCL.so
    make[1]: Entering directory '/home/dsv85/Documents/Mali_OpenCL_SDK_v1.1.0/lib'
    make[1]: 'libOpenCL.so' is up to date.
    make[1]: Leaving directory '/home/dsv85/Documents/Mali_OpenCL_SDK_v1.1.0/lib'
    cd ../../common/ ; make libCommon.a
    make[1]: Entering directory '/home/dsv85/Documents/Mali_OpenCL_SDK_v1.1.0/common'
    arm-none-linux-gnueabi-ar rcs libCommon.a common.o image.o
    make[1]: arm-none-linux-gnueabi-ar: Command not found
    Makefile:25: recipe for target 'libCommon.a' failed
    make[1]: *** [libCommon.a] Error 127
    make[1]: Leaving directory '/home/dsv85/Documents/Mali_OpenCL_SDK_v1.1.0/common'
    Makefile:48: recipe for target 'libCommon' failed
    make: *** [libCommon] Error 2

    Any advice? I am going to do some research on the arm-none-linux-gnueabi-ar, I think I need to focus on that. What do you think?

    Thanks for your time,
    David
  • Indeed !

    In the platform.mk, try to replace AR=arm-none-linux-gnueabi-ar by

    AR=arm-linux-gnueabihf-ar

    arm-none-linux-gnueabi- is just a prefix for a particular set of ARM cross-compiling softwares.

    Generally, gcc will require ld and ar when linking.

    Therefore, if you currently use a cross-compiling GCC with the following prefix "arm-linux-gnueabihf-", you most likely want to use the ARchiver with the same prefix "arm-linux-gnueabihf-".