From eae494db4066172a28ba750d0de4b00ce6f8b802 Mon Sep 17 00:00:00 2001 From: Frank Hunleth Date: Tue, 21 Jun 2016 13:08:17 -0400 Subject: [PATCH] toolchain: allow crosstool-ng musl toolchains Currently, if using a crosstool-ng-generated external musl toolchain, Buildroot exits with "Incorrect selection of the C library". The musl.codu.org cross-compilers put their libraries in /lib while crosstool-ng uses /usr/lib. This change checks that location for libc.so and updates the ld-musl-$ARCH.so.1 symlink. Signed-off-by: Frank Hunleth --- toolchain/helpers.mk | 2 +- toolchain/toolchain-external/toolchain-external.mk | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk index 3991bc1..72d11c7 100644 --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -210,7 +210,7 @@ check_glibc = \ # $1: sysroot directory check_musl = \ SYSROOT_DIR="$(strip $1)"; \ - if test ! -f $${SYSROOT_DIR}/lib/libc.so -o -e $${SYSROOT_DIR}/lib/libm.so ; then \ + if test ! \( -f $${SYSROOT_DIR}/lib/libc.so -o -f $${SYSROOT_DIR}/usr/lib/libc.so \) -o -e $${SYSROOT_DIR}/lib/libm.so ; then \ echo "Incorrect selection of the C library" ; \ exit -1; \ fi diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk index b7a36be..26ca563 100644 --- a/toolchain/toolchain-external/toolchain-external.mk +++ b/toolchain/toolchain-external/toolchain-external.mk @@ -544,7 +544,11 @@ else MUSL_ARCH = $(ARCH) endif define TOOLCHAIN_EXTERNAL_MUSL_LD_LINK - ln -sf libc.so $(TARGET_DIR)/lib/ld-musl-$(MUSL_ARCH).so.1 + if [ -e $(TARGET_DIR)/usr/lib/libc.so ]; then \ + ln -sf ../usr/lib/libc.so $(TARGET_DIR)/lib/ld-musl-$(MUSL_ARCH).so.1 ; \ + else \ + ln -sf libc.so $(TARGET_DIR)/lib/ld-musl-$(MUSL_ARCH).so.1 ; \ + fi endef TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_MUSL_LD_LINK endif -- 2.7.4