Gentoo Archives: gentoo-dev

From: "Anthony G. Basile" <blueness@g.o>
To: Gentoo Development <gentoo-dev@l.g.o>
Subject: [gentoo-dev] RFC: News item about musl upgrade
Date: Tue, 21 Oct 2014 21:13:04
Message-Id: 5446CCA1.9070405@gentoo.org
1 Hi everyone,
2
3 musl is an experimental new standard C library. Its actively being
4 developed by Rich Felker (dalias) and I've got it working in Gentoo for
5 amd64, i686, armv7a and mipsel3. The amd64 and armv7a stages even have
6 userland hardening.
7
8 musl only recently got Native Language Support (nls), ie gettext() and
9 friends. In previous gentoo-musl stage3's, I was using
10 sys-devel/gettext to provide nls via libintl.so. But now musl provides
11 it as glibc does. I recently migrated the ebuilds and stages to nls
12 support via musl. I recommend starting with new stages, but users that
13 want to upgrade their systems are going to have to do extra steps. This
14 news item describes those extra steps.
15
16
17 Title: Upgrading to musl 1.1.5
18 Author: Anthony G. Basile <blueness@g.o>
19 Content-Type: text/plain
20 Posted: 2014-10-20
21 Revision: 1
22 News-Item-Format: 1.0
23 Display-If-Installed: sys-libs/musl
24
25 Versions 1.1.4 and above of musl provides Native Language Support (nls). Up
26 till now, Gentoo musl stages have used GNU gettext to provide nls via
27 libintl.so
28 and linked applications against it. Beginning with musl-1.1.5 we are
29 switching
30 to nls provided by musl. Since musl is experimental, you are better off
31 starting
32 with a new stage3 dated later than 2014-10-20. However, if you wish to
33 upgrade
34 an existing system, you can proceed as follows:
35
36 1. Remove any references to -lintl from /etc/portage/package.env and
37 /etc/portage/env/*. If you did not modify these from the original stage3
38 then you can just do `rm -rf /etc/portage/package.env /etc/portage/env`
39
40 2. Update your system, except for musl:
41
42 emerge --exclude musl -uvNDq world
43
44 3. Remove the libintl header belonging to gettext:
45
46 rm -f /usr/include/libintl.h
47
48 4. Now you can update musl without a file collision:
49
50 emerge -1q =sys-libs/musl-1.1.5
51
52 5. We need to turn USE=nls off in gettext:
53
54 echo "=sys-devel/gettext-0.19.3 ~amd64" >>
55 /etc/portage/package.accept_keywords
56 echo "sys-devel/gettext -nls" >> /etc/portage/package.use
57 emerge -1 gettext
58
59 Replace ~amd64 with your arch.
60
61 6. Rebuild any packages that might be linking against libintl.so:
62
63 USE=-nls emerge -uvDNq world
64
65 7. The previous step probably missed some executables, so find them all:
66
67 for i in /bin/* /sbin/ /usr/bin/* /usr/sbin/* ; do
68 readelf -d $i 2>&1 | grep -q libintl.so && echo $i
69 done
70
71 You can identify what packages these belong to uing `equery b <exe>`
72 Rebuild
73 those packages.
74
75 8. At this point you can remove /usr/lib/libintl.so*. To be safe, check
76 that
77 all your coreutils utilities (like mv, cp, ls, etc.) really aren't linking
78 against libintl.so as described in the previous step and then mv that
79 library
80 out of the dynamic linker's search path.
81
82 9. While not strictly necessary, you can rebuild your entire system to make
83 sure everything links nicely against the new libc.so: emerge -evq world
84
85 --
86 Anthony G. Basile, Ph.D.
87 Gentoo Linux Developer [Hardened]
88 E-Mail : blueness@g.o
89 GnuPG FP : 1FED FAD9 D82C 52A5 3BAB DC79 9384 FA6E F52D 4BBA
90 GnuPG ID : F52D4BBA