Makefile: Symlink lib32 to lib for MIPS64/n32
PATCH 1/1 Makefile: Symlink lib32 to lib for MIPS64/n32
From: Markos Chandras <[email protected]>
gcc hardcodes the uClibc interpreter for MIPS64/n32 as follows:
(gcc-4.7.3, gcc/config/mips/linux64.h):
define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
However, buildroot always creates the $(TARGET_DIR)/lib and $(TARGET_DIR)/usr/lib directories, therefore for consinstency reasons, we create a lib32->lib symlink to fix the interpreter problems for MIPS64/n32.
--- Makefile | 6 ++++++ 1 file changed, 6 insertions(+)
Makefile +6 -0
@@ -436,6 +436,12 @@ $(BUILD_DIR)/.root: --exclude .hg --exclude=CVS --exclude '*~' \ $(TARGET_SKELETON)/ $(TARGET_DIR)/ cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE) +ifeq ($(BR2_MIPS_NABI32),y) + pushd $(TARGET_DIR) > /dev/null 2>&1; \ + ln -sfn lib lib32; \ + ln -sfn lib usr/lib32; \ + popd > /dev/null 2>&1 +endif touch $@ $(TARGET_DIR): $(BUILD_DIR)/.root
Signature · 1 line
1.8.2.1
PATCH 1/1 Makefile: Symlink lib32 to lib for MIPS64/n32
Quoted 10 lines · Markos Chandras
From: Markos Chandras <[email protected]>
gcc hardcodes the uClibc interpreter for MIPS64/n32 as follows:
(gcc-4.7.3,gcc/config/mips/linux64.h):
defineUCLIBC_DYNAMIC_LINKERN32"/lib32/ld-uClibc.so.0"However, buildroot always creates the $(TARGET_DIR)/lib and $(TARGET_DIR)/usr/lib directories, therefore for consinstency reasons, we create a
lib32->libsymlink to fix the interpreter problems for MIPS64/n32.
I would say we do it for all 32-bit platforms. If people feel they
can't afford the overhead of two additional inodes in their rootfs, they can still remove the link in a post-build script.
Quoted 11 lines
Signed-off-by Markos Chandras <[email protected]>--- Makefile | 6 ++++++ 1 file changed, 6 insertions(+)Makefile +0
-0
Makefile $(BUILD_DIR)/.root: · line 442
Quoted 7 lines
Makefile +4
-0@@ -436,6 +436,12 @@ $(BUILD_DIR)/.root: --exclude .hg --exclude=CVS --exclude '*~' \ $(TARGET_SKELETON)/ $(TARGET_DIR)/ cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE) +ifeq ($(BR2_MIPS_NABI32),y) + pushd $(TARGET_DIR) > /dev/null 2>&1; \ + ln -sfn lib lib32; \ + ln -sfn lib usr/lib32; \
No need for the pushd/popd; just:
ln -sfn lib $(TARGET_DIR)/lib32 ln -sfn lib $(TARGET_DIR)/usr/lib32
Regards,
Arnout
Quoted 6 lines
Makefile +2
-0+ popd > /dev/null 2>&1 +endif touch $@ $(TARGET_DIR): $(BUILD_DIR)/.root
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
PATCH 1/1 Makefile: Symlink lib32 to lib for MIPS64/n32
Hi Arnout,
Quoted 14 lines · Arnout Vandecappelle
Quoted 11 lines · Markos Chandras
From: Markos Chandras <[email protected]>
gcc hardcodes the uClibc interpreter for MIPS64/n32 as follows:
(gcc-4.7.3,gcc/config/mips/linux64.h):
defineUCLIBC_DYNAMIC_LINKERN32"/lib32/ld-uClibc.so.0"However, buildroot always creates the $(TARGET_DIR)/lib and $(TARGET_DIR)/usr/lib directories, therefore for consinstency reasons, we create a
lib32->libsymlink to fix the interpreter problems for MIPS64/n32.
Quoted 3 lines
I would say we do it for all 32-bit platforms. If people feel they can't
afford the overhead of two additional inodes in their rootfs, they can still remove the link in a post-build script.
I wouldn't mind doing the symlink for the following architectures:
!mips64/n64 && !x86_64 && !sparc64. It's probably harmless. Do I forget another architecture?
Quoted 11 lines
Makefile $(BUILD_DIR)/.root: · line 442
Quoted 4 lines
Makefile +4
-0+ifeq ($(BR2_MIPS_NABI32),y) + pushd $(TARGET_DIR) > /dev/null 2>&1; \ + ln -sfn lib lib32; \ + ln -sfn lib usr/lib32; \No need for the pushd/popd; just:
ln -sfn lib $(TARGET_DIR)/lib32 ln -sfn lib $(TARGET_DIR)/usr/lib32
Thanks. I will fix that in v2
--
Regards,
Markos Chandras
PATCH 1/1 Makefile: Symlink lib32 to lib for MIPS64/n32
In reply to Arnout VandecappelleHi Arnout,
Quoted 14 lines · Arnout Vandecappelle
Quoted 11 lines · Markos Chandras
From: Markos Chandras <[email protected]>
gcc hardcodes the uClibc interpreter for MIPS64/n32 as follows:
(gcc-4.7.3,gcc/config/mips/linux64.h):
defineUCLIBC_DYNAMIC_LINKERN32"/lib32/ld-uClibc.so.0"However, buildroot always creates the $(TARGET_DIR)/lib and $(TARGET_DIR)/usr/lib directories, therefore for consinstency reasons, we create a
lib32->libsymlink to fix the interpreter problems for MIPS64/n32.
Quoted 4 lines
I would say we do it for all 32-bit platforms. If people feel they can't
afford the overhead of two additional inodes in their rootfs, they can still remove the link in a post-build script.
Is this preferred?
+ifeq ($(BR2_MIPS_NABI64)$(BR2_aarch64)$(BR2_sh64)$(BR2_x86_64),)
+ ln -sfn lib $(TARGET_DIR)/lib32; \
+ ln -sfn lib $(TARGET_DIR)/usr/lib32;
+endif
--
Regards,
Markos Chandras
PATCH 1/1 Makefile: Symlink lib32 to lib for MIPS64/n32
Quoted 17 lines · Markos Chandras
Hi Arnout,
Quoted 14 lines · Arnout Vandecappelle
Quoted 11 lines · Markos Chandras
From: Markos Chandras <[email protected]>
gcc hardcodes the uClibc interpreter for MIPS64/n32 as follows:
(gcc-4.7.3,gcc/config/mips/linux64.h):
defineUCLIBC_DYNAMIC_LINKERN32"/lib32/ld-uClibc.so.0"However, buildroot always creates the $(TARGET_DIR)/lib and $(TARGET_DIR)/usr/lib directories, therefore for consinstency reasons, we create a
lib32->libsymlink to fix the interpreter problems for MIPS64/n32.
Quoted 8 lines
Quoted 4 lines
I would say we do it for all 32-bit platforms. If people feel they can't
afford the overhead of two additional inodes in their rootfs, they can still remove the link in a post-build script.Is this preferred?
+ifeq ($(BR2_MIPS_NABI64)$(BR2_aarch64)$(BR2_sh64)$(BR2_x86_64),)
I was going to say:
ifeq ($(BR2_ARCH_IS_64),)
but only now I realise you're talking about n32 on a 64-bit MIPS. Though I must say, I don't understand why we call it BR2_ARCH_IS_64 if the ABI is 32 bit - or is it actually a 64-bit ABI that is just called n32 by accident?
I also noticed now that for lib64, we only create the symlinks if they
exists in the external toolchain, and we remove the lib64 directory in the internal toolchain. Perhaps this can be simplified into creating the lib64/lib32 links unconditionally after installing the toolchain?
Review
Quoted 2 lines
(quoted diff) +2
-0+ ln -sfn lib $(TARGET_DIR)/lib32; \ + ln -sfn lib $(TARGET_DIR)/usr/lib32;
No need for the semicolon and the backslash, this can be done as two
separate commands.
Regards,
Arnout
Quoted 7 lines
+endif
--
Regards,
Markos Chandras
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
PATCH 1/1 Makefile: Symlink lib32 to lib for MIPS64/n32
Quoted 7 lines · Arnout Vandecappelle
Quoted 3 lines · Markos Chandras
Is this preferred?
+ifeq ($(BR2_MIPS_NABI64)$(BR2_aarch64)$(BR2_sh64)$(BR2_x86_64),)
Quoted 7 lines
I was going to say:
ifeq ($(BR2_ARCH_IS_64),)
but only now I realise you're talking about n32 on a 64-bit MIPS. Though I must say, I don't understand why we call it
BR2_ARCH_IS_64if the ABI is 32 bit - or is it actually a 64-bit ABI that is just called n32 by accident?
n32 is a 64-bit ABI with 32-bit pointers (something like the new x32 for x86).
Quoted 5 lines
I also noticed now that for lib64, we only create the symlinks if they
exists in the external toolchain, and we remove the lib64 directory in the internal toolchain. Perhaps this can be simplified into creating the lib64/lib32 links unconditionally after installing the toolchain?
Whatever works best. I have no strong preference on this.
Quoted 9 lines
Review
Quoted 5 lines
(quoted diff) +2
-0+ ln -sfn lib $(TARGET_DIR)/lib32; \ + ln -sfn lib $(TARGET_DIR)/usr/lib32;No need for the semicolon and the backslash, this can be done as two
separate commands.
Ok I will fix that.
--
Regards,
Markos Chandras
PATCH 1/1 Makefile: Symlink lib32 to lib for MIPS64/n32
Quoted 10 lines · Markos Chandras
Quoted 9 lines · Arnout Vandecappelle
Quoted 3 lines · Markos Chandras
Is this preferred?
+ifeq ($(BR2_MIPS_NABI64)$(BR2_aarch64)$(BR2_sh64)$(BR2_x86_64),)
I was going to say:
Quoted 7 lines
Quoted 5 lines
ifeq ($(BR2_ARCH_IS_64),)
but only now I realise you're talking about n32 on a 64-bit MIPS. Though I must say, I don't understand why we call it
BR2_ARCH_IS_64if the ABI is 32 bit - or is it actually a 64-bit ABI that is just called n32 by accident?n32 is a 64-bit ABI with 32-bit pointers (something like the new x32 for x86).
Okay, so it's a 64-bit ABI that is called n32 by accident :-)
Since it's not clear if lib32 is needed for other architectures, and
since we don't always do it for the 64-bit architectures, it's probably better to keep your original condition on $(BR2_MIPS_NABI32).
Quoted 6 lines
Quoted 4 lines
I also noticed now that for lib64, we only create the symlinks if they
exists in the external toolchain, and we remove the lib64 directory in the internal toolchain. Perhaps this can be simplified into creating the lib64/lib32 links unconditionally after installing the toolchain?Whatever works best. I have no strong preference on this.
Probably it's best if your patch goes in as is, and it can be
refactored later.
Quoted 3 lines
Quoted 3 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ ln -sfn lib $(TARGET_DIR)/lib32; \ + ln -sfn lib $(TARGET_DIR)/usr/lib32;
By the way, shouldn't the same be done in STAGING_DIR?
Regards,
Arnout
Quoted 11 lines
Quoted 3 lines
No need for the semicolon and the backslash, this can be done as two
separate commands.Ok I will fix that.
--
Regards,
Markos Chandras
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
PATCH 1/1 Makefile: Symlink lib32 to lib for MIPS64/n32
Quoted 11 lines · Arnout Vandecappelle
Quoted 4 lines
n32 is a 64-bit ABI with 32-bit pointers (something like the new x32 for x86).
Okay, so it's a 64-bit ABI that is called n32 by accident :-)
Since it's not clear if lib32 is needed for other architectures, and since
we don't always do it for the 64-bit architectures, it's probably better to keep your original condition on $(BR2_MIPS_NABI32).
Ok :)
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ ln -sfn lib $(TARGET_DIR)/lib32; \ + ln -sfn lib $(TARGET_DIR)/usr/lib32;By the way, shouldn't the same be done in
STAGING_DIR?
I am not sure. The only problem I found was with the interpreter path during runtime.
I can't see why lib32->lib is needed for the STAGING_DIR. Everything in buildroot seems to depend
on lib and usr/lib and uClibc also uses MULTILIB_DIR="lib". I wouldn't touch the STAGING_DIR for
now until I hit a real problem.
--
Regards,
Markos Chandras