Gentoo Archives: gentoo-releng

From: Joshua Kinard <kumba@g.o>
To: gentoo-releng@l.g.o, Gentoo Toolchain <toolchain@g.o>
Subject: Re: [gentoo-releng] Uclibc chroots and catalyst
Date: Mon, 14 Dec 2015 12:02:01
Message-Id: 566EAFAC.4040000@gentoo.org
In Reply to: Re: [gentoo-releng] Uclibc chroots and catalyst by "Anthony G. Basile"
1 On 12/14/2015 02:25, Anthony G. Basile wrote:
2 >
3 > because mips is ~arch we are always building the cutting edge which is
4 > going to get you into trouble. without knowing what's cauing the seg
5 > fault, its hard to proceed. you can `strace chroot /path <cmd>` but
6 > this may bog down in some heavy debugging. i'd just start with the
7 > original stage, keep updates back by masking in /etc/portage and
8 > emerging that way. take a look in the releng git repo I have some
9 > scripts for automating stage1-2-3 with a customized /etc/portage
10 > directory. putting stuff in /etc/portage for our stage's is evil, but
11 > its sometimes a necessary evil. (vapier opened a bug about it.)
12
13 I've already run strace, both from outside the alt $ROOT and from inside. It
14 crashes two particular ioctl() calls, as far as I can tell, so that doesn't
15 tell me anything useful. I also don't think it's tied to any particular
16 version of a package, because everything inside the seed stage works fine. The
17 problem is only exposing itself when using 'emerge' to install to an alternate
18 $ROOT.
19
20 I did run into a hiccup where, when updating my seed root, something got merged
21 out-of-order and binutils/gcc both broke, so I had to do some temporary
22 kludgery to get them working again, then recompiled uclibc, and that problem
23 went away.
24
25 That said, I just did some experimenting and ran 'ldd' from inside the chroot
26 against bin/bash to see what libs bash is trying to load:
27
28 octane stage1root # chroot . usr/bin/ldd bin/bash
29 libreadline.so.6 => /lib/libreadline.so.6 (0x77580000)
30 libhistory.so.6 => /lib/libhistory.so.6 (0x77560000)
31 libncurses.so.5 => /lib/libncurses.so.5 (0x774f0000)
32 libiconv.so.2 => /lib/libiconv.so.2 (0x773e0000)
33 libc.so.0 => /lib/libc.so.0 (0x77370000)
34 ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x77630000)
35
36 Going by that, I moved the actual libs being pointed at to a temp folder and
37 copied the corresponding libs from my seed root in, ran "chroot . bin/bash",
38 and got a working shell. So I know the problem *definitely* involves the way
39 the libraries are being linked to bash.
40
41 Next I swapped the libs back around again, and started replacing them
42 one-by-one, running "chroot . bin/bash" each time. I got a working shell in
43 every instance *except* when I didn't swap libncurses.so.5.9 with the seed
44 $ROOT copy. This correlates with other binaries linked again libncurses also
45 segfaulting.
46
47 So I think there's several potential issues here:
48
49 1. emerge isn't setting the compile environment up correctly so that
50 gcc/binutils are linking against libraries in the alt $ROOT instead of in the
51 seed $ROOT and only ncurses has issues with this.
52
53 2. uclibc's dynamic loader isn't as forgiving or flexible as glibc's in working
54 around whatever discrepancy exists in loading libncurses.so.5.9 (because all
55 things considered, the libncurses.so.5.9 in the seed $ROOT should be the
56 virtually same as in alt $ROOT).
57
58 3. There's a bug in the toolchain that only appears when under uclibc and using
59 an alt $ROOT, and only when compiling ncurses.
60
61 4. There's a bug in ncurses itself that only appears under uclibc (and/or alt
62 $ROOT).
63
64 5. I am using -mplt in my CFLAGS, and that might also be involved (going to
65 test this next).
66
67 6. Some other unidentified issue.
68
69
70 CC'ing toolchain in case they have any ideas. I'll hold off on opening a bug
71 up until the actual problem is pinned down.
72
73
74 --
75 Joshua Kinard
76 Gentoo/MIPS
77 kumba@g.o
78 6144R/F5C6C943 2015-04-27
79 177C 1972 1FB8 F254 BAD0 3E72 5C63 F4E3 F5C6 C943
80
81 "The past tempts us, the present confuses us, the future frightens us. And our
82 lives slip away, moment by moment, lost in that vast, terrible in-between."
83
84 --Emperor Turhan, Centauri Republic