segmentation fault when starting offload

Hi,
I just built the llvm+clang+openmp on 2 workstations.
One of them works fine but the other one cannot even start a toy code.
Any clue what is going on?

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00007ffff71cf718 in RTLsTy::LoadRTLs (this=0x7ffff73f82c8 ) at /home/yeluo/opt/llvm-clang/sources/llvm/projects/openmp/libomptarget/src/rtl.cpp:48
#2 0x00007ffff71d7e31 in std::__invoke_impl<void, void (RTLsTy::)(), RTLsTy> (__f=@0x7fffffffda70: (void (RTLsTy::)(RTLsTy * const)) 0x7ffff71cf630 RTLsTy::LoadRTLs(),
__t=@0x7fffffffda68: 0x7ffff73f82c8 ) at /usr/lib/gcc/x86_64-linux-gnu/8/…/…/…/…/include/c++/8/bits/invoke.h:73
#3 0x00007ffff71d7d92 in std::__invoke<void (RTLsTy::
)(), RTLsTy*> (__fn=@0x7fffffffda70: (void (RTLsTy::)(RTLsTy * const)) 0x7ffff71cf630 RTLsTy::LoadRTLs(),
__args=@0x7fffffffda68: 0x7ffff73f82c8 ) at /usr/lib/gcc/x86_64-linux-gnu/8/…/…/…/…/include/c++/8/bits/invoke.h:95
#4 0x00007ffff71d7d4c in void std::call_once<void (RTLsTy::
)(), RTLsTy*>(std::once_flag&, void (RTLsTy::&&)(), RTLsTy&&)::{lambda()#1}::operator()() const (this=0x7fffffffd808)
at /usr/lib/gcc/x86_64-linux-gnu/8/…/…/…/…/include/c++/8/mutex:672
#5 0x00007ffff71d7d07 in void std::call_once<void (RTLsTy::)(), RTLsTy>(std::once_flag&, void (RTLsTy::&&)(), RTLsTy&&)::{lambda()#2}::operator()() const (this=0x7ffff7dce7b8)
at /usr/lib/gcc/x86_64-linux-gnu/8/…/…/…/…/include/c++/8/mutex:677
#6 0x00007ffff71d7cd9 in void std::call_once<void (RTLsTy::)(), RTLsTy>(std::once_flag&, void (RTLsTy::&&)(), RTLsTy&&)::{lambda()#2}::__invoke() ()
at /usr/lib/gcc/x86_64-linux-gnu/8/…/…/…/…/include/c++/8/mutex:677
#7 0x00007ffff6d9e827 in __pthread_once_slow (once_control=0x7ffff73f82c8 , init_routine=0x7ffff7b08760 <__once_proxy>) at pthread_once.c:116
#8 0x00007ffff71d7cab in __gthread_once (__once=0x7ffff73f82c8 , __func=0x7ffff7b08760 <__once_proxy>)
at /usr/lib/gcc/x86_64-linux-gnu/8/…/…/…/…/include/x86_64-linux-gnu/c++/8/bits/gthr-default.h:699
#9 0x00007ffff71d06c4 in std::call_once<void (RTLsTy::)(), RTLsTy> (__once=…, __f=@0x7fffffffda70: (void (RTLsTy::*)(RTLsTy * const)) 0x7ffff71cf630 RTLsTy::LoadRTLs(),
__args=@0x7fffffffda68: 0x7ffff73f82c8 ) at /usr/lib/gcc/x86_64-linux-gnu/8/…/…/…/…/include/c++/8/mutex:684
#10 0x00007ffff71cff41 in RTLsTy::RegisterLib (this=0x7ffff73f82c8 , desc=0x4018d0 <.omp_offloading.descriptor>)
at /home/yeluo/opt/llvm-clang/sources/llvm/projects/openmp/libomptarget/src/rtl.cpp:191
#11 0x00007ffff71ce13f in __tgt_register_lib (desc=0x4018d0 <.omp_offloading.descriptor>) at /home/yeluo/opt/llvm-clang/sources/llvm/projects/openmp/libomptarget/src/interface.cpp:74
#12 0x0000000000400d87 in .omp_offloading.descriptor_reg.nvptx64-nvidia-cuda ()
#13 0x000000000040170d in __libc_csu_init ()
#14 0x00007ffff69bfb28 in __libc_start_main (main=0x400ec0 , argc=1, argv=0x7fffffffdbf8, init=0x4016c0 <__libc_csu_init>, fini=, rtld_fini=, stack_end=0x7fffffffdbe8)
at …/csu/libc-start.c:266
#15 0x0000000000400dfa in _start ()

Ye

Null ptr deteference in LoadRTLs suggests maybe the RTL wasn’t found. Are the file systems of these two systems identical?

Jeff

Hi,

can you post your toy code, please?
What is linked into your binary?
rtl.cpp:48 tries to call __kmpc_get_target_offload, which is implemented in libomp.so.

My best guess is that your system fetches a different version of libomp.so, which does not implement this function. So, what is the result of ldd on your binary on both systems?

- Joachim

@Jeff two systems are different.

@Joachim ldd shows that my program was picking up the wrong libomp which was installed via ubuntu package manager.

I just cleaned them up and the code is working fine now.
Thank you Jeff and Joachim

Ye