[Openmp-dev] Distributing program with OpenMP

Rob McDonald via Openmp-dev openmp-dev at lists.llvm.org
Mon Dec 18 09:19:58 PST 2017

I'd like to distribute my program that uses OpenMP built with CLang
5.0.  I use CLang/LLVM as provided by MacPorts.

I need to distribute my program to users who won't have MacPorts or a
compiler installed.

Unsurprisingly, output of otool shows that my program needs libomp.dylib:

otool -L myprogram
/opt/local/lib/libomp/libomp.dylib (compatibility version 5.0.0,
current version 5.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 1226.10.1)

Previously, I had compiled my program using gcc and was able to link
OpenMP statically

otool -L myprogram
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 159.1.0)

By doing something like this:

  set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")

Is there a way to do this with CLang?

If not, what is the preferred way to bundle the required OpenMP library?

I build from a CMake environment, so on Windows, I already do this:
INCLUDE( InstallRequiredSystemLibraries )
to grab all the required OpenMP libraries and whatnot.

My program is distributed as a dumb *.zip file -- nothing that gets
installed to the system.  Will this still work in this paradigm, or
will I need to get permission and install this library?


More information about the Openmp-dev mailing list