Gentoo Archives: gentoo-user

From: Maarten <gentoo@××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Problem building statically linked e2fsprogs
Date: Wed, 24 Sep 2008 20:38:37
Message-Id: 48DAA46B.2060009@ultratux.org
In Reply to: Re: [gentoo-user] Problem building statically linked e2fsprogs by Albert Hopkins
1 Albert Hopkins wrote:
2 > On Wed, 2008-09-24 at 21:39 +0200, Maarten wrote:
3 >> Hi List,
4 >>
5 > [...]
6 >> # Grep works fine...
7 >> maarten@thoughtpad ~ $ ldd /bin/grep
8 >> linux-gate.so.1 => (0xffffe000)
9 >> libc.so.6 => /lib/libc.so.6 (0xb7e42000)
10 >> /lib/ld-linux.so.2 (0xb7f96000)
11 >>
12 >> thoughtpad ~ # USE="static" emerge -v grep
13 >> [snip]
14 >>
15 >> maarten@thoughtpad ~ $ ldd /bin/grep
16 >> not a dynamic executable
17 >>
18 >> # But e2fsprogs doesn't...
19 >>
20 >> maarten@thoughtpad ~ $ ldd /sbin/e2fsck
21 >> linux-gate.so.1 => (0xffffe000)
22 >> libext2fs.so.2 => /lib/libext2fs.so.2 (0xb7ea1000)
23 >> libcom_err.so.2 => /lib/libcom_err.so.2 (0xb7e9d000)
24 >> libblkid.so.1 => /lib/libblkid.so.1 (0xb7e93000)
25 >> libuuid.so.1 => /lib/libuuid.so.1 (0xb7e8e000)
26 >> libe2p.so.2 => /lib/libe2p.so.2 (0xb7e87000)
27 >> libc.so.6 => /lib/libc.so.6 (0xb7d55000)
28 >> /lib/ld-linux.so.2 (0xb7ee8000)
29 >>
30 >> thoughtpad ~ # USE="static" emerge -v e2fsprogs
31 >> [ebuild R ] sys-fs/e2fsprogs-1.40.9 USE="nls static*" 0 kB
32 >> [snip]
33 >> Enabling ELF shared libraries
34 >> [snip]
35 >> checking whether linker accepts -static... yes
36 >> [snip]
37 >> >>> Completed installing e2fsprogs-1.40.9 into
38 >> /var/tmp/portage/sys-fs/e2fsprogs-1.40.9/image/
39 >>
40 >> # After that, no change, however...
41 >> maarten@thoughtpad ~ $ ldd /sbin/e2fsck
42 >> linux-gate.so.1 => (0xffffe000)
43 >> libext2fs.so.2 => /lib/libext2fs.so.2 (0xb7f7f000)
44 >> libcom_err.so.2 => /lib/libcom_err.so.2 (0xb7f7b000)
45 >> libblkid.so.1 => /lib/libblkid.so.1 (0xb7f71000)
46 >> libuuid.so.1 => /lib/libuuid.so.1 (0xb7f6c000)
47 >> libe2p.so.2 => /lib/libe2p.so.2 (0xb7f65000)
48 >> libc.so.6 => /lib/libc.so.6 (0xb7e33000)
49 >> /lib/ld-linux.so.2 (0xb7fc6000)
50 >>
51 > The grep package has a "static" USE flag. e2fsprogs does not. So
52 > enabling the static USE flag has no effect on e2fsprogs.
53
54 Ehm, how do you figure that? It surely displays the "static" USE flag:
55
56 thoughtpad ~ # emerge -pv e2fsprogs
57
58 These are the packages that would be merged, in order:
59
60 Calculating dependencies... done!
61 [ebuild R ] sys-fs/e2fsprogs-1.40.9 USE="nls -static" 0 kB
62
63 So I would assume at this point the package is broken in this respect.
64
65 > The easiest (easier?) thing to do would be to compile e2fsprogs
66 > statically by hand and copy over the resulting binary
67
68 Good idea... well, maybe...
69
70 > # tar zxvf /path/to/e2fsprogs-1.x.x.tar.gz
71 > # cd e2fsprogs-1.x.x
72 > # ./configure --enable-static
73 > # make
74 > # ldd e2fsck/e2fsck
75 > linux-gate.so.1 => (0xb8033000)
76 > libc.so.6 => /lib/libc.so.6 (0xb7edb000)
77 > /lib/ld-linux.so.2 (0xb8034000)
78
79 Ehm, exactly. So yes, it uses less libraries than before, but in no way
80 is this a real statically linked binary:
81
82 # ldd e2fsck/e2fsck
83 linux-gate.so.1 => (0xffffe000)
84 libc.so.6 => /lib/libc.so.6 (0xb7e32000)
85 /lib/ld-linux.so.2 (0xb7f86000)
86
87 # file e2fsck/e2fsck
88 e2fsck/e2fsck: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
89 for GNU/Linux 2.6.9, dynamically linked (uses shared libs), not stripped
90
91 However, since this might still perform much better, I tested it...
92 and indeed, it does the job (despite different glibc versions between
93 the build host and the bad server):
94
95 broken_server ~ # /sbin/e2fsck
96 e2fsck: error while loading shared libraries: libcom_err.so.2: cannot
97 handle TLS data
98
99 broken_server ~ # ./e2fsck
100 Usage: ./e2fsck [-panyrcdfvstDFSV] [-b superblock] [-B blocksize]
101 [-I inode_buffer_blocks] [-P process_inode_size]
102 [-l|-L bad_blocks_file] [-C fd] [-j external_journal]
103 [-E extended-options] device
104
105 Thank you,
106 Maarten

Replies

Subject Author
Re: [gentoo-user] Problem building statically linked e2fsprogs Albert Hopkins <marduk@×××××××××××.org>