>From 44059bd01539e6509e89f2a418388b8c87501fa0 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Sat, 1 Feb 2014 20:05:06 +0100 Subject: [PATCH] Enable -deploy ($ORIGIN) support for NetBSD It works, but with a small caveat: it's been added since 5.0 and the program must be invoked through an absolute path when running it. This works implicitly when running the program without a path (ie through $PATH), as well. --- NEWS | 2 +- README | 9 +++++++++ csc.scm | 6 +++--- manual/Deployment | 9 ++++++--- tests/runtests.sh | 5 +++-- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 6589729..13b3487 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,7 @@ - Tools - csc "-deploy" works now on FreeBSD (thanks to Jules Altfas and - Vitaly Magerya) and OpenBSD. + Vitaly Magerya), OpenBSD and NetBSD (see README for NetBSD). 4.8.3 diff --git a/README b/README index a063af3..5be3e3c 100644 --- a/README +++ b/README @@ -393,6 +393,15 @@ % unlimit datasize + - When using -deploy on NetBSD, currently the kernel only + supports running the program through its absolute path, + otherwise you will get an error message stating: + + execname not specified in AUX vector: No such file or directory + + Deployed binaries can also be run without an explicit path, + through $PATH; only relative pathnames do not work. + - Using external libraries on NetBSD may also be easier, if you add the following definitions to `Makefile.bsd': diff --git a/csc.scm b/csc.scm index 6d1ce58..4063247 100644 --- a/csc.scm +++ b/csc.scm @@ -68,7 +68,6 @@ (define mingw (eq? (build-platform) 'mingw32)) (define osx (eq? (software-version) 'macosx)) (define win mingw) -(define netbsd (eq? (software-version) 'netbsd)) (define cygwin (eq? (build-platform) 'cygwin)) (define aix (eq? (build-platform) 'aix)) @@ -265,7 +264,7 @@ (list (conc "-L\"" library-dir "\"") (conc " -Wl,-R\"" - (if (and deployed (not netbsd)) + (if deployed "\\$ORIGIN" (prefix "" "lib" (if host-mode @@ -277,7 +276,8 @@ (else (list (conc "-L\"" library-dir "\"")))) (if (and deployed (or (eq? (software-version) 'freebsd) - (eq? (software-version) 'openbsd))) + (eq? (software-version) 'openbsd) + (eq? (software-version) 'netbsd))) (list "-Wl,-z,origin") '()) (cond ((get-environment-variable "CHICKEN_C_LIBRARY_PATH") => diff --git a/manual/Deployment b/manual/Deployment index 70d7223..fd3c88c 100644 --- a/manual/Deployment +++ b/manual/Deployment @@ -164,9 +164,12 @@ will list dynamic libraries that your application needs. ===== Other UNIX flavors Setting up the application executable to load runtime libraries from -the same directory is supported on FreeBSD, OpenBSD and Solaris. -NetBSD supports this from version 5.0 onwards - this is currently -disabled in {{csc}} for this particular platform. +the same directory is supported on FreeBSD, NetBSD, OpenBSD and Solaris. + +Under NetBSD, you must invoke the binary using its full absolute path +(or via {{$PATH}}), otherwise it will give you an error message: + + execname not specified in AUX vector: No such file or directory On AIX, deployment is currently not fully supported as the runtime linker will only load libraries from paths hardcoded at link time. diff --git a/tests/runtests.sh b/tests/runtests.sh index 9388a32..4302a9e 100755 --- a/tests/runtests.sh +++ b/tests/runtests.sh @@ -425,9 +425,10 @@ if test $OS_NAME != AIX; then CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY $compile2 -deploy rev-app.scm CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY $CHICKEN_INSTALL -deploy -prefix rev-app -t local -l $TEST_DIR reverser unset LD_LIBRARY_PATH DYLD_LIBRARY_PATH CHICKEN_REPOSITORY - rev-app/rev-app 1.1 + # An absolute path is required on NetBSD with $ORIGIN, hence `pwd` + `pwd`/rev-app/rev-app 1.1 mv rev-app rev-app-2 - rev-app-2/rev-app 1.1 + `pwd`/rev-app-2/rev-app 1.1 else echo "Disabling deployment tests, as deployment is currently unsupported on AIX." fi -- 1.7.10.4