Hi Collin,

> > + env -i 
> > PATH=/home/bruno/coreutils-9.7.321-dc30e/build/./src:/home/bruno/coreutils-9.7.321-dc30e/build/src:/home/bruno/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
> >  printenv --null
> > ld.so: printenv: can't load library 'libintl.so.12.3'
> > ../tests/env/env-null.sh: line 37: 54909 Killed                  env -i 
> > PATH="$PATH" printenv --null > out2
> > + fail=1
> 
> These ones all fail like this. Is it a misconfiguration?

It's indeed related to my configuration:

I have GNU libiconv installed from the OpenBSD package repository in /usr/local.

I have GNU gettext installed from source in $HOME.

Therefore I use this configure command:
  ../configure --prefix=$HOME \
               CPPFLAGS="-I$HOME/include -I/usr/local/include -Wall" \
               LDFLAGS="-L$HOME/lib -L/usr/local/lib"

On other OSes, this is sufficient for the GNU gettext.m4 macros
to set LIBINTL="-I$HOME/lib -lintl -Wl,-rpath,$HOME/lib", and things
work fine.

On OpenBSD, config.status sets
  LIBINTL="/home/bruno/lib/libintl.so.12.3 /usr/local/lib/libiconv.so.7.1 
-Wl,-rpath,/usr/local/lib"

Somehow the directory /home/bruno/lib is missing from rpath.
Therefore I have set the environment variable LD_LIBRARY_PATH=/home/bruno/lib.

Now,
$ readelf -d src/printenv

Dynamic section at offset 0x9478 contains 20 entries:
  Tag        Type                         Name/Value
 0x000000000000001d (RUNPATH)            Library runpath: [/usr/local/lib]
 0x0000000000000001 (NEEDED)             Shared library: [libintl.so.12.3]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.100.3]
 0x000000006ffffffb (FLAGS_1)            Flags: PIE
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000007 (RELA)               0xc98
 0x0000000000000008 (RELASZ)             528 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffff9 (RELACOUNT)          16
 0x0000000000000017 (JMPREL)             0xea8
 0x0000000000000002 (PLTRELSZ)           1128 (bytes)
 0x0000000000000003 (PLTGOT)             0xb5e8
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000006 (SYMTAB)             0x3a0
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000005 (STRTAB)             0xa88
 0x000000000000000a (STRSZ)              523 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x8b0
 0x0000000000000004 (HASH)               0x8d0
 0x0000000000000000 (NULL)               0x0
$ ldd src/printenv
src/printenv:
        Start            End              Type  Open Ref GrpRef Name
        00000031f40c0000 00000031f40cd000 exe   2    0   0      src/printenv
        00000034a9932000 00000034a996a000 rlib  0    1   0      
/home/bruno/lib/libintl.so.12.3
        00000034d5faf000 00000034d60b6000 rlib  0    1   0      
/usr/lib/libc.so.100.3
        00000034a185a000 00000034a196c000 rlib  0    1   0      
/usr/local/lib/libiconv.so.7.1
        0000003442480000 000000344248d000 rlib  0    1   0      
/usr/lib/libpthread.so.27.1
        00000034b72ea000 00000034b72ea000 ld.so 0    1   0      
/usr/libexec/ld.so

You can see that the information where to find libintl.so.12.3 is not
present in the executable. Therefore the LD_LIBRARY_PATH variable
is necessary.

Now, "env -i ... ../src/printenv" clears the environment, including
the LD_LIBRARY_PATH variable.

Is removing LD_LIBRARY_PATH along with all other environment variables
causing the trouble? Yes.

Is my environment misconfigured? I don't think so. Everything else is
working fine.

Should LIBINTL better be set to
  LIBINTL="/home/bruno/lib/libintl.so.12.3 /usr/local/lib/libiconv.so.7.1 
-Wl,-rpath,/home/bruno/lib -Wl,-rpath,/usr/local/lib" ?
If I do this and rebuild, src/printenv no longer relies on LD_LIBRARY_PATH,
and "make check" passes.

Should LIBINTL better be set to
  LIBINTL="/home/bruno/lib/libintl.so.12.3 /usr/local/lib/libiconv.so.7.1 
-Wl,-rpath,/home/bruno/lib:/usr/local/lib" ?
This works too, likewise.

Why does the configuration not set LIBINTL to contain both directories in rpath?
Becaus /usr/local/lib also contains a libintl, but of an older version
(libintl.so.8.0); that's not the one I want to use.

Bruno




Reply via email to