autoconf
[Top][All Lists]
Advanced

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

Fortran vs. OS X


From: John W. Eaton
Subject: Fortran vs. OS X
Date: Fri, 25 Jul 2003 14:07:02 -0500

While trying to configure Octave on an OS X system, I ran into the
following problem:

checking for Fortran 77 libraries...  -lcrt1.o 
-L/opt/local/lib/gcc-lib/powerpc-apple-darwin6.6/3.2.2 
-L/opt/local/lib/gcc-lib/powerpc-apple-darwin6.6/3.2.2/../../.. -lm -lfrtbegin 
-lg2c -lSystem
checking for dummy main to link with Fortran 77 libraries... unknown
configure: error: Linking to Fortran libraries from C fails.

Looking at config.log, I see

configure:5926: gcc -o conftest -g -O2   conftest.c -lm   -lcrt1.o 
-L/opt/local/lib/gcc-lib/powerpc-apple-darwin6.6/3.2.2 
-L/opt/local/lib/gcc-lib/powerpc-apple-darwin6.6/3.2.2/../../.. -lm -lfrtbegin 
-lg2c -lSystem >&5
ld: multiple definitions of symbol _NXArgc
/usr/lib/crt1.o definition of _NXArgc in section (__DATA,__data)
/usr/lib/crt1.o definition of _NXArgc in section (__DATA,__data)
ld: multiple definitions of symbol _NXArgv
/usr/lib/crt1.o definition of _NXArgv in section (__DATA,__data)
/usr/lib/crt1.o definition of _NXArgv in section (__DATA,__data)
ld: multiple definitions of symbol ___progname
/usr/lib/crt1.o definition of ___progname in section (__DATA,__data)
/usr/lib/crt1.o definition of ___progname in section (__DATA,__data)
ld: multiple definitions of symbol __dyld_func_lookup
/usr/lib/crt1.o private external definition of __dyld_func_lookup in section 
(__TEXT,__text)
/usr/lib/crt1.o private external definition of __dyld_func_lookup in section 
(__TEXT,__text)
ld: multiple definitions of symbol __dyld_init_check
/usr/lib/crt1.o private external definition of __dyld_init_check in section 
(__TEXT,__text)
/usr/lib/crt1.o private external definition of __dyld_init_check in section 
(__TEXT,__text)
ld: multiple definitions of symbol __start
/usr/lib/crt1.o private external definition of __start in section 
(__TEXT,__text)
/usr/lib/crt1.o private external definition of __start in section 
(__TEXT,__text)
ld: multiple definitions of symbol _environ
/usr/lib/crt1.o definition of _environ in section (__DATA,__data)
/usr/lib/crt1.o definition of _environ in section (__DATA,__data)
ld: multiple definitions of symbol dyld_stub_binding_helper
/usr/lib/crt1.o private external definition of dyld_stub_binding_helper in 
section (__TEXT,__text)
/usr/lib/crt1.o private external definition of dyld_stub_binding_helper in 
section (__TEXT,__text)
ld: multiple definitions of symbol start
/usr/lib/crt1.o definition of start in section (__TEXT,__text)
/usr/lib/crt1.o definition of start in section (__TEXT,__text)
configure:5929: $? = 1

The problem seems to be that gcc adds -lcrt1.o to the link command and
listing it a second time causes the above errors.  The following patch
avoids the problem:


2003-07-25  John W. Eaton  <address@hidden>

        * lib/autoconf/fortran.m4 (AC_F77_LIBRARY_LDFLAGS): Also ignore
        -lcrt1.o, for OS X.


Index: fortran.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/fortran.m4,v
retrieving revision 1.165
diff -u -r1.165 fortran.m4
--- fortran.m4  22 May 2003 15:17:05 -0000      1.165
+++ fortran.m4  25 Jul 2003 17:56:45 -0000
@@ -487,7 +487,7 @@
             [_AC_LINKER_OPTION([$ac_arg], ac_cv_flibs)])
          ;;
          # Ignore these flags.
-       -lang* | -lcrt0.o | -lc | -lgcc | -libmil | -LANG:=*)
+       -lang* | -lcrt[01].o | -lc | -lgcc | -libmil | -LANG:=*)
          ;;
        -lkernel32)
          test x"$CYGWIN" != xyes && ac_cv_flibs="$ac_cv_flibs $ac_arg"




Thanks,

jwe

-- 
www.octave.org        | Unfortunately we were hopelessly optimistic in 1954
www.che.wisc.edu/~jwe | about the problems of debugging FORTRAN programs.
                      |                                       -- J. Backus




reply via email to

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