Skip to contentSkip to conversation

Enable -fPIC for static toolchain libs

Buildroot [email protected] 1 participant 1 message Oct 30, 2023

lore
Share & tools
lore
#0 lore raw

Hello,

I am trying to enable -fPIC when building the static libs for the buildroot toolchain (BR2_STATIC_LIBS=y).
I need the static libs to be built with PIC in order to use them when building dynamic libraries (.so's) that uses these static libs.

How can I enable all static libs to be compiled with -fPIC? Can I use some global CFLAG/CXXFLAG-override?

I understand that this is not very common, so hacks are welcome.

For example, there is a config parameter in: Toolchain -> "Additional gcc options" - can I use this parameter to force the buildroot toolchain to always use -fPIC?

Please speak up if you have done this yourself, or if you know, or think you know of a solution.

I am currently using the LTS (2018.08) version but I can make a switch if it is needed.

Best,
Robert
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot