AvxWindowFmIndex
AvxWindowFmIndex copied to clipboard
Submodule divsfusort is missing OpenMP symbols when statically built
When building a simple example and attempting to statically link in the libraries using the instructions from the README, the following error occurs:
/usr/bin/ld: ../AvxWindowFmIndex/build/libdivsufsort64.a(divsufsort.o): in function `sort_typeBstar._omp_fn.0':
divsufsort.c:(.text+0x40): undefined reference to `omp_get_thread_num'
/usr/bin/ld: divsufsort.c:(.text+0x7c): undefined reference to `GOMP_critical_name_end'
/usr/bin/ld: divsufsort.c:(.text+0xcf): undefined reference to `GOMP_critical_name_start'
/usr/bin/ld: divsufsort.c:(.text+0x12f): undefined reference to `GOMP_critical_name_end'
/usr/bin/ld: ../AvxWindowFmIndex/build/libdivsufsort64.a(divsufsort.o): in function `sort_typeBstar':
divsufsort.c:(.text+0x39d): undefined reference to `omp_get_max_threads'
/usr/bin/ld: divsufsort.c:(.text+0x421): undefined reference to `GOMP_parallel'
It it worth noting that the shared object of libawfmindex.so does end up linking to OpenMP:
$ ldd libawfmindex.so
linux-vdso.so.1 (0x00007fff16327000)
libfastavector.so => /home/ericr/work/umap-fmindex/AvxWindowFmIndex/lib/FastaVector/build/libfastavector.so (0x00007f8aa3a6a000)
libgomp.so.1 => /lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f8aa3a17000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8aa37ef000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8aa3a88000)
Hi Eric, can you please tell me what OS you are attempting to compile on? iOS's builtin "gcc" is actually an old version of clang, which doesn't support openmp, and it's been a bit of a thorn in our side for a while to work around.
also, just for sanity, if you are on iOS, did you install gcc with brew and give the path to the cmake?
cmake -DCMAKE_C_COMPILER=/path/to/gcc .
Using WSL (linux) currently.
FWIW I'm working around this by simply including -lgomp in my builds though I assume one of the static libraries should linking to it through the cmake build.
Hi @EricR86 , I've added some changes that should fix your issues on WSL. I've tested it myself, but before I close this issue, I would appreciate it if you could check to make sure it's working for you.
After a fresh rebuild the GOMP symbols are still undefined.
In retrospect I don't think this is a big deal, it just means that any binary using the static library has a runtime dependency on OpenMP which is not unreasonable and requires a -lgomp flag.
This issue has been addressed a while ago but wasn't closed.