This patch breaks the build of libgfortran on darwin. http://gcc.gnu.org/ml/gcc-cvs/2005-11/msg00601.html -all_load ./.libs/libmatmul.a -lm ./.libs/libmatmul.a -lc -Wl,-single_module -install_name /Volumes/export/gcc/gcc-svn/head/testbin/lib/libgfortran.0.dylib -compatibility_version 1 -current_version 1.0 ld: multiple definitions of symbol __gfortran_matmul_i4 ./.libs/libmatmul.a(libmatmul_la-matmul_i4.o) definition of __gfortran_matmul_i4 in section (__TEXT,__text) ./.libs/libmatmul.a(libmatmul_la-matmul_i4.o) definition of __gfortran_matmul_i4 in section (__TEXT,__text) The reason is that the link command tries to link two times the libmatmul.a which gives the duplicates. Atm, I have not a solution handy, but it seems to me that using convenience library scheme would be the solution. Modifying the libtool and removing the $convenience part in libtools whole_archive_flag_spec makes it link and pass the testsuite. Sorry for not posting a solution right now. Moving pressure :)
As discussed on IRC, the solution is to use noinst_LTLIBRARIES instead of EXTRA_LTLIBRARIES. It was also suggested to name the library libmatmul_convenience.a. Example in libffi/Makefile.am
Patch here: http://gcc.gnu.org/ml/gcc-patches/2005-11/msg01271.html
Unfortunately it does not werk :( I found this message in the libtool archive: http://lists.gnu.org/archive/html/libtool-patches/2004-08/msg00002.html Currently we have this 'whole_archive_flag_spec='-all_load $convenience'' in gcc-root/ltcf-c.sh (for darwin) Is this needed somehwere? Maybe we could remove this -all_load $convenience' entry in the ltcf-c.sh? Geoff? Doing so by hand in the gfortran libtool makes the library link.
It's certainly wrong to be using -all-load unless you're also using -r.
would this snippet be ok? Index: ltcf-c.sh =================================================================== --- ltcf-c.sh (revision 107140) +++ ltcf-c.sh (working copy) @@ -419,7 +419,7 @@ hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='-all_load $convenience' + whole_archive_flag_spec='' link_all_deplibs=yes ;;
On sparc-solaris I get runtime failures: collect2: ld returned 1 exit status^M compiler exited with status 1 output is: Undefined first referenced^M symbol in file^M _gfortran_matmul_r4 /var/tmp//ccKKiCDj.o^M ld: fatal: Symbol referencing errors. No output written to ./matmul_1.exe^M collect2: ld returned 1 exit status^M this is with both, the original libmatmul and with libmatmul_convenience. (using native, sun, as and ld) I try to investigate deeper by next week. If I do not get beaten by others :)
> On sparc-solaris I get runtime failures: > > collect2: ld returned 1 exit status^M > compiler exited with status 1 > output is: > Undefined first referenced^M > symbol in file^M > _gfortran_matmul_r4 /var/tmp//ccKKiCDj.o^M > ld: fatal: Symbol referencing errors. No output written to ./matmul_1.exe^M > collect2: ld returned 1 exit status^M > > this is with both, the original libmatmul and with libmatmul_convenience. > (using native, sun, as and ld) Confirmed with all versions of Solaris.
rth committed a fix to trunk and 4.1: http://gcc.gnu.org/ml/fortran/2005-11/msg00548.html It should now work again on all supported platforms. Unless new problems are reported I'll close this in a few days.
> It should now work again on all supported platforms. Confirmed on all versions of Solaris. Thanks!
With the fix by rth, it seems to work again on Solaris (#9) and Darwin ( http://gcc.gnu.org/ml/fortran/2005-11/msg00571.html ); closing the bug.