libscrypt: -fPIC is needed to build for MIPS
PATCH 1/1 libscrypt: -fPIC is needed to build for MIPS
The error looks like this:
ld: crypto_scrypt-nosse.o: relocation R_MIPS_26 against `a local symbol' can not be used when making a shared object; recompile with -fPIC crypto_scrypt-nosse.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Adding -fPIC to CFLAGS fixes the problem.
Fixes:
http://autobuild.buildroot.net/results/967ad7fae0137f64b165c986c251d143ac825147
--- package/libscrypt/libscrypt.mk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
package/libscrypt/libscrypt.mk +9 -1
@@ -17,8 +17,16 @@ endef LIBSCRYPT_POST_PATCH_HOOKS += LIBSCRYPT_DISABLE_STACK_PROTECTOR endif +LIBSCRYPT_CFLAGS = $(TARGET_CFLAGS) + +# -fPIC is needed to build for MIPS +ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y) +LIBSCRYPT_CFLAGS += -fPIC +endif + define LIBSCRYPT_BUILD_CMDS - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(LIBSCRYPT_CFLAGS)" endef define LIBSCRYPT_INSTALL_STAGING_CMDS
Signature · 1 line
2.10.2
PATCH 1/1 libscrypt: -fPIC is needed to build for MIPS
Hello,
package/libscrypt/libscrypt.mk endef · line 25
Quoted 4 lines · Vicente Olivert Riera
package/libscrypt/libscrypt.mk +4
-0+# -fPIC is needed to build for MIPS +ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y) +LIBSCRYPT_CFLAGS += -fPIC +endif
This is not really the proper fix, because:
1. -fPIC is not only needed for MIPS.
2. The Makefile already passes -fPIC, but it gets overridden because Buildroot passes its own CFLAGS.
So I believe the patch proposed by Stefan S?rensen at
http://patchwork.ozlabs.org/patch/738605/ is a more appropriate solution.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com