mailing list of musl libc
 help / color / mirror / code / Atom feed
* ld-musl-i386.so.1 disappear after gcc install
@ 2017-02-13  2:26 Romain
  2017-02-13  3:26 ` Rich Felker
  0 siblings, 1 reply; 3+ messages in thread
From: Romain @ 2017-02-13  2:26 UTC (permalink / raw)
  To: musl

Hello,

I try to create  a script to cross-build a small linux based on musl.
(https://github.com/rom1nux/zydux-forge)

Basically I first create my cross toolchain in 3 steps

1 – Build static gcc (first pass)
2 – Build musl
3 – Build dynamic gcc (second pass)

When I build musl, I can find the loader ld-musl-i386.so.1 this is a link to
/lib/libc.so
But when I do the second pass of gcc the ld-musl-i386.so.1 is removed at the
gcc “make install”

I create a watch with “audit” to see what process remove the file, and it
seem that /sbin/ldconfig.real remove the loader, I don’t understand why.
(I fix this by creating my own link, and I can start my target, but I don’t
understand what append)

My host :
Ubuntu 16.04
Arch : x86_64
Kernel : 4.4.0
Gcc : 5.4 (x86_64-linux-gnu-gcc)

My Cross/Target :
Arch : x86
Kernel : 4.9.7
Gcc : 6.3.0 (i486-linux-musl-gcc)
Musl : 1.1.16

Can you help  me to understand why the linker ld-musl-i386.so.1 is removed
by /sbin/ldconfig.real, and how to avoid this ?

Thanks in advance

Rom1nux
PS : Sorry for my bad English language






^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ld-musl-i386.so.1 disappear after gcc install
  2017-02-13  2:26 ld-musl-i386.so.1 disappear after gcc install Romain
@ 2017-02-13  3:26 ` Rich Felker
  2017-02-14 12:19   ` Romain
  0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2017-02-13  3:26 UTC (permalink / raw)
  To: musl

On Mon, Feb 13, 2017 at 03:26:07AM +0100, Romain wrote:
> Hello,
> 
> I try to create  a script to cross-build a small linux based on musl.
> (https://github.com/rom1nux/zydux-forge)
> 
> Basically I first create my cross toolchain in 3 steps
> 
> 1 – Build static gcc (first pass)
> 2 – Build musl
> 3 – Build dynamic gcc (second pass)
> 
> When I build musl, I can find the loader ld-musl-i386.so.1 this is a link to
> /lib/libc.so
> But when I do the second pass of gcc the ld-musl-i386.so.1 is removed at the
> gcc “make install”
> 
> I create a watch with “audit” to see what process remove the file, and it
> seem that /sbin/ldconfig.real remove the loader, I don’t understand why.
> (I fix this by creating my own link, and I can start my target, but I don’t
> understand what append)
> 
> My host :
> Ubuntu 16.04
> Arch : x86_64
> Kernel : 4.4.0
> Gcc : 5.4 (x86_64-linux-gnu-gcc)
> 
> My Cross/Target :
> Arch : x86
> Kernel : 4.9.7
> Gcc : 6.3.0 (i486-linux-musl-gcc)
> Musl : 1.1.16
> 
> Can you help  me to understand why the linker ld-musl-i386.so.1 is removed
> by /sbin/ldconfig.real, and how to avoid this ?

Where did ldconfig.real come from? If it's part of the Ubuntu system
you're compiling from, it shouldn't be getting run on the cross-target
at all; my guess would be that something in your build process is
unaware that you're cross-compiling. If it's part of the target musl
system then it should not even exist; ldconfig is a glibc thing.

Rich


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: ld-musl-i386.so.1 disappear after gcc install
  2017-02-13  3:26 ` Rich Felker
