This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Linking OpenMP Statically on Mac


On 01/05/15 05:50, Rob McDonald wrote:
When I specify -fopenmp, the program is dynamically linked to
libgomp.1.dylib.  I read that -static is not supported on OSX, as the
Apple system libraries are not provided with static variants.

So, is there a way to statically link libgomp in this situation?
If you have/build libgomp as a static library, it should be possible to only link libcomp statically. If -fopenmp flag insists on linking dynamically, you may need to call the linker manually. But I think it could be done.

Or, will I need to distribute libgomp.1.dylib with my program?  Does
the license allow this?
IMHO it does. libgomp is GPL so you can always distribute it (following its license), but given that libgomp is covered by the GCC Runtime Library Exception, I think you may be able to redistribute just the binary file (I would still stick a note explaining
that it's an unchanged libgomp vX.Y by foo, though)
https://www.gnu.org/licenses/gcc-exception-3.1-faq.en.html
https://www.gnu.org/licenses/gcc-exception-3.1.en.html



Being a good citizen, where should I put the
file?  I would prefer my users not to have to use sudo to install if
they don't absolutely have to.  My program is currently not a Package,
it is just an executable and some data files distributed in a *.zip.
If you use a wrapper script using a LD_PRELOAD trick to load libgomp.1.dylib from the current folder, you can probably continue using a "plain-zip approach". Just note that the linker variables in Mac OS are named differently:
http://unix.stackexchange.com/questions/30444/libfaketime-and-mac-os-ld-preload#30449


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]