c++ - Problems linking .o library files together into a shared object -


i working on collection of reusable libraries need made available both static libraries (.a & .lib) , dynamic libraries (.so & .dll).

i want dependency management dynamic libraries simple possible (you take 1 dynamic library each bit of functionality need), of functional dependencies each dynamic library has statically linked it. thus, dynamic libraries offer functionality downstream clients dynamically, upstream dependencies satisfied statically.

the upshot of all of static libraries need compiled -fpic code suitable linkage shared library. same goes third-party library use. has static library, compiled -fpic.

(i could, suppose, build both pic , non-pic variants of libraries - not want compile libraries third time each target platform -- twice quite (more than) enough!).

so, here problem:

i have been trying compile boost_system static library -fpic, not sure if succeeding:

/b2 --build-type=complete variant=release link=static threading=multi runtime-link=static --layout=versioned --cxxflags=-fpic 

this build produces .a files output, expected. however, when try link boost static library 1 of shared libraries, start getting error message indicates boost_system not position independent code:

.../dependencies/external/boost/1_54_0/stage/lib/linux_x86_64/libboost_system-gcc46-s-1_54.a(error_code.o):  relocation r_x86_64_32 against `.rodata.str1.1' can not used when making shared object; recompile -fpic 

however, have (attempted) build boost -fpic. there test can use determine if libboost_system pic code? i.e. if problem building boost - or linking application.

i believe problem can solved removing command line option "runtime-link=static" enables static linking of c++ runtime libraries. since building dynamic shared library object, want avoid behavior, if clients link library different linux os configurations. however, option "link=static" ok , should remain.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -