Gentoo Archives: gentoo-alt

From: Anders Bo Rasmussen <abr@×××××××.com>
To: gentoo-alt@l.g.o
Subject: [gentoo-alt] prefix: gcc is loading system includes
Date: Fri, 18 Jul 2014 12:46:49
Message-Id: CANCygR4x0R+30niFORt6e4sqjP3a713pkYGKHb1gUFpKmNxYEw@mail.gmail.com
1 Hi Again.
2
3 I've made a test (taken from Linux From Scratch):
4
5 $echo 'main(){}' > dummy.c
6 $gcc dummy.c -v -Wl,--verbose &> dummy.log
7
8 And dumy.c contains among other things:
9
10 #include "..." search starts here:
11 #include <...> search starts here:
12 /usr/local/nangate/tools/gentoo-prefix-test/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/include
13 /usr/local/nangate/tools/gentoo-prefix-test/usr/include
14 /usr/local/nangate/tools/gentoo-prefix-test/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/include-fixed
15 /usr/include
16 End of search list.
17
18
19 and:
20
21 SEARCH_DIR("/usr/local/nangate/tools/gentoo-prefix-test/usr/x86_64-pc-linux-gnu/lib64");
22 SEARCH_DIR("/usr/local/nangate/tools/gentoo-prefix-test/usr/lib/binutils/x86_64-pc-linux-gnu/2.2464");
23 SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64");
24 SEARCH_DIR("/usr/lib64");
25 SEARCH_DIR("/usr/local/nangate/tools/gentoo-prefix-test/usr/x86_64-pc-linux-gnu/lib");
26 SEARCH_DIR("/usr/local/nangate/tools/gentoo-prefix-test/usr/lib/binutils/x86_64-pc-linux-gnu/2.24");
27 SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib");
28 SEARCH_DIR("/usr/lib");
29
30 That worries me some as it means that when we compile our software it
31 might mean that something is comming from outside of the Gentoo Prefix
32 installation as it contains paths such as /usr/include and /lib64
33 which is outside Gentoo Prefix.
34
35 Is there a good way to avoid this?
36
37
38 I've checked on gvim how much comes from outside in my installation of
39 Gentoo Prefix:
40
41 $ldd /usr/local/nangate/tools/gentoo-prefix-test/usr/bin/gvim | wc -l
42 53
43 $ldd /usr/local/nangate/tools/gentoo-prefix-test/usr/bin/gvim | grep
44 -v gentoo-prefix-test
45 linux-vdso.so.1 => (0x00007fffda1fd000)
46 libm.so.6 => /lib64/libm.so.6 (0x0000003c6b600000)
47 libdl.so.2 => /lib64/libdl.so.2 (0x0000003c6be00000)
48 libc.so.6 => /lib64/libc.so.6 (0x0000003c6b200000)
49 librt.so.1 => /lib64/librt.so.1 (0x0000003c6c600000)
50 libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003c6c200000)
51 /lib64/ld-linux-x86-64.so.2 (0x0000003c6ae00000)
52 libnsl.so.1 => /lib64/libnsl.so.1 (0x0000003c73800000)
53 libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000003c7d800000)
54 libutil.so.1 => /lib64/libutil.so.1 (0x0000003c79400000)
55 libresolv.so.2 => /lib64/libresolv.so.2 (0x0000003c75800000)
56
57
58 So a little comes from outside, but I guess I can assume that is
59 available on any Linux distribution.
60
61 Regards
62 Anders Bo Rasmussen

Replies

Subject Author
Re: [gentoo-alt] prefix: gcc is loading system includes Fabian Groffen <grobian@g.o>