On NetBSD using $ORIGIN in an rpath does not work when running the executable from a symbolic link located in another directory. This is probably because $ORIGIN is set from /proc/self/exe which contains the paths of the symbolic link instead of that of the executable, resulting in the rpath pointing to the wrong location.
For Wine this means running './wine notepad' from a 64 bit build does not work because libwine.so.1 is not found.
So avoid $ORIGIN on NetBSD and instead use the full path to the build directory. At least this will work until the build directory is moved around.
Signed-off-by: Francois Gouget fgouget@codeweavers.com ---
I don't really like this patch but it gets things going. I consider it to be a NetBSD bug and ideally they would fix it. But then we need some solution in the interim. Also the NetBSD developers seem to dislike the $ORIGIN feature so I'm not sure that will happen.
https://mail-index.netbsd.org/tech-pkg/2013/11/15/msg012248.html
configure.ac | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac index 581189b2156..2a535ca90eb 100644 --- a/configure.ac +++ b/configure.ac @@ -958,11 +958,21 @@ case $host_os in WINEPRELOADER_LDFLAGS="-static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7c400000"
WINE_TRY_CFLAGS([-Wl,--rpath,$ORIGIN/../lib], - [LDRPATH_INSTALL="-Wl,--rpath,\$$ORIGIN/`$(MAKEDEP) -R ${bindir} ${libdir}`" - LDRPATH_LOCAL="-Wl,--rpath,\$$ORIGIN/$(top_builddir)/libs/wine"], + [rpath_opt="-Wl,--rpath"], [WINE_TRY_CFLAGS([-Wl,-R,$ORIGIN/../lib], - [LDRPATH_INSTALL="-Wl,-R,\$$ORIGIN/`$(MAKEDEP) -R ${bindir} ${libdir}`" - LDRPATH_LOCAL="-Wl,-R,\$$ORIGIN/$(top_builddir)/libs/wine"])]) + [rpath_opt="-Wl,-R"])]) + if test -n "$rpath_opt" + then + LDRPATH_INSTALL="$rpath_opt,\$$ORIGIN/`$(MAKEDEP) -R ${bindir} ${libdir}`" + case $host_os in + netbsd) + LDRPATH_LOCAL="$rpath_opt,$ac_pwd/libs/wine" + ;; + *) + LDRPATH_LOCAL="$rpath_opt,\$$ORIGIN/$(top_builddir)/libs/wine" + ;; + esac + fi
WINE_TRY_CFLAGS([-Wl,--enable-new-dtags], [LDRPATH_INSTALL="$LDRPATH_INSTALL -Wl,--enable-new-dtags"])