-
Notifications
You must be signed in to change notification settings - Fork 115
Build with -fPIC #49
Comments
CMake should automatically set PIC for shared libraries. Are you not seeing this? Jaeger links to opentracing-cpp statically (even for its dynamic build), which is probably why it's complaining. But you can build with |
@rnburn I use CMAKE_POSITION_INDEPENDENT_CODE to compile both static and shared libraries with |
I don't really see any good reason not to build without -fPIC these days, but in any case, that seems like Jaeger doing something weird. It shouldn't be linking to the opentracing static lib for its own shared lib anyway. Will open issue there. |
@isaachier That only helps if you let Jaeger build opentracing via its download-everything-from-the-Internet magic. That's not going to fly in the sorts of environments many things like databases deploy in. Otherwise you have to know to build your opentracing that way, and it's currently an undocumented requirement. More generally, linking to a static lib in a shared lib is a weird thing to do. Is there a compelling reason Jaeger does that? |
Workaround: build opentracing with |
Well this particular setting has nothing to do with Hunter. I'm suggesting @rnburn use this standard cmake setting I used. |
@isaachier it's not at all standard to build static libraries with -fPIC. |
I don't mean it is standard behavior, just a well documented CMake option. However, I have seen it done in OpenSSL and gRPC. |
The reason Jaeger does it is to allow linking a shared object from the static archive. I would consider switching that out, but the downsides seem rather vague (potential slowdown, unclear how significant). |
Opentracing should really default to building a shared lib with -fPIC (gcc); there's not really any good reason not to build position-indepedent code anymore.
Lack of -fPIC upsets jaeger-cpp among other things.
The text was updated successfully, but these errors were encountered: