I am in a situation where I have to link some object files built with GCC to my application which is based on LLVM. The problem is that the application relies on LLVM's OpenMP library while the GCC objects have references to GCC's OpenMP. Thus I am getting a linker error. The command is rather complicated but it boils down to the following:
clang -shared -L../libs -o ../libs/libfoo.so -fopenmp clang_wrapper.o -lgcc_archive -lgfortran -lgcc_s
Undefined symbols for architecture arm64:
"___aarch64_cas8_acq_rel", referenced from:
___foo in libgcc_archive.a(bar.o)
"___aarch64_ldadd8_relax", referenced from:
_foo_ in libgcc_archive.a(bar.o)
"_omp_set_dynamic_8_", referenced from:
___foo in libgcc_archive.a(bar.o)
"_omp_set_nested_8_", referenced from:
___foo in libgcc_archive.a(bar.o)
"_omp_set_num_threads_8_", referenced from:
___foo in libgcc_archive.a(bar.o)
The above functions aren't available in LLVM's OpenMP library but are there in the GNU OpenMP library.
Is there some way to make this work even if I use GCC for linker? The end goal is to eliminate the dependency on GCC's OpenMP library and use LLVM instead.