bug-libtool
[Top][All Lists]
Advanced

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

Problem with Fortran shared libraries on OSX/Darwin


From: Tim Jenness
Subject: Problem with Fortran shared libraries on OSX/Darwin
Date: Thu, 2 Sep 2004 13:35:41 -1000 (HST)

I'm trying to build Fortran shared libraries on OSX/Darwin [Panther] using
fink g77 v3.4.0 and libtool v1.5.8. The new libtool works fine so long as
you are only building a single shared library and then linking it using
the C compiler. Any attempt to link a shared library with the fortran
compiler or linking two fortran libraries with the C compiler fails
because of duplicated internal g77 symbols.

The problem is that unlike the g++ section of libtool, -nostdlib is not 
included in the shared library creation command AND on fink the g77 
library is static (libg77.a) rather than shared and so is hard-wired into 
each shared library.

It seems to work on linux purely because libg77 is a shared library on 
most linux systems.

I think that it makes sense to fix the generic g77 link options to include 
-nostdlib but I'm not sure how to go about building a patch to do that.
In the short term this patch specifically fixes the OSX/Darwin problem
(also attached in case of line wrapping problems):


--- libtool.m4.ori      Thu Sep  2 11:53:02 2004
+++ libtool.m4  Thu Sep  2 11:54:44 2004
@@ -5407,11 +5407,11 @@
        output_verbose_link_cmd='echo'
        if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
          lt_int_apple_cc_single_mod=yes
        fi
        if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
-         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module 
$allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name 
$rpath/$soname $verstring'
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -nostdlib 
-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags 
-install_name $rpath/$soname $verstring'
        else
         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load 
-keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib 
$allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags 
-install_name $rpath/$soname $verstring'
       fi
       _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load 
$allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
       # Don't fix this by using the ld -exported_symbols_list flag, it doesn't 
exist in older darwin ld's


I hope this patch (or something like it) can be applied for the next 
release.

Thanks

-- 
Tim Jenness
JAC software
http://www.jach.hawaii.edu/~timj

Attachment: libtool.patch
Description: Text document


reply via email to

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