[Mesa-dev] [Libclc-dev] opencl-example: didn't compile (run) with latest LLVM git (for some days)
Emil Velikov
emil.l.velikov at gmail.com
Tue Oct 3 12:48:37 UTC 2017
On 20 September 2017 at 18:26, Jan Vesely <jan.vesely at rutgers.edu> wrote:
> adding mesa-dev. This is not really related to libclc.
>
> On Wed, 2017-09-20 at 12:50 +0200, Dieter Nützel via Libclc-dev wrote:
>> Worked OK with older version (for me latest was #6c9f36933c5) but with
>> your 'clover: Fix build after LLVM r313390' reverted.
>>
>> Now I get this during compilation tries:
>>
>> /opt/opencl-example> make
>> gcc -o hello_world hello_world.o cl_simple.o cl_util.o -L/usr/local/lib
>> -lOpenCL
>> /usr/local/lib64/libOpenCL.so: undefined reference to
>> `llvm::LLVMContext::getDiagnosticHandler() const at LLVM_6.0'
>> /usr/local/lib64/libOpenCL.so: undefined reference to
>> `llvm::isKnownNonNull(llvm::Value const*)@LLVM_6.0'
>> /usr/local/lib64/libOpenCL.so: undefined reference to
>> `llvm::DIBuilder::createCompileUnit(unsigned int, llvm::DIFile*,
>> llvm::StringRef, bool, llvm::StringRef, unsigned int, llvm::StringRef,
>> llvm::DICompileUnit::DebugEmissionKind, unsigned long, bool,
>> bool)@LLVM_6.0'
>
> This is odd, this function is pretty old.
>
>> /usr/local/lib64/libOpenCL.so: undefined reference to
>> `llvm::LLVMContext::setDiagnosticHandler(void (*)(llvm::DiagnosticInfo
>> const&, void*), void*, bool)@LLVM_6.0'
>> collect2: error: ld returned 1 exit status
>> make: *** [Makefile:10: hello_world] Fehler 1
>>
>> Greetings,
>> Dieter
>>
>> For reference (running '/opt/amdgpu-pro/bin/clinfo'):
>>
>> /opt/opencl-example> /opt/amdgpu-pro/bin/clinfo
>> /opt/amdgpu-pro/bin/clinfo: /usr/local/lib64/libOpenCL.so.1: no version
>> information available (required by /opt/amdgpu-pro/bin/clinfo)
>> /opt/amdgpu-pro/bin/clinfo: /usr/local/lib64/libOpenCL.so.1: no version
>> information available (required by /opt/amdgpu-pro/bin/clinfo)
>> ATTENTION: default value of option mesa_glthread overridden by
>> environment.
>> ATTENTION: default value of option radeonsi_assume_no_z_fights
>> overridden by environment.
>> ATTENTION: default value of option radeonsi_commutative_blend_add
>> overridden by environment.
>> ATTENTION: default value of option mesa_glthread overridden by
>> environment.
>> Number of platforms: 1
>> Platform Profile: FULL_PROFILE
>> Platform Version: OpenCL 1.1 Mesa
>> 17.3.0-devel (git-94fef19509)
>> Platform Name: Clover
>> Platform Vendor: Mesa
>> Platform Extensions: cl_khr_icd
>>
>>
>> Platform Name: Clover
>> Number of devices: 1
>> Device Type: CL_DEVICE_TYPE_GPU
>> Vendor ID: 1002h
>> Max compute units: 36
>> Max work items dimensions: 3
>> Max work items[0]: 256
>> Max work items[1]: 256
>> Max work items[2]: 256
>> Max work group size: 256
>> Preferred vector width char: 16
>> Preferred vector width short: 8
>> Preferred vector width int: 4
>> Preferred vector width long: 2
>> Preferred vector width float: 4
>> Preferred vector width double: 2
>> Native vector width char: 16
>> Native vector width short: 8
>> Native vector width int: 4
>> Native vector width long: 2
>> Native vector width float: 4
>> Native vector width double: 2
>> Max clock frequency: 1411Mhz
>> Address bits: 64
>> Max memory allocation: 6010904166
>> Image support: No
>> Max size of kernel argument: 1024
>> Alignment (bits) of base address: 1024
>> Minimum alignment (bytes) for any datatype: 128
>> Single precision floating point capability
>> Denorms: No
>> Quiet NaNs: Yes
>> Round to nearest even: Yes
>> Round to zero: No
>> Round to +ve and infinity: No
>> IEEE754-2008 fused multiply-add: No
>> Cache type: None
>> Cache line size: 0
>> Cache size: 0
>> Global memory size: 8587005952
>> Constant buffer size: 2147483647
>> Max number of constant args: 16
>> Local memory type: Scratchpad
>> Local memory size: 32768
>> /opt/amdgpu-pro/bin/clinfo: relocation error:
>> /usr/local/lib64/libOpenCL.so.1: symbol
>> _ZN4llvm11LLVMContext20setDiagnosticHandlerEPFvRKNS_14DiagnosticInfoEPvES4_b,
>> version LLVM_6.0 not defined in file libLLVM-6.0svn.so with link time
>> reference
>
> this looks like libLLVM-6.0svn.so is an older version than what you
> built clover against. Did you rebuild and reinstall llvm after r313390?
>
Some ideas/things to debug:
- does libOpenCL.so comes from Mesa or it's the ocl-icd/another package
- what do you get for `ldd -r /path/to/libOpenCL.so | grep undefined'
- the latter should always be zero since we tell the linker to error
out in our builds
- wrong library gets picked at the wrong place
- symbol versioning is not working properly
In the last case, static linking llvm may help
./configure --disable-llvm-shared-libs ...
-Emil
More information about the mesa-dev
mailing list