-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error building VC4CL #105
Comments
What is the contents of your |
You're right - Edit: it's in |
Ok, both files had been in I've downloaded The contents of '/opt/vc/lib/` is now the following:
|
I'll try what @Tritbool proposed, "install userland from source": #53 (comment) |
Are you working on a clean (new) installation of Debian Bullseye? If so, maybe the libraries were moved recently, I will have to check the Raspberry Pi packages... |
The Bullseye installation was reasonably fresh and clean (I installed a few standard packages unrelated to machine level development). |
This time it worked :-) The following should result in a working build: For testing the work-around that you proposed I've changed For future reference: I used the following versions:
Here is the result of
|
After changing I haven't tested, though, if the problem comes from VC4CLStdLib or VC4C.
|
Thanks for the detailed analysis. Looks like that at least for some Ubuntu ports, the libraries where moved, I will try to find out whether this happened for official builds also and update the CMake files. |
Apparently we have some more moved libraries: Scanning dependencies of target VC4C
[ 56%] Building CXX object src/CMakeFiles/VC4C.dir/main.cpp.o
[ 56%] Linking CXX executable vc4c
/home/USER/buildarea/opencl/VC4C/build/src/vc4c: error while loading shared libraries: /home/USER/buildarea/opencl/VC4C/build/src/libVC4CC.so.1.2: unexpected reloc type 0x03
make[2]: *** [src/CMakeFiles/VC4C.dir/build.make:88: src/vc4c] Error 127
make[2]: *** Deleting file 'src/vc4c'
make[1]: *** [CMakeFiles/Makefile2:2018: src/CMakeFiles/VC4C.dir/all] Error 2
make: *** [Makefile:163: all] Error 2 Running on a RPi 2B 1GB ubuntu server 20.04.3 LTS |
That looks strange... |
As far as I tried: yes. make went ahead after a reboot to start the build from ground up until this reoccured. |
I already looked into the previous messages and tried to find something in the CMakeFiles.txt but its just full of strings and variables I have no idea about what those mean. Nothing about finding a library so-file |
As far as I can see it, the error message occurs when the What compiler/linker are you using? |
Sorry for the delay, I had friends over after I typed the last one. user@ubuntu:~$ ldd /home/user/buildarea/opencl/VC4C/build/src/libVC4CC.so.1.2
linux-vdso.so.1 (0xbeff7000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6025000)
libLLVM-10.so.1 => /lib/arm-linux-gnueabihf/libLLVM-10.so.1 (0xb2214000)
libstdc++.so.6 => /lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb20cb000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb2062000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb2039000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb1f3b000)
/lib/ld-linux-armhf.so.3 (0xb6fcb000)
libffi.so.7 => /lib/arm-linux-gnueabihf/libffi.so.7 (0xb1f25000)
libedit.so.2 => /lib/arm-linux-gnueabihf/libedit.so.2 (0xb1ef5000)
libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb1ed2000)
librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xb1ebc000)
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb1ea9000)
libtinfo.so.6 => /lib/arm-linux-gnueabihf/libtinfo.so.6 (0xb1e7c000)
libbsd.so.0 => /lib/arm-linux-gnueabihf/libbsd.so.0 (0xb1e59000)
user@ubuntu:~$ file -L /home/user/buildarea/opencl/VC4C/build/src/libVC4CC.so.1.2
/home/user/buildarea/opencl/VC4C/build/src/libVC4CC.so.1.2: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=fddc10984ae4cf636b7b907db2e79da5b0a289f1, with debug_info, not stripped FYI I tried and entire clean install from source and it also failed with the same error message as before. Thanks alot for taking your time with a random dude seeking help :) |
Do you need any other information that I can provide? |
So I just checked on my (a little bit dated) Raspberry Pi OS. Besides me using LLVM 6 instead of 10, the only major difference I can see is that my library additionally links to
Can you try 2 more things?
|
Yes there are some *.a links at the end of the file:
|
Not sure why this never occurred on my machines, but it looks like the problem is that the There are several ways this could be circumvented:
|
I will try number 2 and will be back in a bit :) |
Number 2 Worked! |
Aww. It build properly this time, but my executeable apparently vails to load CL runtime. Welp. |
Are you loading the VC4CL library directly or via the system ICD loader? Also, are you running your application as root? VC4CL requires this to access some hardware registers... |
I tried multiple ways. First I tried to let the executeable detect it by itself, which did result in: I can not find anything so it got to be disabled. Then I defined |
Your application probably requires the |
- Updates host library search path, see #105 - Updates usage of VC4C interface
I decided to staart from scratch with a clean install of raspbian os. Following the initial steps of this issue chain. |
Currently after:
I am stuck on this: admjpjuergens@rpisrv1:~ $ sudo clinfo --offline
[E] Fri Feb 11 15:35:55 2022: Received signal: SIGSEGV
[E] Fri Feb 11 15:35:55 2022: (1) /usr/local/lib/libVC4CC.so.1.2 : +0xb1e4d0 [0x764ef4d0]
[E] Fri Feb 11 15:35:55 2022: (2) /lib/arm-linux-gnueabihf/libc.so.6 : __default_rt_sa_restorer+0 [0x76e15db0]
admjpjuergens@rpisrv1:~ $ sudo clinfo -l
[E] Fri Feb 11 15:36:03 2022: Received signal: SIGSEGV
[E] Fri Feb 11 15:36:03 2022: (1) /usr/local/lib/libVC4CC.so.1.2 : +0xb1e4d0 [0x764744d0]
[E] Fri Feb 11 15:36:03 2022: (2) /lib/arm-linux-gnueabihf/libc.so.6 : __default_rt_sa_restorer+0 [0x76d9adb0]
admjpjuergens@rpisrv1:~ $ sudo clinfo
[E] Fri Feb 11 15:36:10 2022: Received signal: SIGSEGV
[E] Fri Feb 11 15:36:10 2022: (1) /usr/local/lib/libVC4CC.so.1.2 : +0xb1e4d0 [0x764c84d0]
[E] Fri Feb 11 15:36:10 2022: (2) /lib/arm-linux-gnueabihf/libc.so.6 : __default_rt_sa_restorer+0 [0x76deedb0] FYI the old clinfo did simply say: |
The stack trace is not very helpful... Also there should be no need to build userland yourself, these commands work fine on a new Raspberry Pi Bullseye. |
Sorry I didn't want to bother you with an of this. VC4C and VC4CL are being currently rebuild as per your instructions. |
|
Curiouser and curiouser... Did you maybe run out of memory while linking? |
System did not note anything alike that. currently 384MB are dedicated to VRAM ~640MB to RAM. |
u know what for now I will lower VRAM to 16MB and try again, who knows |
It continued past the previous error position. Either there was not enough memory/swap or me cleaning the build folder with rm -rf did it. One question regarding your built instructions:
what happend to |
These steps are only necessary, if you want to install it system-wide (which if you want to use the VC4CL implementation without relinking all client applications against it, you probably want to do). I probably should update the build instructions with that. |
Results: ~/buildarea/opencl/VC4CL/VC4CL/build $ LD_PRELOAD=src/libVC4CL.so clinfo
Number of platforms 1
Platform Name OpenCL for the Raspberry Pi VideoCore IV GPU
Platform Vendor doe300
Platform Version OpenCL 1.2 VC4CL 0.4.9999 (2bed01f)
Platform Profile EMBEDDED_PROFILE
Platform Extensions cl_khr_il_program cl_khr_spir cl_khr_create_command_queue cl_altera_device_temperature cl_altera_live_object_tracking cl_khr_extended_versioning cl_khr_spirv_no_integer_wrap_decoration cl_khr_suggested_local_work_size cl_vc4cl_performance_counters
Platform Name OpenCL for the Raspberry Pi VideoCore IV GPU
Number of devices 1
Device Name VideoCore IV GPU
Device Vendor Broadcom
Device Vendor ID 0x14e4
Device Version OpenCL 1.2 VC4CL 0.4.9999 (2bed01f)
Device Numeric Version 0x402000 (1.2.0)
Driver Version 0.4.9999
Device OpenCL C Version OpenCL C 1.2
Device Type GPU
Device Profile EMBEDDED_PROFILE
Device Available Yes
Compiler Available Yes
Linker Available Yes
Max compute units 1
Available core IDs 0
terminate called after throwing an instance of 'std::runtime_error'
what(): Failed to initialize VCSM!
Aborted ~ $ LD_PRELOAD=libVC4CL.so clinfo
Number of platforms 1
Platform Name OpenCL for the Raspberry Pi VideoCore IV GPU
Platform Vendor doe300
Platform Version OpenCL 1.2 VC4CL 0.4.9999 (2bed01f)
Platform Profile EMBEDDED_PROFILE
Platform Extensions cl_khr_il_program cl_khr_spir cl_khr_create_command_queue cl_altera_device_temperature cl_altera_live_object_tracking cl_khr_extended_versioning cl_khr_spirv_no_integer_wrap_decoration cl_khr_suggested_local_work_size cl_vc4cl_performance_counters
Platform Name OpenCL for the Raspberry Pi VideoCore IV GPU
Number of devices 1
Device Name VideoCore IV GPU
Device Vendor Broadcom
Device Vendor ID 0x14e4
Device Version OpenCL 1.2 VC4CL 0.4.9999 (2bed01f)
Device Numeric Version 0x402000 (1.2.0)
Driver Version 0.4.9999
Device OpenCL C Version OpenCL C 1.2
Device Type GPU
Device Profile EMBEDDED_PROFILE
Device Available Yes
Compiler Available Yes
Linker Available Yes
Max compute units 1
Available core IDs 0
terminate called after throwing an instance of 'std::runtime_error'
what(): Failed to initialize VCSM!
Aborted ~ $ sudo LD_PRELOAD=libVC4CL.so clinfo
Number of platforms 1
Platform Name OpenCL for the Raspberry Pi VideoCore IV GPU
Platform Vendor doe300
Platform Version OpenCL 1.2 VC4CL 0.4.9999 (2bed01f)
Platform Profile EMBEDDED_PROFILE
Platform Extensions cl_khr_il_program cl_khr_spir cl_khr_create_command_queue cl_altera_device_temperature cl_altera_live_object_tracking cl_khr_extended_versioning cl_khr_spirv_no_integer_wrap_decoration cl_khr_suggested_local_work_size cl_vc4cl_performance_counters
Platform Name OpenCL for the Raspberry Pi VideoCore IV GPU
Number of devices 1
Device Name VideoCore IV GPU
Device Vendor Broadcom
Device Vendor ID 0x14e4
Device Version OpenCL 1.2 VC4CL 0.4.9999 (2bed01f)
Device Numeric Version 0x402000 (1.2.0)
Driver Version 0.4.9999
Device OpenCL C Version OpenCL C 1.2
Device Type GPU
Device Profile EMBEDDED_PROFILE
Device Available Yes
Compiler Available Yes
Linker Available Yes
Max compute units 1
Available core IDs 0
Max clock frequency 250MHz
Core Temperature (Altera) 39 C
Device Partition (core)
Max number of sub-devices 0
Supported partition types None
Supported affinity domains (n/a)
Max work item dimensions 3
Max work item sizes 12x12x12
Max work group size 12
Preferred work group size multiple (kernel) 1
Preferred / native vector sizes
char 16 / 16
short 16 / 16
int 16 / 16
long 0 / 0
half 0 / 0 (n/a)
float 16 / 16
double 0 / 0 (n/a)
Half-precision Floating-point support (n/a)
Single-precision Floating-point support (core)
Denormals No
Infinity and NANs No
Round to nearest No
Round to zero Yes
Round to infinity No
IEEE754-2008 fused multiply-add No
Support is emulated in software No
Correctly-rounded divide and sqrt operations No
Double-precision Floating-point support (n/a)
Address bits 32, Little-Endian
Global memory size 16777216 (16MiB)
Error Correction support No
Max memory allocation 8388608 (8MiB)
Unified memory for Host and Device Yes
Minimum alignment for any data type 64 bytes
Alignment of base address 512 bits (64 bytes)
Global Memory cache type Read/Write
Global Memory cache size 32768 (32KiB)
Global Memory cache line size 64 bytes
Image support No
Local memory type Global
Local memory size 16777216 (16MiB)
Max number of constant args 32
Max constant buffer size 16777216 (16MiB)
Max size of kernel argument 256
Queue properties
Out-of-order execution No
Profiling Yes
Prefer user sync for interop Yes
Profiling timer resolution 1ns
Execution capabilities
Run OpenCL kernels Yes
Run native kernels No
IL version SPIR-V_1.5 SPIR_1.2
ILs with version SPIR 0x402000 (1.2.0)
SPIR-V 0x405000 (1.5.0)
SPIR versions 1.2
printf() buffer size 0
Built-in kernels (n/a)
Built-in kernels with version (n/a)
Device Extensions cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_nv_pragma_unroll cl_arm_core_id cl_ext_atomic_counters_32 cl_khr_initialize_memory cl_arm_integer_dot_product_int8 cl_arm_integer_dot_product_accumulate_int8 cl_arm_integer_dot_product_accumulate_int16 cl_arm_integer_dot_product_accumulate_saturate_int8 cl_khr_il_program cl_khr_spir cl_khr_create_command_queue cl_altera_device_temperature cl_altera_live_object_tracking cl_khr_extended_versioning cl_khr_spirv_no_integer_wrap_decoration cl_khr_suggested_local_work_size cl_vc4cl_performance_counters
Device Extensions with Version cl_khr_global_int32_base_atomics 0x400000 (1.0.0)
cl_khr_global_int32_extended_atomics 0x400000 (1.0.0)
cl_khr_local_int32_base_atomics 0x400000 (1.0.0)
cl_khr_local_int32_extended_atomics 0x400000 (1.0.0)
cl_khr_byte_addressable_store 0x400000 (1.0.0)
cl_nv_pragma_unroll 0 (0.0.0)
cl_arm_core_id 0x800000 (2.0.0)
cl_ext_atomic_counters_32 0x1400000 (5.0.0)
cl_khr_initialize_memory 0x400000 (1.0.0)
cl_arm_integer_dot_product_int8 0xc00000 (3.0.0)
cl_arm_integer_dot_product_accumulate_int8 0xc00000 (3.0.0)
cl_arm_integer_dot_product_accumulate_int16 0xc00000 (3.0.0)
cl_arm_integer_dot_product_accumulate_saturate_int8 0xc00000 (3.0.0)
cl_khr_il_program 0x400000 (1.0.0)
cl_khr_spir 0x400000 (1.0.0)
cl_khr_create_command_queue 0x400000 (1.0.0)
cl_altera_device_temperature 0 (0.0.0)
cl_altera_live_object_tracking 0 (0.0.0)
cl_khr_extended_versioning 0x400000 (1.0.0)
cl_khr_spirv_no_integer_wrap_decoration 0 (0.0.0)
cl_khr_suggested_local_work_size 0x400000 (1.0.0)
cl_vc4cl_performance_counters 0 (0.0.0)
NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) OpenCL for the Raspberry Pi VideoCore IV GPU
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [P0]
clCreateContext(NULL, ...) [default] Success [P0]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) Success (1)
Platform Name OpenCL for the Raspberry Pi VideoCore IV GPU
Device Name VideoCore IV GPU
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1)
Platform Name OpenCL for the Raspberry Pi VideoCore IV GPU
Device Name VideoCore IV GPU
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) Success (1)
Platform Name OpenCL for the Raspberry Pi VideoCore IV GPU
Device Name VideoCore IV GPU |
If I run clinfo without sudo and LD-PRELOAD I only get a segmentation fault. |
Whether you need the
Basically usage with ICD loader and direct usage are mutually exclusive. Whichever you need depends on your use-case. If you want to install VC4CL system-wide you probably want to build VC4CL with |
You will def not like this (and I am starting to feel really sorry about coming back here), but within a clean debian bullseye Raspberry Pi OS following your wiki built instructions
|
FYI: |
That seems to be the underlying error. Did you install the requirements listed in here? Since they should provide the |
Yes I did. Copied the instructions straight from the wiki to make sure I did not fuck up.
|
Okay... ld IS installed tho. via
Just to make sure we are on the same page, I installed the OS with the following image: |
Yeah that seems okay, I also tested it with Raspberry Pi OS Bullseye Lite. Why clang can't find Can you build other CMake/C++ projects (e.g. clpeak)? |
I will hit the bed right now. But I will try all this out by tomorrow and properly document the results for you. |
No I have no idea why. I guess its OS setup default maybe? I did all apt installs in the order written in your wiki. |
Hi,
first of all thanks for this great project!
I'm currently trying to build VC4CL on a Raspberry Pi Zero following this description using the most recent Raspbian version (see below) after a normal `apt update && apt upgrade". Memory for linking VC4C was a bit low initially but making the swap file bigger helped.
Unfortunately I'm getting the error below in a late phase of building VC4CL - I've double checked library installation etc. but to no avail.
Any help would be greatly appreciated!
Kind regards,
Thomas
Raspbian version:
The text was updated successfully, but these errors were encountered: