Margaret Lewicka
2015-Feb-12 22:37 UTC
[Libguestfs] [PATCH 1/2] run: Set DYLD_LIBRARY_PATH along with LD_LIBRARY_PATH
Mac OS X uses DYLD_LIBRARY_PATH rather than LD_LIBRARY_PATH.
---
run.in | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/run.in b/run.in
index a8c2904..bf7ea1b 100755
--- a/run.in
+++ b/run.in
@@ -77,13 +77,10 @@ fi
PATH="$b/align:$b/builder:$b/cat:$b/customize:$b/df:$b/diff:$b/edit:$b/erlang:$b/fish:$b/format:$b/fuse:$b/inspector:$b/make-fs:$b/p2v:$b/rescue:$b/resize:$b/sparsify:$b/sysprep:$b/test-tool:$b/tools:$b/v2v:$PATH"
export PATH
-# Set LD_LIBRARY_PATH to contain library.
-if [ -z "$LD_LIBRARY_PATH" ]; then
- LD_LIBRARY_PATH="$b/src/.libs:$b/java/.libs:$b/gobject/.libs"
-else
-
LD_LIBRARY_PATH="$b/src/.libs:$b/java/.libs:$b/gobject/.libs:$LD_LIBRARY_PATH"
-fi
-export LD_LIBRARY_PATH
+# Set LD_LIBRARY_PATH and DYLD_LIBRARY_PATH to contain library.
+build_libs_path="$b/src/.libs:$b/java/.libs:$b/gobject/.libs"
+export
LD_LIBRARY_PATH="$build_libs_path${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
+export
DYLD_LIBRARY_PATH="$build_libs_path${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH"
# Make virt-builder use the local website copy to avoid hitting
# the network all the time.
@@ -131,7 +128,8 @@ else
RUBYLIB="$b/ruby/lib:$b/ruby/ext/guestfs:$RUBYLIB"
fi
export RUBYLIB
-export LD_LIBRARY_PATH="$b/ruby/ext/guestfs:$LD_LIBRARY_PATH"
+export
LD_LIBRARY_PATH="$b/ruby/ext/guestfs${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
+export
DYLD_LIBRARY_PATH="$b/ruby/ext/guestfs${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH"
# For OCaml.
if [ -z "$CAML_LD_LIBRARY_PATH" ]; then
--
1.9.3
Margaret Lewicka
2015-Feb-12 22:37 UTC
[Libguestfs] [PATCH 2/2] lib: Check if crypt() comes from a separate library
Mac OS X includes crypt() in libc.
---
builder/link.sh.in | 2 +-
configure.ac | 9 +++++++++
customize/link.sh.in | 2 +-
mllib/link.sh.in | 2 +-
sysprep/link.sh.in | 2 +-
v2v/link.sh.in | 2 +-
6 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/builder/link.sh.in b/builder/link.sh.in
index 59f3c6f..964617f 100644
--- a/builder/link.sh.in
+++ b/builder/link.sh.in
@@ -19,4 +19,4 @@
# Hack automake to link binary properly. There is no other way to add
# the -cclib parameter to the end of the command line.
-exec "$@" -linkpkg -cclib '-pthread -lpthread -lutils
@LIBTINFO_LIBS@ -lcrypt @LIBLZMA_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
+exec "$@" -linkpkg -cclib '-pthread -lpthread -lutils
@LIBTINFO_LIBS@ @LIBCRYPT_LIBS@ @LIBLZMA_LIBS@ @LIBXML2_LIBS@ @LIBINTL@
-lgnu'
diff --git a/configure.ac b/configure.ac
index d68190a..9d95c2c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -590,6 +590,15 @@ AC_ARG_WITH([extra-packages],
[EXTRA_PACKAGES=])
AC_SUBST([EXTRA_PACKAGES])
+dnl Check if crypt() is provided by a separate library.
+old_LIBS="$LIBS"
+AC_SEARCH_LIBS([crypt],[crypt])
+LIBS="$old_LIBS"
+if test "$ac_cv_search_crypt" = "-lcrypt" ; then
+ LIBCRYPT_LIBS="-lcrypt"
+fi
+AC_SUBST([LIBCRYPT_LIBS])
+
dnl Check for libdl/dlopen (optional - only used to test if the library
dnl can be used with libdl).
AC_CHECK_LIB([dl],[dlopen],[have_libdl=yes],[have_libdl=no])
diff --git a/customize/link.sh.in b/customize/link.sh.in
index 79dc847..15b6e66 100644
--- a/customize/link.sh.in
+++ b/customize/link.sh.in
@@ -19,4 +19,4 @@
# Hack automake to link binary properly. There is no other way to add
# the -cclib parameter to the end of the command line.
-exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ -lcrypt
@LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
+exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@
@LIBCRYPT_LIBS@ @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
diff --git a/mllib/link.sh.in b/mllib/link.sh.in
index 79dc847..15b6e66 100644
--- a/mllib/link.sh.in
+++ b/mllib/link.sh.in
@@ -19,4 +19,4 @@
# Hack automake to link binary properly. There is no other way to add
# the -cclib parameter to the end of the command line.
-exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ -lcrypt
@LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
+exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@
@LIBCRYPT_LIBS@ @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
diff --git a/sysprep/link.sh.in b/sysprep/link.sh.in
index 8584faf..7d8ccec 100644
--- a/sysprep/link.sh.in
+++ b/sysprep/link.sh.in
@@ -19,4 +19,4 @@
# Hack automake to link binary properly. There is no other way to add
# the -cclib parameter to the end of the command line.
-exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ -lcrypt
@LIBXML2_LIBS@ @LIBINTL@ -lgnu'
+exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@
@LIBCRYPT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
diff --git a/v2v/link.sh.in b/v2v/link.sh.in
index 79dc847..15b6e66 100644
--- a/v2v/link.sh.in
+++ b/v2v/link.sh.in
@@ -19,4 +19,4 @@
# Hack automake to link binary properly. There is no other way to add
# the -cclib parameter to the end of the command line.
-exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ -lcrypt
@LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
+exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@
@LIBCRYPT_LIBS@ @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
--
1.9.3
Richard W.M. Jones
2015-Feb-13 09:02 UTC
Re: [Libguestfs] [PATCH 2/2] lib: Check if crypt() comes from a separate library
ACK series. I'll push this later today. Thanks, Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Pino Toscano
2015-Feb-13 10:07 UTC
Re: [Libguestfs] [PATCH 2/2] lib: Check if crypt() comes from a separate library
On Thursday 12 February 2015 22:37:07 Margaret Lewicka wrote:> Mac OS X includes crypt() in libc. > --- > builder/link.sh.in | 2 +- > configure.ac | 9 +++++++++ > customize/link.sh.in | 2 +- > mllib/link.sh.in | 2 +- > sysprep/link.sh.in | 2 +- > v2v/link.sh.in | 2 +- > 6 files changed, 14 insertions(+), 5 deletions(-) > > diff --git a/builder/link.sh.in b/builder/link.sh.in > index 59f3c6f..964617f 100644 > --- a/builder/link.sh.in > +++ b/builder/link.sh.in > @@ -19,4 +19,4 @@ > # Hack automake to link binary properly. There is no other way to add > # the -cclib parameter to the end of the command line. > > -exec "$@" -linkpkg -cclib '-pthread -lpthread -lutils @LIBTINFO_LIBS@ -lcrypt @LIBLZMA_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu' > +exec "$@" -linkpkg -cclib '-pthread -lpthread -lutils @LIBTINFO_LIBS@ @LIBCRYPT_LIBS@ @LIBLZMA_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu' > diff --git a/configure.ac b/configure.ac > index d68190a..9d95c2c 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -590,6 +590,15 @@ AC_ARG_WITH([extra-packages], > [EXTRA_PACKAGES=]) > AC_SUBST([EXTRA_PACKAGES]) > > +dnl Check if crypt() is provided by a separate library. > +old_LIBS="$LIBS" > +AC_SEARCH_LIBS([crypt],[crypt]) > +LIBS="$old_LIBS" > +if test "$ac_cv_search_crypt" = "-lcrypt" ; then > + LIBCRYPT_LIBS="-lcrypt" > +fiThat's a good start; I'd just make this slightly more robust, since we do require crypt(): AS_CASE([$ac_cv_search_crypt], ["none required"],[], [no],[AC_MSG_FAILURE([crypt() is needed])], [LIBCRYPT_LIBS="$ac_cv_search_crypt"]) (untested)> +AC_SUBST([LIBCRYPT_LIBS]) > + > dnl Check for libdl/dlopen (optional - only used to test if the library > dnl can be used with libdl). > AC_CHECK_LIB([dl],[dlopen],[have_libdl=yes],[have_libdl=no]) > diff --git a/customize/link.sh.in b/customize/link.sh.in > index 79dc847..15b6e66 100644 > --- a/customize/link.sh.in > +++ b/customize/link.sh.in > @@ -19,4 +19,4 @@ > # Hack automake to link binary properly. There is no other way to add > # the -cclib parameter to the end of the command line. > > -exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ -lcrypt @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu' > +exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ @LIBCRYPT_LIBS@ @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu' > diff --git a/mllib/link.sh.in b/mllib/link.sh.in > index 79dc847..15b6e66 100644 > --- a/mllib/link.sh.in > +++ b/mllib/link.sh.in > @@ -19,4 +19,4 @@ > # Hack automake to link binary properly. There is no other way to add > # the -cclib parameter to the end of the command line. > > -exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ -lcrypt @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu' > +exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ @LIBCRYPT_LIBS@ @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu' > diff --git a/sysprep/link.sh.in b/sysprep/link.sh.in > index 8584faf..7d8ccec 100644 > --- a/sysprep/link.sh.in > +++ b/sysprep/link.sh.in > @@ -19,4 +19,4 @@ > # Hack automake to link binary properly. There is no other way to add > # the -cclib parameter to the end of the command line. > > -exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ -lcrypt @LIBXML2_LIBS@ @LIBINTL@ -lgnu' > +exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ @LIBCRYPT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu' > diff --git a/v2v/link.sh.in b/v2v/link.sh.in > index 79dc847..15b6e66 100644 > --- a/v2v/link.sh.in > +++ b/v2v/link.sh.in > @@ -19,4 +19,4 @@ > # Hack automake to link binary properly. There is no other way to add > # the -cclib parameter to the end of the command line. > > -exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ -lcrypt @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu' > +exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ @LIBCRYPT_LIBS@ @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu' >Thanks, -- Pino Toscano