0

I have a C shared library used by IDL (on Linux). It gets compiled with:

make_dll,input_files,exported_routines,compile_directory=compilation_dir,EXTRA_CFLAGS="",EXTRA_LFLAGS="-flto"

I'm trying to use openmp in the code of the library. It works in tests compiled from C, but if I add -fopenmp to the EXTRA_CFLAGS, I get the following error when I try to run it from IDL:

/usr/local/exelis/idl83/bin/bin.linux.x86_64/idl: symbol lookup error: MyLib.so: undefined symbol: GOMP_parallel

So it's not linking to openmp, but adding -lgomp or -lomp doesn't link. What's the correct way to do this ?

mgalloy
  • 2,356
  • 1
  • 12
  • 10
dargaud
  • 2,431
  • 2
  • 26
  • 39
  • 1
    What if you try to link with `libgomp`? Hint: find it with `locate libgomp.a` – Mathieu Apr 12 '16 at 14:08
  • It seems that in fact does link (compiletime) dynamically to openmp but it can only load the openmp libraries exporting the named symbol when run directly instead of via IDL. – ljrk Apr 12 '16 at 14:11
  • Using the `SHOW_ALL_OUTPUT` and `VERBOSE` keywords should show you the full compilation command and its output which helps debug these types of issues. – mgalloy Apr 12 '16 at 19:17
  • I did it this way: make_dll,...,EXTRA_CFLAGS="... -fopenmp",VERBOSE=verbose,SHOW_ALL_OUTPUT=verbose but nothing extra gets displayed when I compile or when I run... Wrong way to do it ? Sorry, I know very little IDL, only C. – dargaud Apr 13 '16 at 08:44
  • As purplepsycho indicated, I added -L/usr/lib/gcc/x86_64-linux-gnu/4.9 -lgomp to EXTRA_LFLAGS and now it works, thanks. – dargaud Apr 13 '16 at 08:51

0 Answers0