[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: install_name for libraries and frameworks on OS X

From: Blake Nicholson
Subject: Re: install_name for libraries and frameworks on OS X
Date: Wed, 21 May 2008 23:37:11 -0400

On May 18, 2008, at 8:02 AM, Nicola Pero wrote:
1) Update in gnustep-make so it prints a warning if the
user is on darwin and uses a filesystem layout other than 'apple'.
This warning will tell the user they need to either set
DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH in their shell's environment
as well as in ~/.MacOSX/environment.plist, or they need to install
libraries and frameworks with an absolute install name (see below).

It looks good

Maybe you could make the warning specific to using the 'apple-apple- apple' library-combo (ie, building using the Apple frameworks). If you are using the 'gnu-gnu-gnu' library-combo, then the right thing to do might be to
source in your shell ?

I've put together a patch to add this capability. I print a warning if: (1) the target_os is darwin, (2) the filesystem is not 'apple', *and* (3) the user has not enabled absolute install paths (a new option to configure, see below). This warning informs the user that they need to set DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH and mentions that this is typically accomplished by sourcing

2) Add an option to make to use an absolute install name when linking
the library or framework.  I tend to like the single word options to
make.  Would you be opposed to me simply calling the option
'absolute'?  The end user could then simply type "make absolute=yes"
when building the library or framework.

It looks good. I had a look around and I realized that most platform options we have at the moment are set at configure time though. Would that make things easier ? We could also use a longer expressive name there (you have
to type it only once), ie

./configure --enable-absolute-install-paths

that could set a variable (ABSOLUTE_INSTALL_PATHS = YES/NO) in config.make. The same variable could then be overridden on the command-line (as in, make ABSOLUTE_INSTALL_PATHS=NO) if needed for a special occasion, but I'd expect that most people will consistently either use the option, or not use it, so
they'd set it once in ./configure and be happy.

I added this option to for gnustep-make. As you recommend, this setting gets passed on to config.make (via I also updated library.make and framework.make to check this setting when building on darwin and modify the LIB_LINK_INSTALL_NAME accordingly. I re-generated configure (not shown in my patch below) and tested several combinations of settings, and everything seems to work well. I also tested overriding the absolute install paths setting when invoking make, and that works too.

Please let me know if you have any feedback on my patch below, or if you think it is ready to commit.


---        (revision 26548)
+++        (working copy)
@@ -288,6 +288,51 @@
   exit 1

+# Need to do some checks related to building dylibs on darwin.
+case "$target_os" in
+  darwin*)
+ AC_MSG_CHECKING([if we should build dynamic libraries with an absolute install_name])
+    AC_ARG_ENABLE(absolute-install-paths, [
+  Enable the use of absolute paths for the install_name of dynamic
+  libraries on Darwin.  This option is specific to Darwin and is
+  ignored on all other platforms.  Any code that links against a
+  dynamic library with an absolute install_name will tell dyld to
+  find the library at that location.  Enabling this option allows
+  one to place libraries in non-standard locations without having
+  to set DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH in the shell
+  and ~/.MacOSX/environment.plist, but libraries built with an
+  absolute install_name are not relocatable.  By default, this
+  setting is disabled.
+    ],
+      ac_cv_absolute_install_paths=$enableval,
+      ac_cv_absolute_install_paths="no")
+    if test "$ac_cv_absolute_install_paths" = "yes"; then
+      AC_MSG_RESULT(yes)
+    else
+      AC_MSG_RESULT(no)
+      if test ! x"$GNUSTEP_FILESYSTEM_LAYOUT_FILE" = x"apple"; then
+        echo ""
+        echo "*******************************************************"
+        echo "WARNING: To use a layout other than 'apple' on Mac OS X"
+        echo "without enabling absolute install paths you must set"
+        echo "DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH in your shell"
+        echo "start-up script (typically by sourcing and"
+        echo "also in ~/.MacOSX/environment.plist."
+        echo "*******************************************************"
+        echo ""
+      fi
+    fi
+    ;;
 # Read filesystem layout from file
---      (revision 26548)
+++      (working copy)
@@ -171,3 +171,9 @@
 # Whether the compiler is GCC with precompiled header support
+# Whether the install_name for dynamic libraries on darwin should
+# be an absolute path.
Index: Instance/library.make
--- Instance/library.make       (revision 26548)
+++ Instance/library.make       (working copy)
@@ -239,6 +239,13 @@

+# On Mac OS X, set absolute install_name if requested
+ifeq ($(findstring darwin, $(GNUSTEP_TARGET_OS)), darwin)
+  endif
 # Internal targets
Index: Instance/framework.make
--- Instance/framework.make     (revision 26548)
+++ Instance/framework.make     (working copy)
@@ -309,6 +309,13 @@
   # Use a relative path for easy relocation.
+  # On Mac OS X, set absolute install_name if requested
+  ifeq ($(findstring darwin, $(GNUSTEP_TARGET_OS)), darwin)
+    endif
+  endif

reply via email to

[Prev in Thread] Current Thread [Next in Thread]