Skip to contentSkip to conversation

libtommath: add -fPIC

PATCH New Francois Perrad 4 participants 7 messages Apr 30, 2016 – May 1, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtommath: add -fPIC

fix build with x86_64, see http://autobuild.buildroot.net/results/212/212469db5dc8399070390603c0fdf7f12b130cda/

---
 package/libtommath/libtommath.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/libtommath/libtommath.mk +1 -1
index 463ea7b..eb3b00e 100644
@@ -13,7 +13,7 @@ LIBTOMMATH_INSTALL_STAGING = YES
 LIBTOMMATH_INSTALL_TARGET = NO  # only static library
 
 define LIBTOMMATH_BUILD_CMDS
-	$(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) CFLAGS="-I./ $(TARGET_CFLAGS)"
+	$(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) CFLAGS="-I./ -fPIC $(TARGET_CFLAGS)"
 endef
 
 define LIBTOMMATH_INSTALL_STAGING_CMDS
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/1 libtommath: add -fPIC

Hello,

Quoted 6 lines · Francois Perrad

fix build with x86_64, see http://autobuild.buildroot.net/results/212/212469db5dc8399070390603c0fdf7f12b130cda/

---
 package/libtommath/libtommath.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 libtommath: add -fPIC

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hello,

Quoted 3 lines · Francois Perrad

fix build with x86_64, see
http://autobuild.buildroot.net/results/212/212469db5dc8399070390603c0fdf7f12b130cda/

Quoted 6 lines
Quoted 4 lines

---
package/libtommath/libtommath.mk | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

Applied to master, thanks.

Hmm, isn't it a bit odd to build a static library with -fPIC?

But OK, the error message seems to be from trying to link a shared library with it.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/1 libtommath: add -fPIC

Hello,

Quoted 6 lines · Peter Korsgaard
Quoted 1 line

Applied to master, thanks.

Hmm, isn't it a bit odd to build a static library with -fPIC?

But OK, the error message seems to be from trying to link a shared library with it.

Well, as you've seen yourself, this static library is then used inside a shared library, so it has to be built -fPIC.

If you want to build the static library without -fPIC, then the libtommath package should also provide a shared version of its library, so that it gets used instead of the static one when linked into a shared library.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH 1/1 libtommath: add -fPIC

Quoted 7 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hmm, isn't it a bit odd to build a static library with -fPIC?

But OK, the error message seems to be from trying to link a shared library with it.

Quoted 7 lines

Well, as you've seen yourself, this static library is then used inside a shared library, so it has to be built -fPIC.

If you want to build the static library without -fPIC, then the libtommath package should also provide a shared version of its library, so that it gets used instead of the static one when linked into a shared library.

Hmm, should we do this for all static only libraries in case they would ever get used by a shared library? E.G. ezxml is a similar package.

Signature · 2 lines
Venlig hilsen,
Peter Korsgaard 
#5 lore raw

PATCH 1/1 libtommath: add -fPIC

Hello,

Quoted 10 lines · Peter Korsgaard
Quoted 7 lines

Well, as you've seen yourself, this static library is then used inside a shared library, so it has to be built -fPIC.

If you want to build the static library without -fPIC, then the libtommath package should also provide a shared version of its library, so that it gets used instead of the static one when linked into a shared library.

Hmm, should we do this for all static only libraries in case they would ever get used by a shared library? E.G. ezxml is a similar package.

Well, as soon as some object code ends up being used in a shared library (directly or via linking to a static library), then it must be compiled with -fPIC, at least on some architectures (x86_64 and mips are the one who clearly abort the build if that's not the case).

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#6 lore raw

PATCH 1/1 libtommath: add -fPIC

In reply to Peter Korsgaard

2016-04-30 20:43 GMT+02:00 Peter Korsgaard <[email protected]>:

Quoted 12 lines
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hello,

Quoted 7 lines · Francois Perrad

fix build with x86_64, see
http://autobuild.buildroot.net/results/212/212469db5dc8399070390603c0fdf7f12b130cda/

---
package/libtommath/libtommath.mk | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 7 lines
Quoted 1 line

Applied to master, thanks.

Hmm, isn't it a bit odd to build a static library with -fPIC?

But OK, the error message seems to be from trying to link a shared library with it.

libtommath have a support for shared library via a makefile.shared. But it is currently broken for cross compilation (bad linking with libtool).

Fran?ois

Quoted 6 lines

--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot