I'm using yaml-cpp
library, which by default generates position dependent static library (libyaml-cpp.a
). My own library compiles into two versions, static and shared. Since I need shared one, I have to turn on PIC for the yaml-cpp
(that's the easy part). Now however, do I suffer performance hit in the static library? If yes, how big?
Basically, I have three options:
- compile
yaml-cpp
twice, once position dependent and once PIC, link appropriate onces into mine shared and static library- Pros: probably best perfomance wise, both mine shared and static and use same object files (meaning .cpp are compiled only once)
- Cons: probably most setup,
yaml-cpp
will be compiled twice but that should not matter, I'll be not changing it (that often)
- compile
yaml-cpp
once as PIC, link it into mine shared (PIC) and static (not PIC)- Pros: easy to setup
- Cons: source codes need to compile twice (shared (PIC), static (non PIC))
- compile
yaml-cpp
once as PIC and compile both mine (shared & static) as PIC too- Pros: easy to setup
- Cons: slight perfomance hit in static one?
So the option 1 seems like the best one. Do I have any false assumptions in my summary? Or did I miss any other option?
Platform: amd64