RPATH not honored in the executable

Bug: The RPATH setting in the executable isn’t honored during the
shared library load.

To reproduce:
*) Prepare main.c and hello.c as below
*) Compile hello.c into shared library, as
qcc -shared -o libhello.so hello.c
*) Compile main.c with libhello loaded with pwd as RPATH
LD_RUN_PATH=pwd qcc -o main main.c -L. -lhello
*) Confirm that RPATH is embedded in the executable
objdump -p main | grep RPATH (should be pwd)
*) Test from current dir. This should work.
./main
*) Test from another dir. This should work too, but fails.
The dynamic loader doesn’t search into RPATH paths set in the executable.
cd …; /main

*) (to make it work, set LD_LIBRARY_PATH to where the lib lives.)


Or am I missing something fatal (like ldconfig)?

(Then why does /usr/X11R6/bin binaries work? … Hmm,
LD_LIBRARY_PATH is set explicitly in Photon session… )

============== main.c
extern int hello(void);
int main()
{
hello();
}
============== hello.c
#include <stdio.h>
int hello(void)
{
return printf(“Hello,world\n”);
}


kabe

kabe@sra-tohoku.co.jp wrote:

Hello Kabe,

Bug: The RPATH setting in the executable isn’t honored during the
shared library load.

There was a PR against it, and it looks like it was fixed not long time
ago. I don’t know when it is going to go out though.

Regards,

Marcin

To reproduce:
*) Prepare main.c and hello.c as below
*) Compile hello.c into shared library, as
qcc -shared -o libhello.so hello.c
*) Compile main.c with libhello loaded with pwd as RPATH
LD_RUN_PATH=pwd qcc -o main main.c -L. -lhello
*) Confirm that RPATH is embedded in the executable
objdump -p main | grep RPATH (should be pwd)
*) Test from current dir. This should work.
./main
*) Test from another dir. This should work too, but fails.
The dynamic loader doesn’t search into RPATH paths set in the executable.
cd …; /main

*) (to make it work, set LD_LIBRARY_PATH to where the lib lives.)



Or am I missing something fatal (like ldconfig)?

(Then why does /usr/X11R6/bin binaries work? … Hmm,
LD_LIBRARY_PATH is set explicitly in Photon session… )

============== main.c
extern int hello(void);
int main()
{
hello();
}
============== hello.c
#include <stdio.h
int hello(void)
{
return printf(“Hello,world\n”);
}


kabe

Tools Mail Account <tools@qnx.com> wrote:

kabe@sra-tohoku.co.jp > wrote:

Hello Kabe,

Bug: The RPATH setting in the executable isn’t honored during the
shared library load.

There was a PR against it, and it looks like it was fixed not long time
ago. I don’t know when it is going to go out though.

had it worked in any earlier revisions of QNX6? or is this a new
bug in 6.1A?