Hello All, I'm a newbie to this mailing list. I am trying to build static boost libraries and link to my libraries. I used ./bjam debug link=static cxxflags="-std=c++0x" stage to build the boost libraries. When I build my libraries (shared or static) with linking to boost libraries, I get the following error: libboost_regex.a(instances.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC libboost_regex.a: could not read symbols: Bad value Then I tried adding -fPIC while building my boost libraries. Didn't help. Any suggestions. Thank you Kotesh
If you want to compile something that will be in a shared library, you
need to recompile Boost libraries with -fPIC. When switching to static
libraries, this flag is not added.
Static libraries don't need to be linked against Boost BTW.
Cheers,
Matthieu
2014-03-03 20:35 GMT+00:00 Koteswara Rao Ruvva
Hello All,
I'm a newbie to this mailing list. I am trying to build static boost libraries and link to my libraries. I used ./bjam debug link=static cxxflags="-std=c++0x" stage to build the boost libraries. When I build my libraries (shared or static) with linking to boost libraries, I get the following error: libboost_regex.a(instances.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC libboost_regex.a: could not read symbols: Bad value Then I tried adding -fPIC while building my boost libraries. Didn't help. Any suggestions.
Thank you Kotesh
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Information System Engineer, Ph.D. Blog: http://matt.eifelle.com LinkedIn: http://www.linkedin.com/in/matthieubrucher Music band: http://liliejay.com/
Thanks Matthieu.
As I mentioned I used the -fPIC option while building the static boost libraries as shown below:
./bjam debug link=static cxxflags="-fPIC -std=c++0x" stage
But didn't help. Still getting the same error message.
BTW, following is my system info, if that helps:
Linux lily-linux 3.5.0-46-generic #70~precise1-Ubuntu SMP Thu Jan 9 23:55:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Kotesh
________________________________
From: Matthieu Brucher
Hello All,
I'm a newbie to this mailing list. I am trying to build static boost libraries and link to my libraries. I used ./bjam debug link=static cxxflags="-std=c++0x" stage to build the boost libraries. When I build my libraries (shared or static) with linking to boost libraries, I get the following error: libboost_regex.a(instances.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC libboost_regex.a: could not read symbols: Bad value Then I tried adding -fPIC while building my boost libraries. Didn't help. Any suggestions.
Thank you Kotesh
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Information System Engineer, Ph.D. Blog: http://matt.eifelle.com LinkedIn: http://www.linkedin.com/in/matthieubrucher Music band: http://liliejay.com/ _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On Mar 3, 2014, at 5:37 PM, Koteswara Rao Ruvva
wrote: Thanks Matthieu.
As I mentioned I used the -fPIC option while building the static boost libraries as shown below:
./bjam debug link=static cxxflags="-fPIC -std=c++0x" stage
But didn't help. Still getting the same error message.
You need to use the -fPIC option when building your code also. Any object files that are to be placed into a static library for the x86_64 architecture must be compiled using position-independent code. Jason
You need to use the -fPIC option when building your code also. Any object files that are to be placed into a static library for the x86_64 architecture must be compiled using position-independent code.
That's not exactly true. Only code that can end up in a _shared_ library (i.e. source code of a shared library or a static library that is linked against a shared library) needs to be compiled with this option. Matthieu -- Information System Engineer, Ph.D. Blog: http://matt.eifelle.com LinkedIn: http://www.linkedin.com/in/matthieubrucher Music band: http://liliejay.com/
On Mar 3, 2014, at 7:00 PM, Matthieu Brucher
You need to use the -fPIC option when building your code also. Any object files that are to be placed into a static library for the x86_64 architecture must be compiled using position-independent code.
That's not exactly true. Only code that can end up in a _shared_ library (i.e. source code of a shared library or a static library that is linked against a shared library) needs to be compiled with this option.
Thanks. I swapped the static/shared library type in my description before. I concur with your explanation. Jason
That worked. Thank you Matthieu & Jason.
________________________________
From: Matthieu Brucher
You need to use the -fPIC option when building your code also. Any object files that are to be placed into a static library for the x86_64 architecture must be compiled using position-independent code.
That's not exactly true. Only code that can end up in a _shared_ library (i.e. source code of a shared library or a static library that is linked against a shared library) needs to be compiled with this option. Matthieu -- Information System Engineer, Ph.D. Blog: http://matt.eifelle.com LinkedIn: http://www.linkedin.com/in/matthieubrucher Music band: http://liliejay.com/ _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Jason Roehm
-
Koteswara Rao Ruvva
-
Matthieu Brucher