1 |
On 02/10/11 01:57, Perry Smith wrote: |
2 |
>> On 02/09/11 17:47, Perry Smith wrote: |
3 |
>>> Lets start over. I don't think I'm making any progress but I'll give it one last go. |
4 |
>>> ***Import File Strings*** |
5 |
>>> INDEX PATH BASE MEMBER |
6 |
>>> 0 /usr/local/rvm/rubies/ruby-1.9.1-p378/lib:/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.3.1:/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.3.1/../../..:/usr/lib:/lib |
7 |
>>> 1 librtl.a shr.o |
8 |
>>> 2 /usr/lib libc.a shr.o |
9 |
>>> 3 /usr/lib libpthread.a shr_comm.o |
10 |
>>> 4 /usr/lib libpthread.a shr_xpg5.o |
11 |
>>> 5 /usr/local/rvm/rubies/ruby-1.9.1-p378/lib libruby.so |
12 |
>> Is this with our without your intervention in ruby's build process and/or toolchain setup? |
13 |
> |
14 |
> This is after my toolchain changes. |
15 |
|
16 |
How does this look like without your changes? |
17 |
|
18 |
> The 1st entry is what I was calling "relative" but as you point out, that isn't the right term. |
19 |
> "affected by run path search" is too long for me. :-) |
20 |
> |
21 |
> The 2nd through 5th items are those I was calling "absolute" but really they should be |
22 |
> called "not affected by run path search". Perhaps "fixed" in this case would work? |
23 |
> non-LIBPATH-able? |
24 |
|
25 |
IIRC, "hardcoded" is what libtool uses for that kind of paths, |
26 |
but I'm fine with "fixed" too. |
27 |
|
28 |
>> How exactly did you touch either the build process or the toolchain setup to "allow" that? |
29 |
> |
30 |
> I put my ld in /usr/local/aixbin/ld and I put /usr/local/aixbin as the first element of PATH. |
31 |
> So my ld gets called instead of the real ld. My ld monkeys with things. |
32 |
|
33 |
Which compiler did you use - gcc or xlc? |
34 |
Does xlc search for 'ld' using PATH? |
35 |
Usually, gcc does not, you'll have to configure it to use "/usr/local/aixbin/ld". |
36 |
|
37 |
>>> Lets pause here and see if we can come to an agreement on these two items. |
38 |
>>> 1) objets have only absolute paths after they are installed |
39 |
>> |
40 |
>> Still not clear to me: |
41 |
>> Do you actually /prefer/ hardcoded paths (without runpath search)? Why? |
42 |
>> |
43 |
>> Although runpath search is affected by LIBPATH, I'm just fine with that. |
44 |
>> This is the outcome of using "-L" and "-l" linker flags together. |
45 |
> |
46 |
> I thought this was one of your objectives based on the fact that java sets LIBPATH |
47 |
> to something weird and it breaks everything. |
48 |
|
49 |
Nope. The problem with LIBPATH set by java was that there is nothing |
50 |
like "soname". Iff my binary had searched for the /file/ "libiconv.so.2" |
51 |
(either archive or not) instead of "libiconv.a(libiconv.so.2)", even with |
52 |
LIBPATH set to "/usr/lib" it would not have found "/usr/lib/libiconv.a" |
53 |
(without "libiconv.so.2" member), but continued along LIBPATH + runpath |
54 |
until it found the "libiconv.so.2" file in its usual place. |
55 |
|
56 |
>> Seems we have to agree on some terms to be used first. |
57 |
> |
58 |
> Yes. |
59 |
> |
60 |
> I like "fixed" for entries not affected by runtime search. |
61 |
|
62 |
"fixed" = "hardcoded" (see above). |
63 |
|
64 |
> The other tact would be to note that PATH is either empty or not. |
65 |
> |
66 |
> "A path dependency with no path" or "a dependency with a path" ? |
67 |
|
68 |
Which "PATH" ("path") do you refer to here that can be either empty or not? |
69 |
There is the "PATH" environment variable, which does not affect runpath search at all. |
70 |
There is the "LIBPATH" environment variable, which does. |
71 |
There is the encoded "hardcoded path" (="fixed") for one library, not allowing runpath search. |
72 |
There is the encoded "runpath", used (after LIBPATH) for any library without a "hardcoded path". |
73 |
|
74 |
> "binary" instead of "object" sounds better to me. |
75 |
|
76 |
ok. |
77 |
|
78 |
>> What else to say: |
79 |
>> When libtool knows for a platform that linking libraries results in hardcoded |
80 |
>> paths, or there is no such thing like LIBPATH environment variable to temporarily |
81 |
>> override the runpath, it actually /does/ "relink" the binaries during installation. |
82 |
> |
83 |
> I understood that part -- but |
84 |
> |
85 |
>> OTOH, when the /absolute/path/to/the/library.so found at linktime is hardcoded into |
86 |
>> the resulting binary, installing into DESTDIR is broken - which is a prerequisite |
87 |
>> for package managers like portage to work properly. |
88 |
> |
89 |
> Didn't understand this part. In particular, from the comma to the end ", installing ..." |
90 |
|
91 |
Ohw, ok - this is the core requirement for proper package managing: |
92 |
|
93 |
Consider these raw build steps for an usual package, which does provide |
94 |
"${prefix}/lib/library.so", and "${prefix}/bin/mybinary" linked against it: |
95 |
|
96 |
1. Configure: |
97 |
$ ./configure --prefix="/final" |
98 |
2. Compile: |
99 |
$ make |
100 |
3. Install (to allow for a binary package): |
101 |
$ make install DESTDIR="/image" |
102 |
The important thing here is to /not/ copy anything to "/final" at the |
103 |
build machine, but still the binaries copied to "/image/final" have |
104 |
to be able to run when moved to "/final" by the package manager, |
105 |
eventually on another machine with (ideally) identical setup. |
106 |
4. Create the binary package: |
107 |
$ cd "/image" |
108 |
$ find "final" > "filelist-this-package-does-install" |
109 |
$ tar cfj "binpackage.tar.bz2" "filelist-this-package-does-install" "final" |
110 |
5. optionally ship the binary package to another host with (ideally) identical setup. |
111 |
6. See if the binary package would fit: |
112 |
$ tar xfj "binpackage.tar.bz2" "filelist-this-package-does-install" |
113 |
$ for f in $(<"filelist-this-package-does-install") |
114 |
do |
115 |
if [[ -e /${f} ]] |
116 |
then |
117 |
do-we-update "${f}" && continue |
118 |
echo "Installing this package conflicts with existing '/${f}'" |
119 |
fi |
120 |
done |
121 |
7. Merge the binary package to the live filesystem: |
122 |
$ cd "/" |
123 |
$ tar xfj "binpackage.tar.bz2" "final" |
124 |
8. Use the package: |
125 |
$ "/final/bin/mybinary" |
126 |
|
127 |
During step 3, the shared library gets installed as "/staging/final/lib/library.so". |
128 |
Relinking "mybinary", the linker has to read that file, while encoding "/final/lib" |
129 |
(without "/staging") into "mybinary" as the search path for "library.so". |
130 |
|
131 |
Usually that is done this way, encoding the final "runpath": |
132 |
$ ld -o "/staging/final/bin/mybinary" -L "/staging/final/lib" -lrary -blibpath:"/final/lib" |
133 |
|
134 |
Because this won't work as expected, as the "hardcoded" path would contain "/staging": |
135 |
$ ld -o "/staging/final/bin/mybinary" "/staging/final/lib/library.so" |
136 |
|
137 |
Except... when an "Import File" is found at "library.so", referring to "#! /final/lib/...". |
138 |
|
139 |
However, when "library.so" is a /standalone/ Import File, |
140 |
it has to refer to something like "#! /final/lib/library.so.0", |
141 |
so the loader actually can load a shared object rather than an Import File. |
142 |
|
143 |
When "library.so" is an archive file /containing/ both the Import File "shr.imp" and the shared object "shr.o", |
144 |
the Import File has to refer to "#! /final/lib/library.so(shr.o)". |
145 |
|
146 |
For completion, "library.so.0" is called the "soname" in ELF world, |
147 |
but that's a different (although related) topic. |
148 |
|
149 |
/haubi/ |
150 |
-- |
151 |
Michael Haubenwallner |
152 |
Gentoo on a different level |