gfortran Undefined symbols for architecture x86_64

Discussion in 'Mac Programming' started by Darren.Long, Oct 9, 2013.

  1. Darren.Long macrumors newbie

    Joined:
    Oct 9, 2013
    #1
    I am trying to compile a code using gfortran on Mac (it has been compiled on linux machine using intel compiler) But I got the error: Can anyone help? Thanks!

    make tconvert
    make libjulian
    ar rc libjulian.a dates.o format.o juldates.o leapsecs.o parse.o seconds.o tai_et.o utc_tai.o fortran.o rlerrors.o rlmemory.o fjulian.o fstrings.o
    ranlib libjulian.a
    gfortran -v -o tconvert tconvert.for libjulian.a
    Driving: gfortran -mmacosx-version-min=10.8.5 -v -o tconvert tconvert.for libjulian.a -l gfortran -shared-libgcc
    Using built-in specs.
    COLLECT_GCC=gfortran
    COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin12/4.8.1/lto-wrapper
    Target: x86_64-apple-darwin12
    Configured with: ../gcc-4.8.1/configure --prefix=/opt/local --build=x86_64-apple-darwin12 --enable-languages=c,c++,objc,obj-c++,lto,fortran,java --libdir=/opt/local/lib/gcc48 --includedir=/opt/local/include/gcc48 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.8 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.8 --with-gxx-include-dir=/opt/local/include/gcc48/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --disable-cloog-version-check --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --with-pkgversion='MacPorts gcc48 4.8.1_2'
    Thread model: posix
    gcc version 4.8.1 (MacPorts gcc48 4.8.1_2)
    COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.8.5' '-v' '-o' 'tconvert' '-shared-libgcc' '-mtune=core2'
    /opt/local/libexec/gcc/x86_64-apple-darwin12/4.8.1/f951 tconvert.for -ffixed-form -fPIC -quiet -dumpbase tconvert.for -mmacosx-version-min=10.8.5 -mtune=core2 -auxbase tconvert -version -fintrinsic-modules-path /opt/local/lib/gcc48/gcc/x86_64-apple-darwin12/4.8.1/finclude -o /var/folders/d1/pzd74ps96nn7f37m2h2vzr1h0000gn/T//ccHdmBU2.s
    GNU Fortran (MacPorts gcc48 4.8.1_2) version 4.8.1 (x86_64-apple-darwin12)
    compiled by GNU C version 4.8.1, GMP version 5.0.5, MPFR version 3.1.1-p2, MPC version 1.0.1
    warning: GMP header version 5.0.5 differs from library version 5.1.2.
    GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
    GNU Fortran (MacPorts gcc48 4.8.1_2) version 4.8.1 (x86_64-apple-darwin12)
    compiled by GNU C version 4.8.1, GMP version 5.0.5, MPFR version 3.1.1-p2, MPC version 1.0.1
    warning: GMP header version 5.0.5 differs from library version 5.1.2.
    GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
    COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.8.5' '-v' '-o' 'tconvert' '-shared-libgcc' '-mtune=core2'
    /opt/local/bin/as -v -arch x86_64 -force_cpusubtype_ALL -o /var/folders/d1/pzd74ps96nn7f37m2h2vzr1h0000gn/T//ccJlXTCs.o /var/folders/d1/pzd74ps96nn7f37m2h2vzr1h0000gn/T//ccHdmBU2.s
    Apple Inc version cctools-839, GNU assembler version 1.38
    Reading specs from /opt/local/lib/gcc48/gcc/x86_64-apple-darwin12/4.8.1/../../../libgfortran.spec
    rename spec lib to liborig
    COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.8.5' '-v' '-o' 'tconvert' '-shared-libgcc' '-mtune=core2'
    COMPILER_PATH=/opt/local/libexec/gcc/x86_64-apple-darwin12/4.8.1/:/opt/local/libexec/gcc/x86_64-apple-darwin12/4.8.1/:/opt/local/libexec/gcc/x86_64-apple-darwin12/:/opt/local/lib/gcc48/gcc/x86_64-apple-darwin12/4.8.1/:/opt/local/lib/gcc48/gcc/x86_64-apple-darwin12/
    LIBRARY_PATH=/opt/local/lib/gcc48/gcc/x86_64-apple-darwin12/4.8.1/:/opt/local/lib/gcc48/gcc/x86_64-apple-darwin12/4.8.1/../../../:/usr/lib/
    COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.8.5' '-v' '-o' 'tconvert' '-shared-libgcc' '-mtune=core2'
    /opt/local/libexec/gcc/x86_64-apple-darwin12/4.8.1/collect2 -dynamic -arch x86_64 -macosx_version_min 10.8.5 -weak_reference_mismatches non-weak -o tconvert -L/opt/local/lib/gcc48/gcc/x86_64-apple-darwin12/4.8.1 -L/opt/local/lib/gcc48/gcc/x86_64-apple-darwin12/4.8.1/../../.. /var/folders/d1/pzd74ps96nn7f37m2h2vzr1h0000gn/T//ccJlXTCs.o libjulian.a -lgfortran -no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lquadmath -lm -lgcc_ext.10.5 -lgcc -lSystem -v
    collect2 version 4.8.1
    /opt/local/bin/ld -dynamic -arch x86_64 -macosx_version_min 10.8.5 -weak_reference_mismatches non-weak -o tconvert -L/opt/local/lib/gcc48/gcc/x86_64-apple-darwin12/4.8.1 -L/opt/local/lib/gcc48/gcc/x86_64-apple-darwin12/4.8.1/../../.. /var/folders/d1/pzd74ps96nn7f37m2h2vzr1h0000gn/T//ccJlXTCs.o libjulian.a -lgfortran -no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lquadmath -lm -lgcc_ext.10.5 -lgcc -lSystem -v
    @(#)PROGRAM:ld PROJECT:ld64-136
    configured to support archs: i386 x86_64 armv7 armv7s
    Library search paths:
    /opt/local/lib/gcc48/gcc/x86_64-apple-darwin12/4.8.1
    /opt/local/lib/gcc48
    /usr/lib
    /usr/local/lib
    Framework search paths:
    /Library/Frameworks/
    /System/Library/Frameworks/
    Undefined symbols for architecture x86_64:
    "_fjul_etoftai_", referenced from:
    _MAIN__ in ccJlXTCs.o
    "_fjul_jdoftai_", referenced from:
    _MAIN__ in ccJlXTCs.o
    "_fjul_mjdoftai_", referenced from:
    _MAIN__ in ccJlXTCs.o
    "_fjul_taiofdutc_", referenced from:
    _MAIN__ in ccJlXTCs.o
    "_gjul_formatdate_", referenced from:
    _fjul_formatdate_ in libjulian.a(fjulian.o)
    "_gjul_formatpds_", referenced from:
    _fjul_formatpds_ in libjulian.a(fjulian.o)
    "_gjul_formatsql_", referenced from:
    _fjul_formatsql_ in libjulian.a(fjulian.o)
    "_gjul_formattime_", referenced from:
    _fjul_formattime_ in libjulian.a(fjulian.o)
    "_gjul_initleaps_", referenced from:
    _fjul_initleaps_ in libjulian.a(fjulian.o)
    "_gjul_parsedate_", referenced from:
    _fjul_parsedate_ in libjulian.a(fjulian.o)
    "_gjul_parsedt_", referenced from:
    _fjul_parsedt_ in libjulian.a(fjulian.o)
    "_gjul_parsetime_", referenced from:
    _fjul_parsetime_ in libjulian.a(fjulian.o)
    ld: symbol(s) not found for architecture x86_64
    collect2: error: ld returned 1 exit status
    make[1]: *** [tconvert] Error 1
    make: *** [install] Error 2
     
  2. ExitToShell macrumors newbie

    Joined:
    Sep 21, 2013
    #2
    You are trying to make a 64bit executable using 32bit only libraries.
     
  3. the-wanderer macrumors member

    Joined:
    May 5, 2011
    Location:
    twilight zone
    #3
    get the free version of pgfortran
    set the arch flags for your system
     

Share This Page