Skip to content

opencl-neo driver build might fail due to non-full symbols resolution (missing -Wl,--no-undefined) #44

Closed
@dvrogozh

Description

@dvrogozh

Assuming that IGC and common_clang were built against LLVM-8 per this instruction: https://github.com/dvrogozh/intel-graphics-compiler/blob/rfc_readme/README.md#building

Then building https://github.com/intel/compute-runtime the following build failure could be observed:

cd build && cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON -DCMAKE_INSTALL_RUNSTATEDIR=/run "-GUnix Makefiles" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu -DCMAKE_BUILD_TYPE=Release -DIGC_DIR=/usr -Wno-dev ..
 
<…>
 
cd /home/src/pkg-opencl/intel-compute-runtime.git/runtime/built_ins/kernels && LD_LIBRARY_PATH=/usr/lib/ /home/src/pkg-opencl/intel-compute-runtime.git/build/bin/ocloc -q -file aux_translation.igdrcl_built_in -device bdw -64 -out_dir /home/src/pkg-opencl/intel-compute-runtime.git/build/bin/built_ins/x64/gen8 -cpp_file -options -cl-kernel-arg-info
 
[0]: /home/src/pkg-opencl/intel-compute-runtime.git/build/bin/ocloc(_ZN16SafetyGuardLinux9sigActionEiP9siginfo_tPv+0x30) [0x56312b563bb0]
[1]: /lib/x86_64-linux-gnu/libpthread.so.0(+0x12730) [0x7f2779ba0730]
[2]: /lib64/ld-linux-x86-64.so.2(+0x147e1) [0x7f2779bd27e1]
[3]: /lib/x86_64-linux-gnu/libc.so.6(_dl_catch_exception+0x6f) [0x7f27797e0eaf]
[4]: /lib/x86_64-linux-gnu/libc.so.6(_dl_catch_error+0x2f) [0x7f27797e0f3f]
[5]: /lib/x86_64-linux-gnu/libdl.so.2(+0x1975) [0x7f2779bb0975]
[6]: /lib/x86_64-linux-gnu/libdl.so.2(dlclose+0x24) [0x7f2779bb0364]
[7]: /usr/lib/libigdfcl.so(+0x3a39) [0x7f2779629a39]
[8]: /usr/lib/libigdfcl.so(+0x3c83) [0x7f2779629c83]
[9]: /usr/lib/libigdfcl.so(+0xd904) [0x7f2779633904]
[10]: /home/src/pkg-opencl/intel-compute-runtime.git/build/bin/ocloc(_ZN5OCLRT15OfflineCompiler15buildSourceCodeEv+0x3ad) [0x56312b55a7dd]
[11]: /home/src/pkg-opencl/intel-compute-runtime.git/build/bin/ocloc(_ZN5OCLRT15OfflineCompiler5buildEv+0xe) [0x56312b55ed3e]
[12]: /home/src/pkg-opencl/intel-compute-runtime.git/build/bin/ocloc(_ZN16SafetyGuardLinux4callIiN5OCLRT15OfflineCompilerEMS2_FivEEET_PT0_T1_S5_+0x46) [0x56312b563c66]
[13]: /home/src/pkg-opencl/intel-compute-runtime.git/build/bin/ocloc(_Z20buildWithSafetyGuardPN5OCLRT15OfflineCompilerE+0x7b) [0x56312b563b5b]
[14]: /home/src/pkg-opencl/intel-compute-runtime.git/build/bin/ocloc(main+0xc9) [0x56312b54c5f9]
[15]: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x7f27796d009b]
[16]: /home/src/pkg-opencl/intel-compute-runtime.git/build/bin/ocloc(_start+0x2a) [0x56312b54c90a]
Aborted (core dumped)
make[3]: *** [igdrcl_lib_release/built_ins/kernels/CMakeFiles/builtins_Gen8core.dir/build.make:76: bin/built_ins/x64/gen8/aux_translation_Gen8core.spv] Error 134

The ultimate reason for this behavior is non-full symbols resolution performed by common_clang, i.e. missing missing -Wl,--no-undefined in linker flags. This can be seen if the above ocloc command line will be rerun with LD_DEBUG=libs:

/usr/local/lib/libcommon_clang.so: error: symbol lookup error: undefined symbol: LLVMInitializeSparcAsmParser (fatal)

Note: segmentation fault happens because IGC don't check for nullptr on dlclose() here: https://github.com/intel/intel-graphics-compiler/blob/master/IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp#L663, but this is actually secondary issue. See intel/intel-graphics-compiler#72.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions