Created attachment 66072 [details] Set LD_LIBRARY_PATH for uno_test. I had a build failure related uno, at least for FreeBSD. It turned out LD_LIBRARY_PATH wasn't set and it failed to load required libraries for uno binary. It was successfully built with the attached patch.
so FreeBSD still has nothing similar to Linux/Solaris' ELF RPATH=$ORIGIN/... etc., but solely relies on LD_LIBRARY_PATH to find LO's libs?
$ORIGIN is available for about 3 years: http://svnweb.freebsd.org/base?view=revision&revision=189959 In fact, I am not really sure why this patch is still necessary. I'll try to reproduce the problem without the patch and let you know the detail.
Okay, I found the root cause of this problem: % cat main.c void hello(void); int main(void) { hello(); return (0); } % cat lib/hello.c #include <stdio.h> void hello(void) { printf("Hello, world!\n"); } % make clean rm -f lib/libhello.so main % make cc -fPIC -shared -o lib/libhello.so lib/hello.c cc -Wl,-rpath='$ORIGIN/lib' -Llib -lhello -o main main.c % ./main Shared object "libhello.so" not found, required by "main" % make clean rm -f lib/libhello.so main % make LDFLAGS=-Wl,-zorigin cc -fPIC -shared -o lib/libhello.so lib/hello.c cc -Wl,-zorigin -Wl,-rpath='$ORIGIN/lib' -Llib -lhello -o main main.c % ./main Hello, world! FreeBSD ld must have "-zorigin" with "-rpath". Otherwise, $ORIGIN is not translated and it is literal.
To confirm, I did the following before start building: find . -type f -print0 | \ xargs -0 sed -i '' -e 's#-Wl,-rpath,#-Wl,-z,origin,-rpath,#g' Now "objdump -p uno" or "readelf --dynamic uno" shows the flag is set correctly.
(In reply to comment #3) > FreeBSD ld must have "-zorigin" with "-rpath". Otherwise, $ORIGIN is not > translated and it is literal. So the true fix for LO will be to add -zorigin in solenv/{inc,gbuild} for FreeBSD, right? Will you create a new patch?
(In reply to comment #5) > (In reply to comment #3) > > FreeBSD ld must have "-zorigin" with "-rpath". Otherwise, $ORIGIN is not > > translated and it is literal. > > So the true fix for LO will be to add -zorigin in solenv/{inc,gbuild} for > FreeBSD, right? Will you create a new patch? It looks like the option is standard option for GNU ld: http://sourceware.org/binutils/docs-2.22/ld/Options.html#Options Can't we make that a default for GCC? Not sure about MinGW, though.
Created attachment 66254 [details] Replace -Wl,-rpath with -Wl,-z,origin,-rpath Third-party modules are not thoroughly tested.
Jung-uk Kim committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=34ca8dd9adb62c1154f979887a38483d73da978b fdo#54015: At least FreeBSD ld requires -z origin when RPATH contains $ORIGIN
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=34ca8dd9adb62c1154f979887a38483d73da978b>: Signed-off-by: Stephan Bergmann <sbergman@redhat.com>: * bulk replacement of "-Wl,-z,origin,-rpath,..." with "-Wl,-z,origin -Wl,rpath,..." * additional hunk for directory/c-sdk/config/FreeBSD.mk in moz/seamonkey-source-1.1.14.patch did not apply and has been dropped @Jung-uk Kim: Please either provide a working patch for FreeBSD moz, or close as RESOLVED/FIXED for now.
It looks correct, thanks!
Created attachment 66284 [details] Fix seamonkey patch.
Sorry, I found the patch was for security/coreconf/FreeBSD.mk. I have no idea why the hunk was misplaced, though. :-(
Another problem... '-Wl,-z,origin -Wl,-rpath' is parsed badly, at least for clang on FreeBSD. For example, [ build LNK ] Executable/regcompare /usr/local/bin/ld: warning: -z origin -Wl ignored. In other words, '-z origin -Wl' is passed to ld(1) and it does not work at all. % solver/unxfbsd.pro/bin/regcompare Shared object "libuno_sal.so.3" not found, required by "regcompare" % env LD_LIBRARY_PATH=solver/unxfbsd.pro/lib solver/unxfbsd.pro/bin/regcompare solver/unxfbsd.pro/bin/regcompare: missing option '-r1' Usage: solver/unxfbsd.pro/bin/regcompare -r1<filename> -r2<filename> [-options] | @<filename> -r1<filename> = filename specifies the name of the first registry. -r2<filename> = filename specifies the name of the second registry. @<filename> = filename specifies a command file. Options: -s<name> = name specifies the name of a start key. If no start key |S<name> is specified the comparison starts with the root key. -x<name> = name specifies the name of a key which won't be compared. All |X<name> subkeys won't be compared also. This option can be used more than once. -f|F = force the detailed output of any diffenrences. Default is that only the number of differences is returned. -c|C = make a complete check, that means any differences will be detected. Default is only a compatibility check that means only UNO typelibrary entries will be checked. -t|T = make an UNO type compatiblity check. This means that registry 2 will be checked against registry 1. If a interface in r2 contains more methods or the methods are in a different order as in r1, r2 is incompatible to r1. But if a service in r2 supports more properties as in r1 and the new properties are 'optional' it is compatible. -u|U = additionally check types that are unpublished in registry 1. -h|-? = print this help message and exit. solver/unxfbsd.pro/bin/regcompare Version 1.0 FYI, full build log is available from here: https://redports.org/~jkim/20120829180932-76536-56265/libreoffice-3.6.0.log Can you please do "-Wl,-z,origin,-rpath" as I did originally? Thanks!
Created attachment 66303 [details] "-Wl,-z,origin -Wl,-rpath," -> "-Wl,-z,origin,-rpath,"
Created attachment 66304 [details] Patch against head.
Created attachment 66305 [details] Patch against head (with seamonkey patch).
(In reply to comment #13) > Another problem... '-Wl,-z,origin -Wl,-rpath' is parsed badly, at least for > clang on FreeBSD. Also for Ubuntu Oneiric, it turned out, so I already fixed that independently as <http://cgit.freedesktop.org/libreoffice/core/commit/?id=b888512fcbff5bf5ae4d30e82ed51a792ceb1839> "Fix -Wl,-z,origin -Wl,-rpath,... quoting" before noticing your patch here. > Can you please do "-Wl,-z,origin,-rpath" as I did originally? I prefer to keep it as two -Wl, as it is two independent (though related) options that are passed to the linker.
Jung-uk Kim committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=78d8557aab0046d51d1ee09d11164248dd1d1391 fdo#54015: At least FreeBSD ld requires -z origin, moz redux
Comment on attachment 66305 [details] Patch against head (with seamonkey patch). attachment 66305 [details] is now obsoleted via comment 17 and comment 18