@ 2017-02-14 12:19   ` Romain
  0 siblings, 0 replies; 3+ messages in thread
From: Romain @ 2017-02-14 12:19 UTC (permalink / raw)
  To: musl

Hello Rich and All,

Thanks for reply

> Where did ldconfig.real come from? If it's part of the Ubuntu system
you're compiling from 
Yes this is part of the Ubuntu system .

> it shouldn't be getting run on the cross-target at all;
I probably did not understand well, but in my head the second pass of GCC is
done by the host compiler (--host and --build are x86_64-linux-gnu-gcc in my
case) so the libc of host compiler "is running"

> my guess would be that something in your build process is unaware that
you're cross-compiling. 
Yes I think I miss something in the cross compiler builing concept

> If it's part of the target musl system then it should not even exist;
ldconfig is a glibc thing.
I put here the simple step of my toolchain building, if you see an obvious
mistake, let me know

1 - PACKAGES

host                 : x86_64-linux-gnu
target               : i486-zydux-linux-musl
arch                 : x86
kernel               : 4.9.7
binutils             : 2.27
gcc                  : 6.3.0
musl                 : 1.1.16

2 - PREPARE

$ export PATH=/home/romain/toolchain/bin:$PATH

3- KERNEL HEADER

$ make ARCH=x86
INSTALL_HDR_PATH=/home/romain/toolchain/i486-zydux-linux-musl/usr
headers_install

2 - BINUTILS

$ cd /home/romain/builds/build-binutils
$ /home/romain/sources/binutils-2.27/configure 
 --target=i486-zydux-linux-musl 
 --prefix=/home/romain/toolchain 
 --with-sysroot=/home/romain/toolchain/i486-zydux-linux-musl 
 --disable-nls 
 --disable-multilib 
$ make configure-host
$ make -j6
$ make install

2 - GCC (1)

$ cd /home/romain/builds/build-gcc1
$ /home/romain/sources/gcc-6.3.0/configure 
 --build=x86_64-linux-gnu 
 --host=x86_64-linux-gnu 
 --target=i486-zydux-linux-musl 
 --prefix=/home/romain/toolchain 
 --with-sysroot=/home/romain/toolchain/i486-zydux-linux-musl 
 --disable-nls 
 --disable-shared 
 --without-headers 
 --with-newlib 
 --disable-decimal-float 
 --disable-libgomp 
 --disable-libmudflap 
 --disable-libssp 
 --disable-libatomic 
 --disable-libquadmath 
 --disable-threads 
 --disable-multilib 
 --enable-languages=c 
 --disable-bootstrap 
$ make -j6 all-gcc 
$ make -j6 all-target-libgcc
$ make -j6 install-gcc
$ make -j6 install-target-libgcc 

3 - MUSL

$ export CC=i486-zydux-linux-musl-gcc
$ cd /home/romain/sources/musl-1.1.16
$ ./configure 
 --target=i486-zydux-linux-musl 
 --prefix=/
$ make -j6
$ export DESTDIR=/home/romain/toolchain/i486-zydux-linux-musl
$ make install

4 - GCC (2)

$ cd /home/romain/builds/build-gcc2
$ /home/romain/sources/gcc-6.3.0/configure 
 --build=x86_64-linux-gnu
 --host=x86_64-linux-gnu
 --target=i486-zydux-linux-musl
 --prefix=/home/romain/toolchain
 --with-sysroot=/home/romain/toolchain/i486-zydux-linux-musl
 --disable-nls 
 --enable-c99 
 --enable-long-long 
 --disable-multilib 
 --disable-libmudflap 
 --disable-libmpx 
 --enable-languages=c 
 --disable-bootstrap
$ make -j6
$ make -j6 install

5 - QUICK CHECK

$ i486-zydux-linux-musl-gcc -v
gcc version 6.3.0
$ i486-zydux-linux-musl-gcc dummy.c -o dummy
$ export LD_LIBRARY_PATH=/home/romain/toolchain/i486-zydux-linux-musl/lib:
$ ldd dummy 
   linux-gate.so.1 =>  (0xf775c000)
   libc.so => /home/romain/toolchain/i486-zydux-linux-musl/lib/libc.so
(0xf76d0000)


Thanks in advance
(I hope I don't pollute this list with my newbie problem, let me know)

Romain

On Mon, Feb 13, 2017 at 03:26:07AM +0100, Romain wrote:
>> Hello,
>> 
>> I try to create  a script to cross-build a small linux based on musl.
>> (https://github.com/rom1nux/zydux-forge)
>> 
>> Basically I first create my cross toolchain in 3 steps
>> 
>> 1 - Build static gcc (first pass)
>> 2 - Build musl
>> 3 - Build dynamic gcc (second pass)
>> 
>> When I build musl, I can find the loader ld-musl-i386.so.1 this is a 
>> link to /lib/libc.so But when I do the second pass of gcc the 
>> ld-musl-i386.so.1 is removed at the gcc "make install"
>> 
>> I create a watch with "audit" to see what process remove the file, and 
>> it seem that /sbin/ldconfig.real remove the loader, I don't understand
why.
>> (I fix this by creating my own link, and I can start my target, but I 
>> don't understand what append)
>> 
>> My host :
>> Ubuntu 16.04
>> Arch : x86_64
>> Kernel : 4.4.0
>> Gcc : 5.4 (x86_64-linux-gnu-gcc)
>> 
>> My Cross/Target :
>> Arch : x86
>> Kernel : 4.9.7
>> Gcc : 6.3.0 (i486-linux-musl-gcc)
>> Musl : 1.1.16
>> 
>> Can you help  me to understand why the linker ld-musl-i386.so.1 is 
>> removed by /sbin/ldconfig.real, and how to avoid this ?



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-14 12:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-13  2:26 ld-musl-i386.so.1 disappear after gcc install Romain
2017-02-13  3:26 ` Rich Felker
2017-02-14 12:19   ` Romain

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).