doe300 / VC4CL

OpenCL implementation running on the VideoCore IV GPU of the Raspberry Pi models
MIT License
729 stars 81 forks source link

error while linking #53

Closed as3ii closed 5 years ago

as3ii commented 5 years ago

on arch linux arm aarch64, clang7

Scanning dependencies of target generate_icd
[  3%] Generating VC4CL.icd
[  3%] Built target generate_icd
Scanning dependencies of target VC4CL
[  7%] Building CXX object src/CMakeFiles/VC4CL.dir/barriers.cpp.o
[ 10%] Building CXX object src/CMakeFiles/VC4CL.dir/Buffer.cpp.o
[ 14%] Building CXX object src/CMakeFiles/VC4CL.dir/CommandQueue.cpp.o
[ 17%] Building CXX object src/CMakeFiles/VC4CL.dir/common.cpp.o
[ 21%] Building CXX object src/CMakeFiles/VC4CL.dir/Context.cpp.o
[ 25%] Building CXX object src/CMakeFiles/VC4CL.dir/Device.cpp.o
[ 28%] Building CXX object src/CMakeFiles/VC4CL.dir/Event.cpp.o
[ 32%] Building CXX object src/CMakeFiles/VC4CL.dir/executor.cpp.o
/home/as3ii/VC4CL/src/executor.cpp: In function 'unsigned int AS_GPU_ADDRESS(const unsigned int*, vc4cl::DeviceBuffer*)':
/home/as3ii/VC4CL/src/executor.cpp:39:24: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     const char* tmp = *reinterpret_cast<const char**>(&ptr);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/as3ii/VC4CL/src/executor.cpp: In function 'cl_int executeKernel(vc4cl::KernelExecution&)':
/home/as3ii/VC4CL/src/executor.cpp:261:79: warning: conversion from 'long unsigned int' to 'uint32_t' {aka 'unsigned int'} may change value
-Wconversion]
     uint32_t stackFrameSize = kernel->program->moduleInfo.getStackFrameSize() * sizeof(uint64_t);
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
[ 35%] Building CXX object src/CMakeFiles/VC4CL.dir/extensions.cpp.o
[ 39%] Building CXX object src/CMakeFiles/VC4CL.dir/icd_loader.cpp.o
[ 42%] Building CXX object src/CMakeFiles/VC4CL.dir/Image.cpp.o
[ 46%] Building CXX object src/CMakeFiles/VC4CL.dir/Kernel.cpp.o
[ 50%] Building CXX object src/CMakeFiles/VC4CL.dir/Mailbox.cpp.o
[ 53%] Building CXX object src/CMakeFiles/VC4CL.dir/ObjectTracker.cpp.o
[ 57%] Building CXX object src/CMakeFiles/VC4CL.dir/PerformanceCounter.cpp.o
/home/as3ii/VC4CL/src/PerformanceCounter.cpp: In member function 'cl_int vc4cl::PerformanceCounter::getValue(cl_uint*) const':
/home/as3ii/VC4CL/src/PerformanceCounter.cpp:43:40: warning: conversion from 'int64_t' {aka 'long int'} to 'cl_uint' {aka 'unsigned int'} may change value [-Wconversion]
     *value = V3D::instance().getCounter(index);
              ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
[ 60%] Building CXX object src/CMakeFiles/VC4CL.dir/Platform.cpp.o
[ 64%] Building CXX object src/CMakeFiles/VC4CL.dir/Program.cpp.o
[ 67%] Building CXX object src/CMakeFiles/VC4CL.dir/queue_handler.cpp.o
[ 71%] Building CXX object src/CMakeFiles/VC4CL.dir/TextureFormat.cpp.o
[ 75%] Building CXX object src/CMakeFiles/VC4CL.dir/V3D.cpp.o
[ 78%] Linking CXX shared library libVC4CL.so
[ 78%] Built target VC4CL
Scanning dependencies of target v3d_profile
[ 82%] Building CXX object tools/CMakeFiles/v3d_profile.dir/V3DProfile.cpp.o
In file included from /home/as3ii/VC4CL/tools/../src/V3D.h:10,
                 from /home/as3ii/VC4CL/tools/common.h:10,
                 from /home/as3ii/VC4CL/tools/V3DProfile.cpp:7:
/home/as3ii/VC4CL/tools/../src/common.h:46:106: warning: ignoring attributes on template argument 'cl_int' {aka 'int'} [-Wignored-attributes]
     CHECK_RETURN typename std::enable_if<std::is_arithmetic<T>::value | std::is_pointer<T>::value, cl_int>::type
                                                                                                          ^
[ 85%] Linking CXX executable v3d_profile
/usr/bin/ld: ../src/libVC4CL.so.0.4: undefined reference to `bcm_host_deinit'
/usr/bin/ld: ../src/libVC4CL.so.0.4: undefined reference to `bcm_host_init'
/usr/bin/ld: ../src/libVC4CL.so.0.4: undefined reference to `bcm_host_get_peripheral_address'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/CMakeFiles/v3d_profile.dir/build.make:88: tools/v3d_profile] Error 1
make[1]: *** [CMakeFiles/Makefile2:247: tools/CMakeFiles/v3d_profile.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
doe300 commented 5 years ago

The bcm_xxx functions are provided by the Raspberry Pi userland repository. On Raspbian they are pre-installed, on Arch Linux apparently not. If you install them manually, you will need to make sure, the firmware is also set up correctly. Also, compiling as 64-bit might not work, see here and here.

as3ii commented 5 years ago

this means that it is impossible to use this library on a system other than raspbian?

doe300 commented 5 years ago

I don't know that, it might be possible. You could take a look at here, here and here. The links look like you can get the firmware and user-space libraries installed on Arch Linux.

as3ii commented 5 years ago

the firmwares are provided by a package, but does not include the software contained in /opt /vc (the package that provide that software does not support aarch64/armv8). Now I'm trying to download the file from https://github.com/raspberrypi/firmware and trying to make them work

Tritbool commented 5 years ago

FYI : I had the same linking error on DietPi running on a RPi 3 B+ Installing userland from source did the trick for me.