On Wednesday, October 18, 2017 at 3:52:06 AM UTC-7, Rodrigo Queiro wrote:
> Hey bazel-discuss@,
>
>
> I'm building something depends on libgomp as it compiles with -fopenmp. I'd like to statically link this in to make the binary more portable. I don't want to build a fully-static library, as this breaks getaddrinfo().
>
>
> This can be done with gcc using -static-libstdc++ or -Wl,-Bstatic -lgomp -Wl,-Bdynamic. -static-libstdc++ doesn't work with Bazel because of #2840. The latter doesn't work, as the "-lgomp" is removed and put in the params file.
>
>
> I could check in libgomp.a into the repo, or work out where to load it from the local system, but those both seem messy.
>
>
> Can anyone suggest what the best way to do this would be?
A somewhat-hacky way to accomplish this is to use syntax like -l:libgomp.a to force the linker to search for only the static library.