diff mbox

[1/1] toolchain/helpers.mk: fix check-musl

Message ID 1417648439-10146-1-git-send-email-jkrause@posteo.de
State Superseded
Headers show

Commit Message

Jörg Krause Dec. 3, 2014, 11:13 p.m. UTC
check_musl works fine for the external musl 1.1.1 toolchain which is downloaded
and installed, but fails for a musl toolchain which, in a first step is build
by the internal toolchain backend of Buildroot, and in a second step is copied
to an external directory and imported as an custom external toolchain (in a new
configuration).

In case of the downloaded musl 1.1.1 toolchain the libc.so and libm.a files
reside in the sysroot/lib directory and sysroot/usr/lib is a symlink to
sysroot/lib.

In case of the custom musl toolchain build by Buildroot the files reside in
sysroot/usr/lib which is not a symlink.

To let check_musl detect the custom musl toolchain correctly test for libc.so
and lib.m in sysroot/usr/lib which works in both cases.

Signed-off-by: Jörg Krause <jkrause@posteo.de>
---
 toolchain/helpers.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Petazzoni Dec. 8, 2014, 7:32 p.m. UTC | #1
Dear Jörg Krause,

On Thu,  4 Dec 2014 00:13:59 +0100, Jörg Krause wrote:
> check_musl works fine for the external musl 1.1.1 toolchain which is downloaded
> and installed, but fails for a musl toolchain which, in a first step is build
> by the internal toolchain backend of Buildroot, and in a second step is copied
> to an external directory and imported as an custom external toolchain (in a new
> configuration).
> 
> In case of the downloaded musl 1.1.1 toolchain the libc.so and libm.a files
> reside in the sysroot/lib directory and sysroot/usr/lib is a symlink to
> sysroot/lib.
> 
> In case of the custom musl toolchain build by Buildroot the files reside in
> sysroot/usr/lib which is not a symlink.

Actually, I am not sure this is the best fix we could do. Having the C
library installed in /usr/lib in the sysroot is a bit weird, and I
believe we should rather fix the Buildroot musl package to ensure that
the C library gets installed in /lib instead.

Do you want to have a look into this?

Thanks!

Thomas
Jörg Krause Dec. 8, 2014, 9:17 p.m. UTC | #2
On Mo, 2014-12-08 at 20:32 +0100, Thomas Petazzoni wrote:
> Dear Jörg Krause,
> 
> On Thu,  4 Dec 2014 00:13:59 +0100, Jörg Krause wrote:
> > check_musl works fine for the external musl 1.1.1 toolchain which is downloaded
> > and installed, but fails for a musl toolchain which, in a first step is build
> > by the internal toolchain backend of Buildroot, and in a second step is copied
> > to an external directory and imported as an custom external toolchain (in a new
> > configuration).
> > 
> > In case of the downloaded musl 1.1.1 toolchain the libc.so and libm.a files
> > reside in the sysroot/lib directory and sysroot/usr/lib is a symlink to
> > sysroot/lib.
> > 
> > In case of the custom musl toolchain build by Buildroot the files reside in
> > sysroot/usr/lib which is not a symlink.
> 
> Actually, I am not sure this is the best fix we could do. Having the C
> library installed in /usr/lib in the sysroot is a bit weird, and I
> believe we should rather fix the Buildroot musl package to ensure that
> the C library gets installed in /lib instead.
> 
> Do you want to have a look into this?

I'm not a toolchain expert, but I will have a look at it.
Thomas Petazzoni Dec. 8, 2014, 9:21 p.m. UTC | #3
Dear Jörg Krause,

On Mon, 08 Dec 2014 22:17:03 +0100, Jörg Krause wrote:

> > Do you want to have a look into this?
> 
> I'm not a toolchain expert, but I will have a look at it.

It might either be that we need --prefix=/ in musl.mk, or maybe
--prefix=/usr --libdir=/lib or something like that.

Best regards,

Thomas
Jörg Krause Dec. 9, 2014, 1:22 a.m. UTC | #4
On Mo, 2014-12-08 at 22:21 +0100, Thomas Petazzoni wrote:
> Dear Jörg Krause,
> 
> On Mon, 08 Dec 2014 22:17:03 +0100, Jörg Krause wrote:
> 
> > > Do you want to have a look into this?
> > 
> > I'm not a toolchain expert, but I will have a look at it.
> 
> It might either be that we need --prefix=/ in musl.mk, or maybe
> --prefix=/usr --libdir=/lib or something like that.

--libdir=/lib does the trick. Many thanks! I will prepare a patch soon.
diff mbox

Patch

diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 3121da4..425a448 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -229,7 +229,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}/usr/lib/libc.so -o -e $${SYSROOT_DIR}/usr/lib/libm.so ; then \
 		echo "Incorrect selection of the C library" ; \
 		exit -1; \
 	fi