[bcc: Vess] Hi Nikolay, OK, I have looked harder into this stuff. I now appreciate better why OpenBSD's own ldd works with Linux object files. Not having had much experience playing with libraries and linkable object formats since way back, much less dynamically loaded modules, I looked around and read how ELF got to be used very widely, and how it contains extra information, like operating system info, and version numbers etc.
In any case, as I mentioned in my previous email, the Linux version of ldd does not work directly. Linux ldd, being a script, starts with the usual line: #! /bin/sh So if you run it, it over-rides even one's own PATH and fetches the OpenBSD version of sh. I previously thought perhaps setting my path to look first into the Linux tree of directories (the ones set up by fedora_base) would be best if I was going to play with this stuff. So I set my path something like: /emul/linux/bin:/emul/linux/sbin:/emul/linux/usr/bin:\ /emul/linux/usr/sbin:/emul/linux/usr/X11R6/bin:/emul/linux/usr/local/bin:\ /emul/linux/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:\ /usr/local/bin:/usr/local/sbin:. After a while I realized that if I just started the ldd script explicitly, (given my fancy path) instead of allowing the first line to define the source of the shell, then that was better. so, getting into the /emul/linux/usr/bin directory I could do things like sh ldd instead of just ldd and the fancy path would pick up the Linux version of sh instead of the OpenBSD sh. Alternately I could modify the first line to call the Linux shell explicitly, making it: #! /emul/linux/bin/sh Why bother, you may ask. Well the reason is because, as I mentioned in my previous email, the OpenBSD version of sh doesn't work correctly on the Linux ldd script. In particular it fails in the following line of the Linux ldd script: if set -o pipefail 2> /dev/null; then which I presume was added by outside parties sometime since your last working with this port. This is an attempt to see if the pipefail option exists within the shell, to deal with SELinux contexts. The pipefail option certainly does not exist within OpenBSD's sh, and doesn't even exist within the version of the Linux sh available here. So it should just fail, and the alternative that follows will be taken. Notice how the error message on failure is just thrown away to /dev/null because it is only meant to be a test and to have it issued from the script is not useful. The difference is that for Linux this is only a warning, and the script proceeds. On the other hand, under OpenBSD's sh it's a fatal error and the script quits immediately -- and due to the cover up of diverting it to /dev/null -- doesn't even tell you why. Well there are about 4 or 5 ways to avoid this, (1) the most obvious being to just change the first line to execute the Linux sh explicitly. Or (2) one could just delete the few lines containing that test, or (3) one could put the test into a sub-shell with parentheses like: if ( set -o pipefail ) 2> /dev/null; then or (4) one could study revising OpenBSD's sh -- the question being whether is should really be a fatal error, or should it be just a warning. The advantage of any of the last three options is that then the Linux ldd script would work with either OpenBSD's sh or with the sh from Linux. Just curious, which way would you fix it? Regards, Austin BTW: The process still fails, so this all is almost academic unless lddlibc4 is also fixed. It is called by Linux's ldd script and has problems too. But I haven't begun to deal with them yet. On Mon, 11 May 2009, Nikolay Sturm wrote: > The linux ldd that comes with fedora_base is not statically linked, it > is a shell script that calls lddlibc4, which is dynamically linked but > does not seem to produce any output whatsoever. > > What does seem to work is using the system ldd, but it's a little > confusing, as it doesn't print the /emul/linux prefix. > > Besides that, the man page seems to be totaly out of date. Setting up a > system like that doesn't make any sense, because we have linux compat ports > since ages. > > Nikolay > > -- > "It's all part of my Can't-Do approach to life." Wally >