Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20131023141307.GB20515@brightrain.aerifal.cx>
Date: Wed, 23 Oct 2013 10:13:07 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Cc: CLFS development discussion <clfs-dev@...ts.cross-lfs.org>,
	CLFS Support <clfs-support@...ts.cross-lfs.org>,
	Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
	Gregor Richards <gr@...due.edu>
Subject: Re: Re: [Clfs-dev] CLFS embedded book switches to musl-libc

On Wed, Oct 23, 2013 at 07:07:24AM -0400, Andrew Bradford wrote:
> On 10/22/13 17:08, Rich Felker wrote:
> > On Tue, Oct 22, 2013 at 02:58:24PM -0400, Kevyn-Alexandre Paré wrote:
> >> For the musl installation [2], the make install have an error that
> >> seem to be fix with the next command you propose:
> >>
> >> ../tools/install.sh -D -m 644 lib/crt1.o
> >> /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/lib/crt1.o
> >> ../tools/install.sh -D -m 644 lib/Scrt1.o
> >> /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/lib/Scrt1.o
> >> ../tools/install.sh -D -m 644 lib/crti.o
> >> /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/lib/crti.o
> >> ../tools/install.sh -D -m 644 lib/crtn.o
> >> /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/lib/crtn.o
> >> ../tools/install.sh -D -m 644 lib/libc.a
> >> /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/lib/libc.a
> >> ../tools/install.sh -D -m 755 lib/libc.so
> >> /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/lib/libc.so
> >> ../tools/install.sh -D -m 644 lib/libm.a
> >> /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/lib/libm.a
> >> ../tools/install.sh -D -m 644 lib/librt.a
> >> /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/lib/librt.a
> >> ../tools/install.sh -D -m 644 lib/libpthread.a
> >> /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/lib/libpthread.a
> >> ../tools/install.sh -D -m 644 lib/libcrypt.a
> >> /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/lib/libcrypt.a
> >> ../tools/install.sh -D -m 644 lib/libutil.a
> >> /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/lib/libutil.a
> >> ../tools/install.sh -D -m 644 lib/libxnet.a
> >> /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/lib/libxnet.a
> >> ../tools/install.sh -D -m 644 lib/libresolv.a
> >> /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/lib/libresolv.a
> >> ../tools/install.sh -D -m 644 lib/libdl.a
> >> /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/lib/libdl.a
> >> ../tools/install.sh -D -l
> >> /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/lib/libc.so
> >> /lib/ld-musl-arm.so.1 || true
> >> ln: failed to create symbolic link `/lib/ld-musl-arm.so.1.tmp.47054':
> >> Permission denied
> >> ../tools/install.sh -D -m 644 arch/arm/bits/alltypes.h
> >> /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/include/bits/alltypes.h
> > 
> > This (attempting to install the dynamic linker symlink in /lib) is
> > caused by specifying the installation location
> > /mnt/clfs/cross-tools/armv7a-unknown-linux-musleabi/ as part of the
> > prefix rather than as the DESTDIR at "make install" time. If this is
> > part of the installation into the new filesystem root that will be
> > later used as chroot or the root for booting, DESTDIR is the proper
> > approach. If this is just a temporary musl build for use in
> > bootstrapping, the current --prefix is fine, but you also need either
> > --syslibdir or --disable-shared.
> 
> Yes, I had run into this issue as well.  I had just missed that
> permission denied failure in haste and thus my brute force symlink.

The failure is ignored during make install precisely because
successful installation of this symlink is not needed for development,
only for running dynamic-linked binaries on the host system (natively,
or with qemu app-level emulation, for example). If you're
cross-compiling, it's generally not needed, but it will be needed on
the final system you're running on, which means the DESTDIR approach
is probably the one you want.

> The goal is to build a cross toolchain which is stand alone but from
> which the libs are copied into the actual target which will boot.  This
> is roughly what buildroot does when using an external toolchain (I believe).
> 
> In this case, using --disable-shared does not seem reasonable as I'd
> like to have shared libs.  I'll take a look at --syslibdir and DESTDIR
> and see if they accomplish what I think I want.  The symlink from ld to
> libc.so was my quick work around and produces a system which boots and
> runs fine as far as I can tell but which now seems as though it may not
> be the best method (besides my symlink command not covering all cases
> for the archs used in the CLFS book or supported by musl).

I think DESTDIR is what you want conceptually, but it only matters for
your usage case if you'll be using the musl-gcc wrapper. If so, you
need to leave --syslibdir matching the location the dynamic linker
will be found at on the final target system (should be /lib), or
you'll end up with binaries whose PT_INTERP headers reference a
pathname from the system you built on which no longer exist at
runtime.

Hope this makes sense.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.