1 |
Lets start over. I don't think I'm making any progress but I'll give it one last go. |
2 |
|
3 |
Here is the output of dump -H of my installed ruby: |
4 |
|
5 |
/usr/local/rvm/rubies/ruby-1.9.1-p378/bin/ruby: |
6 |
|
7 |
***Loader Section*** |
8 |
Loader Header Information |
9 |
VERSION# #SYMtableENT #RELOCent LENidSTR |
10 |
0x00000001 0x00000553 0x0000008a 0x00000141 |
11 |
|
12 |
#IMPfilID OFFidSTR LENstrTBL OFFstrTBL |
13 |
0x00000006 0x00008660 0x00006307 0x000087a1 |
14 |
|
15 |
|
16 |
***Import File Strings*** |
17 |
INDEX PATH BASE MEMBER |
18 |
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 |
19 |
1 librtl.a shr.o |
20 |
2 /usr/lib libc.a shr.o |
21 |
3 /usr/lib libpthread.a shr_comm.o |
22 |
4 /usr/lib libpthread.a shr_xpg5.o |
23 |
5 /usr/local/rvm/rubies/ruby-1.9.1-p378/lib libruby.so |
24 |
|
25 |
Except for librtl.a, there are no relative paths anywhere. That is one of my objectives (and your's I believe). |
26 |
|
27 |
It is using /usr/local/rvm/rubies/ruby-1.9.1-p378/lib/libruby.so . If I move that to somewhere else, like |
28 |
|
29 |
/usr/local/rvm/rubies/ruby-1.9.1-p378/lib/other/libruby.so |
30 |
|
31 |
ruby does not work and setting LIBPATH does not fix the problem. Thus, for an object (I'll use the word "object" to mean shared object or an executable) that is linked without only absolute paths, it will not work in the directory that it is built in. In the case of ruby, it builds the library and executable in the same pass. I think this is typical. If you plan to run "make test" or "make check" (different packages call it different things) before the install, you have a problem. |
32 |
|
33 |
The way I solved that problem is to allow the object to have relative paths (or no path) before it is installed, do the "make check", then either fix the object just before install or fix it just after the install. I choose to fix it just after the install with "rl". |
34 |
|
35 |
I don't see how you can have an object that has only absolute paths after it is installed *and* is able to be used before the install so that "make check" or "make test" can be run (except by some weird chroot tricks but no one wants to go down that path). |
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 |
2) The "make check" must work before package is installed. |
40 |
|
41 |
|
42 |
On Feb 8, 2011, at 4:02 PM, Michael Haubenwallner wrote: |
43 |
|
44 |
> Hi Perry! |
45 |
> |
46 |
> On 02/08/11 19:36, Perry Smith wrote: |
47 |
>> On Feb 8, 2011, at 2:49 AM, Michael Haubenwallner wrote: |
48 |
>>> On 02/08/2011 01:35 AM, Perry Smith wrote: |
49 |
>>>> I wrote a front end to AIX's ld command as well as a relink command I'm calling "rl". |
50 |
>>> Actually, in Prefix we already do wrap AIX' ld in sys-devel/binutils-config |
51 |
>>> to get the runpaths (the -blibpath argument) right. |
52 |
>>> There is an RFC[1] for the way I want to have shared libraries being created on AIX. |
53 |
>>> [1] http://lists.gnu.org/archive/html/libtool/2011-01/msg00023.html |
54 |
>> |
55 |
>> I am not on the libtool list. I did not read that thread yet but I will here shortly. |
56 |
> |
57 |
> You might consider subscribing to that Gentoo bug[1], its URL refers |
58 |
> to the libtool thread, and I'm usually adding progress there. |
59 |
> |
60 |
> [1] http://bugs.gentoo.org/show_bug.cgi?id=213277 |
61 |
> |
62 |
>> I need some "netiquette" help. Should I plop my thoughts / questions about that |
63 |
>> thread into this thread or start a new thread? I get confused either way :-) (Maybe |
64 |
>> I'm special that way.) |
65 |
> |
66 |
> Eventually we can sort out your concerns here (first). |
67 |
> |
68 |
>>>> https://github.com/pedz/aixbin |
69 |
>>> |
70 |
>>> Commenting on 'Readme.markdown' found there: |
71 |
>>> Why do you move '-blibpath' arguments to '-L' arguments? |
72 |
>>> IMO, the other way round would make more sense actually. |
73 |
>>> Why do you need 'rl' (relink) at all? |
74 |
>> |
75 |
>> For ruby, their libpath was a complete mistake. |
76 |
> |
77 |
> Ohw, seems there's need to fix your view on the libpath/runpath issue, |
78 |
> as everything you describe here actually is how it should be done: |
79 |
> |
80 |
> Usually, compilers are installed as part of the host system into somewhere |
81 |
> like /usr, where /usr/lib usually is the search path for any installed |
82 |
> library at linktime (called "linkpath", set via "-L" linker flag), and |
83 |
> either "/usr/lib:/lib" or even "/lib:/usr/lib" is the search path at |
84 |
> runtime (called "runpath", set via "-blibpath" linker flag). |
85 |
> |
86 |
>> They did not include the path to gcc's library. |
87 |
> |
88 |
> Nobody but the compiler and/or the system should know the system's and |
89 |
> compiler's library directories. It is up to the compiler-, linker- and |
90 |
> loader-setup to find the system's and especially the compiler's libraries |
91 |
> at both linktime and runtime. |
92 |
> |
93 |
> This exactly is the (major) reason why in Prefix we do wrap the linker |
94 |
> (as well as the compiler) to get gcc's and Prefix' (being the (sub)system) |
95 |
> library directories into both linkpath and runpath. |
96 |
> |
97 |
>> They did not have a -L /path/to/where/they/would/install |
98 |
> |
99 |
> The currently built package's libraries must not be linked from the target |
100 |
> installation directory. Imagine an old version of a library is already |
101 |
> installed there, and you want to upgrade the package - as is the usual |
102 |
> case with package managers (being either humans or software). |
103 |
> |
104 |
> And if there are dependent libraries, they either are installed in system's |
105 |
> library directories the compiler/linker setup knows anyway, or the package |
106 |
> manager should add their locations via something like LDFLAGS or the like. |
107 |
> |
108 |
> So while the new binaries must _not_ be /linked/ against the already installed |
109 |
> libraries provided by another instance of the package just built, ... |
110 |
> |
111 |
>> but they did have -blibpath:/path/to/where/they/would/install:/usr/lib:/lib |
112 |
> |
113 |
> ..., at runtime (after installing) the libraries have to be /loaded/ from there. |
114 |
> |
115 |
> One AIX specific thing here is that the AIX loader cannot be configured to |
116 |
> search additional directories, so the binaries have to contain the whole runpath. |
117 |
> While the linker does search /usr/lib and /lib at linktime, it will not add |
118 |
> these paths to the runpath when an explicit runpath is specified via -blibpath. |
119 |
> This is why "/usr/lib:/lib" is specified with -blibpath too. |
120 |
> |
121 |
>> And... the executable would never work in the directory |
122 |
>> where it was built in. It would work only after the package was |
123 |
>> installed (moved). I don't know how they were going to do |
124 |
>> the "test" or "check" phase which I'm sure Ruby has. |
125 |
> |
126 |
> They most likely set the LIBPATH environment variable to the local |
127 |
> library directory. This is one of the rare use cases where environment |
128 |
> variables like LD_LIBRARY_PATH, LIBPATH, SHLIB_PATH are useful. |
129 |
> |
130 |
>> I took their mistake as a symptom as a general practice. i.e. |
131 |
>> the general population somehow thinks that libpath substitutes for |
132 |
>> -L and it does not. I'm interested to hear of your experience but |
133 |
>> I can't think of a time where open source understood what libpath |
134 |
>> (inside the object) could/should be used for. |
135 |
> |
136 |
> Actually, the Ruby guys seem to have done it "right": |
137 |
> If you were using xlc (from /usr/bin), or even gcc from the |
138 |
> "AIX Toolbox for Linux applications", so both are "installed |
139 |
> with the host system", you might not have had any problem. |
140 |
> |
141 |
>> The Ruby guys did have a fairly reasonable fear. They did not want |
142 |
>> to have just -L . and -L .., etc and not set the libpath because the -L . |
143 |
>> adds that to the internal libpath and that creates what they called a |
144 |
>> security risk. |
145 |
> |
146 |
> The explicit '-blibpath' avoids recording the (relative) local library |
147 |
> paths passed via '-L' into the runpath: |
148 |
> |
149 |
> *) Using buildtime paths (either relative or not) for -L, the linker is able to |
150 |
> find the new libraries (this is called "linktime"), before installation. |
151 |
> *) Using target paths (absolute only) for -blibpath, the loader is able to |
152 |
> find the installed library (this is called "runtime"), after installation. |
153 |
> |
154 |
>> But, the problem is that the dot needs to be in the internal |
155 |
>> libpath while the executable is in the directory it was built in. |
156 |
> |
157 |
> *) Using local paths (either relative or not) for LIBPATH, the loader is able to |
158 |
> find the new library (there is no such term "testtime"), before installation. |
159 |
> |
160 |
>> The purpose for rt is after the install. |
161 |
> |
162 |
> <snipped anything related to 'rt' (relink?), as it should be obsolete now> |
163 |
> |
164 |
>> I also had a rather self imposed limitation to work around. |
165 |
>> I am trying to get "rvm" to work and rvm thinks it knows how to |
166 |
>> unpackage, configure, build, and install without any user |
167 |
>> intervention. To get that to work, I had to hook in at the ld |
168 |
>> point and then, after the fact, fix the resulting files after they |
169 |
>> are installed. |
170 |
> |
171 |
> This actually is a not so uncommon problem: |
172 |
> It usually does not work that well using more than one package manager |
173 |
> at a time - portage and rvm in this case. |
174 |
> |
175 |
>>>> I've used this only for Ruby -- and it was in fact Ruby that caused me to do this. |
176 |
>>>> Their out of the box system does not work at all for AIX if the prefix directory is not the same as GCC's. |
177 |
>>>> WIth this, I can now use rvm on AIX and do "rvm install 1.9.1" and it will complete successfully without my fingers leaving my hands. |
178 |
> |
179 |
> Which directory (called "prefix") do you tell "rvm" to install to? |
180 |
> Have you tried this while having your Gentoo Prefix instance in your |
181 |
> environment (using /your/gentoo/prefix/startprefix)? |
182 |
> |
183 |
>>> Haven't used/installed Ruby on any platform yet: What is 'rvm' ? |
184 |
>> rvm is "Ruby Version Manager". rvm allows completely independent |
185 |
>> versions of Ruby (1.8.7, 1.9.1, MacRuby, etc). Each version can have |
186 |
>> its own independent sets of gems (called gemsets) so an application |
187 |
>> can use its own version of Ruby and its own set of gems. I can set up |
188 |
>> an environment on my development laptop and then fairly easily replicate |
189 |
>> this environment on my staging server and production server. It solves |
190 |
>> many problems I have when trying to have three or four Rails apps |
191 |
>> on the same host. (sorry for the long winded reply). |
192 |
> |
193 |
> Basically this also is what Gentoo Prefix is for - having multiple instances |
194 |
> of similar things set up on one machine. However, eventually it is possible |
195 |
> to have multiple Ruby versions within one instance of Gentoo Prefix (and even |
196 |
> Gentoo Linux) set up in some package-managed way (using portage as the |
197 |
> package manager instead of rvm). |
198 |
> |
199 |
>>>> I mentioned this idea on this list before but it didn't fly very well. |
200 |
>>>> I'm not sure if it was completely understood. |
201 |
>>> I fail to find that post you're referring to. Has it been within one |
202 |
>>> of the threads we already created together, and I've overlooked it? |
203 |
>> |
204 |
>> I *think* this is the post but it got munged: |
205 |
>> http://archives.gentoo.org/gentoo-alt/msg_d16e4dce43974e6926eedf04a3b8fb36.xml |
206 |
>> |
207 |
>> My archive is this (snipped out). |
208 |
> |
209 |
> Ok, found it in my archives too - for mailing list managers |
210 |
> it is easier to receive plain text mails, no html. |
211 |
> |
212 |
>> The time stamp is Tue, Dec 14, 2010 at 6:25 PM (to the gentoo-alt list) |
213 |
>> |
214 |
>>> Also, the guy I'm talking to mentioned rtl_enable -s. I've not used it but it seems like it might make life a lot easier. |
215 |
> |
216 |
> Still I do think we don't have any use for 'rtl_enable' when |
217 |
> we are able to /create/ corrent shared libraries firsthand. |
218 |
> rtl_enable is designed to "fix" shared objects for one's needs |
219 |
> when there is no sourcecode available. |
220 |
> |
221 |
>>>> This is more of a proof of concept at this stage. I'm going to putter around and try and use it on other packages. |
222 |
>>> |
223 |
>>> For packages not aware of AIX at all: |
224 |
>>> How would this require their build systems to be patched? |
225 |
>>> |
226 |
>>>> "rl" could be enhanced to take "from" and "to" directories. |
227 |
> |
228 |
> The above "rt" is a typo and should be "rl"? |
229 |
> |
230 |
>>>> If you wanted to change files installed in /some/old/directory and put them into /some/new/directory, rl could easily modified do that. |
231 |
>>> |
232 |
>>> In which context do you need this use case? |
233 |
>> |
234 |
>> With putting absolute paths into the objects, we are effectively nullifying the possible benefit of the LIBPATH environment. I think we |
235 |
>> both agree that that benefit is questionable but others might like it. So if someone wants to move where I built a package from |
236 |
>> /usr/local to /opt, the first step would be to change the internal absolute paths to each dependency. There would be other obstacles too |
237 |
>> like any internal paths of the executables but often there are command line arguments to change those. e.g. you can give |
238 |
>> emacs directions on where to find its lisp files but you can not magically tell the loader where to find emacs' dependent libraries. |
239 |
>> A user once could via LIBPATH but that isn't going to work now with absolute internal paths. rl gives that possibly useful option back |
240 |
>> to the user. |
241 |
> |
242 |
> Well, moving a binary package from /usr/local to /opt is a |
243 |
> completely different use case than the one above, which was: |
244 |
> compile, run from build directory, install (into /usr/local). |
245 |
> |
246 |
> (replace "/usr/local/" by "/gentoo/prefix/usr/") |
247 |
> |
248 |
>>> And how would you do that on Linux? |
249 |
>> |
250 |
>> I don't know squat about Linux. |
251 |
>> Part of my frustration is everyone appears to want to make AIX fit into the Linux way. |
252 |
> |
253 |
> The linkpath/runpath problem isn't specific to Linux in any way, it is |
254 |
> an universal problem when managing packages - on /any/ operating system. |
255 |
> |
256 |
> I did go through these /very/ same linkpath/runpath hell on Linux already, |
257 |
> and in Prefix we do the same linkpath/runpath trickery on /any/ platform. |
258 |
> |
259 |
> Welcome to "rpath hell", "dll hell", "dependency hell", "distribution hell", |
260 |
> "<whatever> hell"! |
261 |
> |
262 |
> The only problem AIX really does have is the lack of something like what is known as |
263 |
> "DT_SONAME" in ELF/SystemV-world[2], being immediately encoded into the shared objects. |
264 |
> The reason for this being a problem is not that ELF does have it, it is because |
265 |
> such a mechanism actually is necessary for managing packages. |
266 |
> However, it is possible to emulate the "DT_SONAME" thing with Import Files ... |
267 |
> |
268 |
> [2] Linux, Solaris, (recent) HP-UX, *BSD, ... |
269 |
> |
270 |
>> My objective is subtly but significantly different. |
271 |
>> I want to get open source packages onto AIX. |
272 |
> |
273 |
> Same goal here. |
274 |
> However, Linux (as "the" open source platform these days) is "the" |
275 |
> reference platform open source packages most often are written for. |
276 |
> |
277 |
> /haubi/ |
278 |
> -- |
279 |
> Michael Haubenwallner |
280 |
> Gentoo on a different level |
281 |
> |