Hi again, I am sorry for re-entering the discussion rather late.
It seems that Jonathan's patch proposal made it to -r17478. The problem is that it breaks my PPC OS X 10.4 in that the test for support of -Wl,-install_name fails, so DEAL_II_LD_UNDERSTANDS_DYLIB_INSTALL_NAME gets set to "no". In short, my previous patch breaks Jon's setup, and Jon's breaks mine. I have a patchfile attached which works for me. If it also works for Jonathan, it should work for quite a range of Darwin / OS X platforms. The patch also changes aclocal.m4, therefore autoconf should be run to propagate the changes into the configure script. However, the sequence "make distclean; autoconf; ./configure ...; make baseg" aborts at the "make" stage, complaining about undefined DEAL_II_PACKAGE_STRING. Therefore, I have reverted the configure script to the SVN checkout and propaged the changes manually. The changes to "configure" are contained in the patch, and maintainers should throw them out and do their normal procedure (which I would be interested to learn about). Some background: The Darwin toolchain has several library-related tools in use, namely ld and libtool, the latter not being (much) related to GNU libtool. Apple's port of gcc can call either ld or Darwin's libtool. According to Darwin gcc's manpage, the -dynamiclib option makes gcc use Darwin's libtool which in turn uses ld. This is what happens when creating the libraries. However, the install_name test in aclocal.m4 simply specifies -shared (or nothing as before -r17468) which seems to make gcc use ld directly. ld does not understand -install_name but -dylib_install_name. libtool does not understand -dylib_install_name but -install_name. (This may depend on tool version numbers.) Combined, this gives a reason why the test can succed and the link step can fail nevertheless. Darwin's gcc recognizes most linker options and passes them to the chosen linker appropriately. Both gcc and libtool translate -install_name to -dylib_install_name when calling ld. Thus, if you simply say -install_name (without -Wl) to gcc, things should always work. This is the proposed solution. So, please, Jonathan, could you try the attached patch and give feedback on how it works on your platforms? It would be fine if we could settle this Darwin linker flags issue in the near future. As a generalization of -r17468, the patch also adds $SHLIBFLAGS to the -Wl,-soname and -install_name tests. The change to the -Wl,-soname test has not been checked by me. I just think it makes sense. I hope that someone will check that it is "at least harmless" on ELF systems. If it does not work, undo the change to the -Wl,-soname test. An additional proposal is to omit the extra -dynamic in the definition of DEAL_II_ADD_SONAME because the @SHLIBFLAGS@ get set to -dynamiclib which should translate into "libtool -dynamic" anyway. This proposal effects the same code lines as the install_name patch; therefore I have merged both proposals into one patch. Regards, -- Christian Cornelssen
Index: aclocal.m4
===================================================================
--- aclocal.m4 (Revision 17522)
+++ aclocal.m4 (Arbeitskopie)
@@ -1713,9 +1713,10 @@
dnl -------------------------------------------------------------
AC_DEFUN(DEAL_II_CHECK_LINK_SONAME,
[
+ dnl This requires that SHLIBFLAGS (-shared or -dynamiclib) has been defined.
dnl First try -soname
OLD_LDFLAGS=$LDFLAGS
- LDFLAGS="-Wl,-soname,libbase.so.6.2.1 $LDFLAGS"
+ LDFLAGS="-Wl,-soname,libbase.so.6.2.1 $LDFLAGS $SHLIBFLAGS"
AC_MSG_CHECKING([whether compiler understands option -Wl,-soname])
AC_LINK_IFELSE(
[ AC_LANG_PROGRAM([[]],[[]])],
@@ -1733,8 +1734,8 @@
dnl Now try the -dylib_install_name thing
OLD_LDFLAGS=$LDFLAGS
- LDFLAGS="-Wl,-dynamic,-install_name -Wl,libbase.so.6.2.1 $LDFLAGS -shared"
- AC_MSG_CHECKING([whether compiler understands option
-Wl,-dynamic,-install_name])
+ LDFLAGS="-install_name libbase.6.2.1.dylib $LDFLAGS $SHLIBFLAGS"
+ AC_MSG_CHECKING([whether compiler understands option -install_name])
AC_LINK_IFELSE(
[ AC_LANG_PROGRAM([[]],[[]])],
[
Index: common/Make.global_options.in
===================================================================
--- common/Make.global_options.in (Revision 17522)
+++ common/Make.global_options.in (Arbeitskopie)
@@ -121,7 +121,7 @@
DEAL_II_ADD_SONAME = -Wl,-soname,$(call DEAL_II_SHLIB_NAME,$(1))
else
ifeq (@DEAL_II_LD_UNDERSTANDS_DYLIB_INSTALL_NAME@,yes)
- DEAL_II_ADD_SONAME = -Wl,-dynamic,-install_name -Wl,$(call
DEAL_II_SHLIB_NAME,$(1))
+ DEAL_II_ADD_SONAME = -install_name $(call DEAL_II_SHLIB_NAME,$(1))
else
DEAL_II_ADD_SONAME =
endif
Index: configure
===================================================================
--- configure (Revision 17522)
+++ configure (Arbeitskopie)
@@ -11501,7 +11501,7 @@
OLD_LDFLAGS=$LDFLAGS
- LDFLAGS="-Wl,-soname,libbase.so.6.2.1 $LDFLAGS"
+ LDFLAGS="-Wl,-soname,libbase.so.6.2.1 $LDFLAGS $SHLIBFLAGS"
{ echo "$as_me:$LINENO: checking whether compiler understands option
-Wl,-soname" >&5
echo $ECHO_N "checking whether compiler understands option -Wl,-soname...
$ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
@@ -11560,9 +11560,9 @@
OLD_LDFLAGS=$LDFLAGS
- LDFLAGS="-Wl,-dynamic,-install_name -Wl,libbase.so.6.2.1 $LDFLAGS -shared"
- { echo "$as_me:$LINENO: checking whether compiler understands option
-Wl,-dynamic,-install_name" >&5
-echo $ECHO_N "checking whether compiler understands option
-Wl,-dynamic,-install_name... $ECHO_C" >&6; }
+ LDFLAGS="-install_name libbase.6.2.1.dylib $LDFLAGS $SHLIBFLAGS"
+ { echo "$as_me:$LINENO: checking whether compiler understands option
-install_name" >&5
+echo $ECHO_N "checking whether compiler understands option -install_name...
$ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
signature.asc
Description: PGP signature
_______________________________________________
