~ chicken-core (chicken-5) 26b5e92be64a2d022f355499815ffe9b8b670287
commit 26b5e92be64a2d022f355499815ffe9b8b670287 Author: Peter Bex <peter.bex@xs4all.nl> AuthorDate: Sat Feb 1 20:05:06 2014 +0100 Commit: Christian Kellermann <ckeen@pestilenz.org> CommitDate: Mon Feb 3 16:56:11 2014 +0100 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. Signed-off-by: Christian Kellermann <ckeen@pestilenz.org> diff --git a/NEWS b/NEWS index 65897290..13b34879 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 ff4c29f3..7b36ab08 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 dddbbb98..5b3c8dfc 100644 --- a/csc.scm +++ b/csc.scm @@ -69,7 +69,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)) @@ -266,7 +265,7 @@ (list (conc "-L\"" library-dir "\"") (conc " -Wl,-R\"" - (if (and deployed (not netbsd)) + (if deployed "\\$ORIGIN" (prefix "" "lib" (if host-mode @@ -277,8 +276,7 @@ (list (conc "-Wl,-R\"" library-dir "\""))) (else (list (conc "-L\"" library-dir "\"")))) - (if (and deployed (or (eq? (software-version) 'freebsd) - (eq? (software-version) 'openbsd))) + (if (and deployed (memq (software-version) '(freebsd openbsd netbsd))) (list "-Wl,-z,origin") '()) (cond ((get-environment-variable "CHICKEN_C_LIBRARY_PATH") => diff --git a/manual/Deployment b/manual/Deployment index 70d7223d..fd3c88c2 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 9388a32f..4302a9e2 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." fiTrap