Menu

undefined reference to `__gfortran_st_write`

Help
kguy
2010-02-24
2012-09-15
  • kguy

    kguy - 2010-02-24

    Hi,

    I just installed itpp-4.0.7 on cygwin 1.7.1 (win7 64). I also installed the
    itpp-external-3.2.0

    When compiling and linking as described in point 4 here
    http://itpp.sourceforge.net/current/installation.html
    get the following
    error message.

    $ make
    g++ `/usr/local/bin/itpp-config --debug --cflags` example.cpp -o example_debug  `/usr/local/bin/itpp-config --debug --static --libs`
    /usr/local/lib/liblapack.a(xerbla.o):xerbla.f:(.text+0x3f): undefined reference to `__gfortran_st_write'
    /usr/local/lib/liblapack.a(xerbla.o):xerbla.f:(.text+0x5a): undefined reference to `__gfortran_transfer_character'
    /usr/local/lib/liblapack.a(xerbla.o):xerbla.f:(.text+0x75): undefined reference to `__gfortran_transfer_integer'
    /usr/local/lib/liblapack.a(xerbla.o):xerbla.f:(.text+0x7d): undefined reference to `__gfortran_st_write_done'
    /usr/local/lib/liblapack.a(xerbla.o):xerbla.f:(.text+0x89): undefined reference to `__gfortran_stop_numeric'
    /usr/local/lib/liblapack.a(ilaenv.o):ilaenv.f:(.text+0x6e): undefined reference to `__gfortran_compare_string'
    /usr/local/lib/liblapack.a(ilaenv.o):ilaenv.f:(.text+0x9a): undefined reference to `__gfortran_compare_string'
    /usr/local/lib/liblapack.a(ilaenv.o):ilaenv.f:(.text+0xc6): undefined reference to `__gfortran_compare_string'
    /usr/local/lib/liblapack.a(ilaenv.o):ilaenv.f:(.text+0xf2): undefined reference to `__gfortran_compare_string'
    /usr/local/lib/liblapack.a(ilaenv.o):ilaenv.f:(.text+0x11e): undefined reference to `__gfortran_compare_string'
    /usr/local/lib/liblapack.a(ilaenv.o):ilaenv.f:(.text+0x146): more undefined references to `__gfortran_compare_string' follow
    /usr/local/lib/liblapack.a(dhseqr.o):dhseqr.f:(.text+0x7df): undefined reference to `__gfortran_concat_string'
    /usr/local/lib/liblapack.a(liblapack_noopt_la-dlamch.o):dlamch.f:(.text+0xcb8): undefined reference to `__gfortran_st_write'
    /usr/local/lib/liblapack.a(liblapack_noopt_la-dlamch.o):dlamch.f:(.text+0xcd6): undefined reference to `__gfortran_transfer_integer'
    /usr/local/lib/liblapack.a(liblapack_noopt_la-dlamch.o):dlamch.f:(.text+0xce4): undefined reference to `__gfortran_st_write_done'
    /usr/local/lib/liblapack.a(zhseqr.o):zhseqr.f:(.text+0x3b5): undefined reference to `__gfortran_concat_string'
    /usr/local/lib/liblapack.a(dtrtri.o):dtrtri.f:(.text+0x466): undefined reference to `__gfortran_concat_string'
    /usr/local/lib/liblapack.a(ztrtri.o):ztrtri.f:(.text+0x413): undefined reference to `__gfortran_concat_string'
    /usr/local/lib/liblapack.a(zlaqr0.o):zlaqr0.f:(.text+0x1827): undefined reference to `_csqrt'
    /usr/local/lib/liblapack.a(zlahqr.o):zlahqr.f:(.text+0xd43): undefined reference to `_csqrt'
    /usr/local/lib/liblapack.a(zlahqr.o):zlahqr.f:(.text+0xd87): undefined reference to `_csqrt'
    /usr/local/lib/liblapack.a(zlahqr.o):zlahqr.f:(.text+0xebf): undefined reference to `_csqrt'
    /usr/local/lib/liblapack.a(zlaqr4.o):zlaqr4.f:(.text+0x17f5): undefined reference to `_csqrt'
    collect2: ld returned 1 exit status
    make: *** [example] Error 1
    

    Here is my makefile

     FLAGS_DEBUG = `/usr/local/bin/itpp-config --debug --cflags`
    FLAGS_OPT   = `/usr/local/bin/itpp-config --cflags`
    
    LIBS_DEBUG  = `/usr/local/bin/itpp-config --debug --static --libs`
    LIBS_OPT    = `/usr/local/bin/itpp-config --static --libs`
    
    example: example.cpp
        g++ $(FLAGS_DEBUG) example.cpp -o example_debug  $(LIBS_DEBUG)
        g++ $(FLAGS_OPT) example.cpp -o example_opt  $(LIBS_OPT)
    

    Thanks for any hint.

    GA

     
  • Bogdan Cristea

    Bogdan Cristea - 2010-02-24

    It seems that there is an issue with your gfortran compiler. Have you
    installed gfortran for cygwin and its development package ?

    Also, instead of using itpp-external-3.2.0 you could try to install lapack and
    fftw from cygwin, this approach works for me with no errors.

     
  • kguy

    kguy - 2010-02-24

    BTW here is itpp configuration

    ------------------------------------------------------------------------------
    itpp-4.0.7 library configuration:
    ------------------------------------------------------------------------------
    
    Directories:
    
      - prefix ......... : /usr/local
      - exec_prefix .... : ${prefix}
      - includedir ..... : ${prefix}/include
      - libdir ......... : ${exec_prefix}/lib
      - datarootdir .... : ${prefix}/share
      - docdir ......... : ${datarootdir}/doc/${PACKAGE_TARNAME}
    
    Switches:
    
      - debug .......... : yes
      - exceptions ..... : no
      - html-doc ....... : yes
      - shared ......... : no
      - static ......... : yes
      - explicit deps .. : yes
      - zdotu .......... : zdotusub
    
    Documentation tools:
    
      - doxygen ........ : yes
      - latex .......... : yes
      - dvips .......... : yes
      - ghostscript .... : yes
    
    Testing tools:
    
      - diff ........... : yes
    
    Optional modules:
    
      - comm ........... : yes
      - fixed .......... : yes
      - optim .......... : yes
      - protocol ....... : yes
      - signal ......... : yes
      - srccode ........ : yes
    
    External libs:
    
      - BLAS ........... : yes
        * MKL .......... : no
        * ACML ......... : no
        * ATLAS ........ : no
      - LAPACK ......... : yes
      - FFT ............ : yes
        * MKL .......... : no
        * ACML ......... : no
        * FFTW ......... : yes
    
    Compiler/linker flags/libs/defs:
    
      - CXX ............ : g++
      - F77 ............ : g77
      - CXXFLAGS ....... : -DNDEBUG -O3 -pipe
      - CXXFLAGS_DEBUG . : -Wall -ggdb -pipe
      - CPPFLAGS ....... : 
      - LDFLAGS ........ : 
      - LIBS ........... : -lfftw3 -llapack -lblas
    
    ------------------------------------------------------------------------------
    Now type 'make && make install' to build and install itpp-4.0.7 library
    ------------------------------------------------------------------------------
    
     
  • kguy

    kguy - 2010-02-24

    @cristeab

    Hi thanks for your answer

    gfortran seems to be installed properly

    $ gfortran -v
    Using built-in specs.
    Target: i686-pc-cygwin
    Configured with: /gnu/gcc/releases/packaging/4.3.4-3/gcc4-4.3.4-3/src/gcc-4.3.4/configure --srcdir=/gnu/gcc/releases/packaging/4.3.4-3/gcc4-4.3.4-3/src/gcc-4.3.4 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --datadir=/usr/share
     --localstatedir=/var --sysconfdir=/etc --infodir=/usr/share/info --mandir=/usr/share/man --datadir=/usr/share --infodir=/usr/share/info --mandir=/usr/share/man -v --with-gmp=/usr --with-mpfr=/usr --enable-bootstrap --enable-version-specific-runtime-libs --with-slibdir=/usr/
    bin --libexecdir=/usr/lib --enable-static --enable-shared --enable-shared-libgcc --disable-__cxa_atexit --with-gnu-ld --with-gnu-as --with-dwarf2 --disable-sjlj-exceptions --enable-languages=ada,c,c++,fortran,java,objc,obj-c++ --disable-symvers --enable-libjava --program-suf
    fix=-4 --enable-libgomp --enable-libssp --enable-libada --enable-threads=posix --with-arch=i686 --with-tune=generic --enable-libgcj-sublibs CC=gcc-4 CXX=g++-4 CC_FOR_TARGET=gcc-4 CXX_FOR_TARGET=g++-4 GNATMAKE_FOR_TARGET=gnatmake GNATBIND_FOR_TARGET=gnatbind AS=/opt/gcc-tools
    /bin/as.exe AS_FOR_TARGET=/opt/gcc-tools/bin/as.exe LD=/opt/gcc-tools/bin/ld.exe LD_FOR_TARGET=/opt/gcc-tools/bin/ld.exe --with-ecj-jar=/usr/share/java/ecj.jar
    Thread model: posix
    gcc version 4.3.4 20090804 (release) 1 (GCC)
    
    gkamendje@Thales ~/Projects/WideSail/ITPP/itpp-4.0.7
    $ which gfortran
    /usr/bin/gfortran
    
    gkamendje@Thales ~/Projects/WideSail/ITPP/itpp-4.0.7
    $
    

    I did a full installation of cygwin and I though that all the lib and lib-dev
    package were installed. I will try to manually install those again.

    GA

    Thanks

     
  • kguy

    kguy - 2010-02-26

    gfortran is correctly installed and I can compile and link fortran programs
    with call to lapack routines using gfortran

    gkamendje@Thales ~/Projects/WideSail/ITPP
    $ gfortran --version
    GNU Fortran (GCC) 4.3.4 20090804 (release) 1
    Copyright (C) 2008 Free Software Foundation, Inc.
    
    GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
    You may redistribute copies of GNU Fortran
    under the terms of the GNU General Public License.
    For more information about these matters, see the file named COPYING
    
    
    gkamendje@Thales ~/Projects/WideSail/ITPP
    $ gfortran  -o test test.for -llapack
    
    gkamendje@Thales ~/Projects/WideSail/ITPP
    $ ./test.exe
     Testing a lapack sub routine was successfull:
    
    gkamendje@Thales ~/Projects/WideSail/ITPP
    $
    

    I used the following line to configure make and install

    ./configure --disable-shared --enable-static --enable-debug F77=gfortran &&
    make && make check && make install

    everything was OK. But still I am not able to compile the sample code.

    Plz help

    GA

     
  • Adam Piątyszek

    Adam Piątyszek - 2010-02-26

    Hi GA,

    I think your local installation of LAPACK in /usr/local/lib is somehow broken.
    At least the static library. I recommend you to remove all the files from
    itpp-external package installation and try with LAPACK and FFTW provided by
    Cygwin. The itpp-external package is only recommended when native LAPACK, BLAS
    and FFTW libraries are not available.

    If this still won't help, please try to use shared linking instead of static.

    BR,

    /Adam

     
  • kguy

    kguy - 2010-02-26

    @ediap

    Thanks for the hint. That solved the problem. the LAPACK installation in
    /usr/local/lib (from itpp-external package) was indeed broken. I deleted it
    and relied on the LAPACK and FFTW packages provided by Cygwin. Here is what I
    did

    1) deleted all LAPACK and FFTW libraries in /usr/local/lib

    2) use the following to configure build and install (I enabled both shared and
    static since I was not sure that the problem was related to the static
    linking)

    (./configure --enable-shared --enable-static --enable-debug F77=gfortran &&
    make && make check && make install) > compile.log

    3) Build and executed the test program as described in point 4 @ http://itpp.
    sourceforge.net/current/installation.html
    (itpp.sourceforge.net)

    every thing was just fine!!

    I still do not understand why using the itpp-external the installation routine
    reports that all tests passed meanwhile compiling and linking even the
    simplest program does not work. I though that the installation would link all
    tests routines against those libraries and hence assert that they are properly
    configured. I am certainly missing something here.

    BR

    GA

     

Log in to post a comment.

MongoDB Logo MongoDB