Find the answer to your Linux question:
Results 1 to 3 of 3
I compiled and built a static library with g77, then when I try to link a test case with it none of the library calls in the test case can ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2004
    Posts
    2

    g77 linking problem with static library (mingwin worked)


    I compiled and built a static library with g77, then when I try to link a test case with it none of the library calls in the test case can be satisfied. This is Suse 9.0

    I have also tried all of the -fcase-lower -fno-underscoring -fno-second-underscore combinations also. Nothing works. Does anybody have any idea what is wrong.

    This makefile worked fine on Mingwin. ''


    **************************************************
    Here is the fragment of the program being linked:
    **************************************************

    PROGRAM FC000000
    IMPLICIT REAL*8 (A-H,O-Z)
    COMMON /FC3000/MAXB,IBUC(2,5000)
    REAL*8 DBUC(5000)
    CHARACTER*4 CBUC(2,5000)
    EQUIVALENCE (IBUC(1,1),DBUC(1))
    EQUIVALENCE (CBUC(1,1),IBUC(1,1))
    REAL RTIMES(2),RSTART,REND
    COMMON /FC3007/ MVDT,NVDT,KVDT,VDT(2,1000)
    COMMON/FC3001/NUN(22),NGRAFS,KDEBUG,INITA,INITB, INITC,INIT
    CALL DTIME(RTIMES,RSTART)
    MAXB=5000
    MVDT=1000
    '' CALL FC0001(1000,"EJECT",1)
    CALL EJECT
    CALL DTIME(RTIMES,REND)
    PRINT 999, REND-RSTART
    999 FORMAT(" ELAPSED TIME = ",F7.2," SECONDS")
    IF(NGRAFS.GT.0) CALL EXIT(7)
    END
    SUBROUTINE EJECT
    IMPLICIT REAL*8 (A-H,O-Z)
    EXTERNAL FAJAX
    INCLUDE 'GLOBALS.FOR'
    DATA IFCN/0/
    '' IF(IFCN.EQ.0) CALL FCNAME('EJECT ',IFCN) )
    SMASS=7
    G=32.2
    CD=1
    VE=40
    THETAD=15
    TIME=1.0
    S=10
    Y1=4
    VA=100
    DO 90001 I=1,6
    H=ALT(I)
    IT=0
    '' PLANE='PLANE'//FCSINT(I)


    :::


    ************************************************** ***
    Here is the command compile-link command with verbose expansion:
    ************************************************** ***

    g77 -v -g -fno-automatic -fcase-upper -w -I/home/bear/MC7/forcal/common -L. -ldfc -L/usr/local/dislin -ldislin -lc -o eject eject.for
    Driving: g77 -v -g -fno-automatic -fcase-upper -w -I/home/bear/MC7/forcal/common -L. -ldfc -L/usr/local/dislin -ldislin -lc -o eject eject.for -lfrtbegin -lg2c -lm -shared-libgcc
    Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.1/specs
    Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --enable-languages=c,c++,f77,objc,java,ada --disable-checking --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit i586-suse-linux
    Thread model: posix
    gcc version 3.3.1 (SuSE Linux)
    /usr/lib/gcc-lib/i586-suse-linux/3.3.1/f771 eject.for -quiet -dumpbase eject.for -auxbase eject -g -w -version -fno-automatic -fcase-upper -I/home/bear/MC7/forcal/common -o /tmp/cczBokoM.s
    GNU F77 version 3.3.1 (SuSE Linux) (i586-suse-linux)
    compiled by GNU C version 3.3.1 (SuSE Linux).
    GGC heuristics: --param ggc-min-expand=60 --param ggc-min-heapsize=56245
    /usr/lib/gcc-lib/i586-suse-linux/3.3.1/../../../../i586-suse-linux/bin/as -V -Qy -o /tmp/ccbyFzpl.o /tmp/cczBokoM.s
    GNU assembler version 2.14.90.0.5 (i586-suse-linux) using BFD version 2.14.90.0.5 20030722 (SuSE Linux)
    /usr/lib/gcc-lib/i586-suse-linux/3.3.1/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o eject /usr/lib/gcc-lib/i586-suse-linux/3.3.1/../../../crt1.o /usr/lib/gcc-lib/i586-suse-linux/3.3.1/../../../crti.o /usr/lib/gcc-lib/i586-suse-linux/3.3.1/crtbegin.o -L. -L/usr/local/dislin -L/usr/lib/gcc-lib/i586-suse-linux/3.3.1 -L/usr/lib/gcc-lib/i586-suse-linux/3.3.1/../../../../i586-suse-linux/lib -L/usr/lib/gcc-lib/i586-suse-linux/3.3.1/../../.. -ldfc -ldislin -lc /tmp/ccbyFzpl.o -lfrtbegin -lg2c -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc-lib/i586-suse-linux/3.3.1/crtend.o /usr/lib/gcc-lib/i586-suse-linux/3.3.1/../../../crtn.o
    /tmp/ccbyFzpl.o(.text+0x3e): In function `MAIN__':
    /home/bear/MC7/forcal/eject.for:14: undefined reference to `FC0001_' ''
    /tmp/ccbyFzpl.o(.text+0xd4): In function `EJECT_':
    /home/bear/MC7/forcal/eject.for:26: undefined reference to `FCNAME_' ''
    /tmp/ccbyFzpl.o(.text+0x20c):/home/bear/MC7/forcal/eject.for:39: undefined reference to `FCSINT_' ''

    :::
    etcetera
    :::

    /tmp/ccbyFzpl.o(.text+0x32b):/home/bear/MC7/forcal/
    collect2: ld returned 1 exit status
    make: *** [eject] Error 1



    **************************************************
    Here is the listing fragment of the static library, note that all of the undefined routines appear:
    **************************************************

    bear@polaris:~/MC7/forcal> ar -tv libdfc.a
    rw-r--r-- 502/100 2156 Nov 3 15:23 2004 fca101.o
    :::
    rw-r--r-- 502/100 16300 Nov 3 15:23 2004 fc0001.o ''
    :::
    rw-r--r-- 502/100 4080 Nov 3 15:23 2004 fcname.o ''
    :::
    rw-r--r-- 502/100 7596 Nov 3 15:23 2004 fcsint.o
    ''
    bear@polaris:~/MC7/forcal>



    ************************************************** **
    Here is the fragment of the make file used to create the library. The library is the merge of a set of sublibraries generated by submake files which are generated by the MAKELIB definition.

    The last g77 command line in the makefile is the one that failed above
    ************************************************** **

    #*------------------------------*
    #* Fortran Library Dependencies *
    #*------------------------------*
    INCLUDES = fc4565.for cadam.for cajax.for capollo.for \
    cargus.for cathena.for catlas.for cceres.for \
    ccronus.for cdemeter.for cdiana.for chalist.for \
    chelios.for chera.for chercule.for cjanus.for \
    cjove.for cjupiter.for ckronos.for cmercury.for \
    cmerlin.for cminerva.for cneptune.for codin.for \
    cpegasus.for csaturn.for cselene.for cthor.for \
    cvesta.for fc3000.for fc3001.for fc3001a.for \
    fc3002.for fc3002a.for fc3003.for fc3004.for \
    fc3005.for fc3005a.for fc3005b.for fc3006.for \
    fc3007.for fc3008.for fc3009.for fc3010.for \
    fc3011.for fc3012.for fc3013.for fc3015.for \
    fc3099.for fc4001.for fc4002.for fc4002a.for \
    fc4002b.for fc4002c.for fc4002d.for fc4002e.for \
    fc4002f.for fc4002g.for fc4002h.for fc4002i.for \
    fc4003.for fc4005.for fc4006.for fc4007.for \
    fc4008.for fc4020.for fc4022.for fc4038.for \
    fc4057.for fc4058.for fc4059.for fc4060.for \
    fc4077.for fc4100.for fc4101.for fc4102.for \
    fc4103.for fc4104.for fc4105.for fc4106.for \
    fc4107.for fc4108.for fc4109.for fc4110.for \
    fc4111.for fc4112.for fc4321.for fc4565.for \
    fc5000.for

    #*-----------*
    #* Libraries *
    #*-----------*
    LIBADSLIB = $(HOMEDIR)/lib/finders2/adslib/libadslib.a
    LIBDTADK = $(HOMEDIR)/vm/dtools/adk/libdtadk.a
    LIBDTCTK = $(HOMEDIR)/vm/dtools/ctk/libdtctk.a
    LIBDTSIK = $(HOMEDIR)/vm/dtools/sik/libdtsik.a
    LIBDTSMK = $(HOMEDIR)/vm/dtools/smk/libdtsmk.a
    LIBDTSUK = $(HOMEDIR)/vm/dtools/suk/libdtsuk.a
    LIBERRORS = $(HOMEDIR)/errors/liberrors.a
    LIBFINDERS1 = $(HOMEDIR)/lib/finders1/libfinders1.a
    LIBFINDERS2 = $(HOMEDIR)/lib/finders2/libfinders2.a
    LIBGRAPHIX = $(HOMEDIR)/lib/graphix/libgraphix.a
    #LIBGRAPFILE = $(HOMEDIR)/lib/grapfile/libgrapfile.a
    LIBINTEGRAT = $(HOMEDIR)/lib/integrat/libintegrat.a
    LIBQUADRA = $(HOMEDIR)/lib/quadra/libquadra.a
    LIBUTILITYS = $(HOMEDIR)/lib/utilitys/libutilitys.a
    LIBVMADK = $(HOMEDIR)/vm/vm/adk/libvmadk.a
    LIBVMAOK = $(HOMEDIR)/vm/vm/aok/libvmaok.a
    LIBVMCTK = $(HOMEDIR)/vm/vm/ctk/libvmctk.a
    LIBVMRGK = $(HOMEDIR)/vm/vm/rgk/libvmrgk.a
    LIBVMSIK = $(HOMEDIR)/vm/vm/sik/libvmsik.a
    LIBVMSMK = $(HOMEDIR)/vm/vm/smk/libvmsmk.a
    LIBVMUTK = $(HOMEDIR)/vm/vm/utk/libvmutk.a

    LIBS = $(LIBADSLIB) $(LIBDTADK) $(LIBDTCTK) $(LIBDTSIK) \
    $(LIBDTSMK) $(LIBDTSUK) $(LIBERRORS) $(LIBFINDERS1) \
    $(LIBFINDERS2) $(LIBGRAPHIX) $(LIBINTEGRAT) \
    $(LIBQUADRA) $(LIBUTILITYS) $(LIBVMADK) $(LIBVMAOK) \
    $(LIBVMCTK) $(LIBVMRGK) $(LIBVMSIK) $(LIBVMSMK) \
    $(LIBVMUTK)

    #FCPGM = dummy.exe
    FCPGM = % #

    #*---------------*
    #* Build Library *
    #*---------------*
    G77OBLIST = $$(patsubst %.for,%.o,$$(wildcard *.for))
    GCCOBLIST = $$(patsubst %.c,%.o,$$(wildcard *.c))

    #*-----------------------------------------*
    #* G77 must not use automatic variables *
    #* and must treat all syntax as uppercase. *
    #*-----------------------------------------*
    #G77OPTS = -g -fno-automatic -fcase-upper -fno-underscoring -fno-second-underscore -w
    G77OPTS = -g -fno-automatic -fcase-upper -w

    define MAKELIB
    @echo Library $(notdir $(1))
    @echo 'LIB = $(notdir $(1))' > $(dir $(1))makefile
    @echo 'VPATH = $(HOMEDIR)/common' >> $(dir $(1))makefile
    @echo 'INCLUDES = $(INCLUDES)' >> $(dir $(1))makefile
    @echo 'OBS := $(G77OBLIST) $(GCCOBLIST)' >> $(dir $(1))makefile
    @echo 'G77OPTS = $(G77OPTS) -I$$(VPATH)' >> $(dir $(1))makefile
    @echo 'G77OBJ = @g77 -c $$(G77OPTS)' >> $(dir $(1))makefile
    @echo 'GCCOPTS = -g -w' >> $(dir $(1))makefile
    @echo 'GCCOBJ = @gcc -c $$(GCCOPTS)' >> $(dir $(1))makefile
    @echo '.SUFFIXES : .c .for .o' >> $(dir $(1))makefile
    @echo '.for.o : ' >> $(dir $(1))makefile
    @echo 'ifeq ($$(MAKELEVEL),0)' >> $(dir $(1))makefile
    @echo -e '\t\t@echo $$<' >> $(dir $(1))makefile
    @echo 'endif' >> $(dir $(1))makefile
    @echo -e '\t$$(G77OBJ) $$<' >> $(dir $(1))makefile
    @echo '.c.o : ' >> $(dir $(1))makefile
    @echo 'ifeq ($$(MAKELEVEL),0)' >> $(dir $(1))makefile
    @echo -e '\t\t@echo $$<' >> $(dir $(1))makefile
    @echo 'endif' >> $(dir $(1))makefile
    @echo -e '\t$$(GCCOBJ) $$<' >> $(dir $(1))makefile
    @echo '$$(LIB) : $$(OBS) $$(INCLUDES)' >> $(dir $(1))makefile
    @echo -e '\t@ar rs $$(LIB) $$(OBS)' >> $(dir $(1))makefile
    @echo 'clean : ; @rm -f *.o *.a *.bak *.exe *.*~' >> $(dir $(1))makefile
    @cd $(dir $(1)); $(MAKE) -s $(MAKEFLAGS)
    endef

    system : fctran libdfc.a

    fctran : $(wildcard $(HOMEDIR)/tran/*.for)
    @echo Program $(notdir $@)
    @cd tran; $(MAKE) -s $(MAKEFLAGS)
    @cp tran/fctran .

    libdfc.a : $(LIBS)
    @echo Library $(notdir $@)
    @ar rus libdfc.a $(foreach lib,$(LIBS),$(dir $(lib))*.o)

    $(LIBADSLIB) : $(dir $(LIBADSLIB))*.for; $(call MAKELIB,$@)
    $(LIBDTADK) : $(dir $(LIBDTADK))*.for; $(call MAKELIB,$@)
    $(LIBDTCTK) : $(dir $(LIBDTCTK))*.for; $(call MAKELIB,$@)
    $(LIBDTSIK) : $(dir $(LIBDTSIK))*.for; $(call MAKELIB,$@)
    $(LIBDTSMK) : $(dir $(LIBDTSMK))*.for; $(call MAKELIB,$@)
    $(LIBDTSUK) : $(dir $(LIBDTSUK))*.for; $(call MAKELIB,$@)
    $(LIBERRORS) : $(dir $(LIBERRORS))*.for; $(call MAKELIB,$@)
    $(LIBFINDERS1) : $(dir $(LIBFINDERS1))*.for; $(call MAKELIB,$@)
    $(LIBFINDERS2) : $(dir $(LIBFINDERS2))*.for; $(call MAKELIB,$@)
    $(LIBGRAPHIX) : $(dir $(LIBGRAPHIX))*.for; $(call MAKELIB,$@)
    #$(LIBGRAPFILE) : $(dir $(LIBGRAPFILE))*.for; $(call MAKELIB,$@)
    $(LIBINTEGRAT) : $(dir $(LIBINTEGRAT))*.for; $(call MAKELIB,$@)
    $(LIBQUADRA) : $(dir $(LIBQUADRA))*.for; $(call MAKELIB,$@)
    $(LIBUTILITYS) : $(dir $(LIBUTILITYS))*.for; $(call MAKELIB,$@)
    $(LIBVMADK) : $(dir $(LIBVMADK))*.for; $(call MAKELIB,$@)
    $(LIBVMAOK) : $(dir $(LIBVMAOK))*.for; $(call MAKELIB,$@)
    $(LIBVMCTK) : $(dir $(LIBVMCTK))*.for; $(call MAKELIB,$@)
    $(LIBVMRGK) : $(dir $(LIBVMRGK))*.for; $(call MAKELIB,$@)
    $(LIBVMSIK) : $(dir $(LIBVMSIK))*.for; $(call MAKELIB,$@)
    $(LIBVMSMK) : $(dir $(LIBVMSMK))*.for; $(call MAKELIB,$@)
    $(LIBVMUTK) : $(dir $(LIBVMUTK))*.for; $(call MAKELIB,$@)

    $(foreach lib,$(LIBS),$(lib)-clean) :
    @cd $(@D); rm -f *.o *.a *.bak *.*~ makefile

    clean : $(foreach LIB,$(LIBS),$(LIB)-clean)
    @cd tran; $(MAKE) -s clean
    @rm -f *.a *.bak *.exe

    %.fc : # dummy rule

    $(FCPGM) :: %.fc fctran libdfc.a
    @echo $*.fc
    @./fctran $*.fc
    g77 -v $(G77OPTS) -I$(VPATH) -L. -ldfc -L$(DISLIN) -ldislin -lc -o $@ $*.for

  2. #2
    Linux Guru
    Join Date
    Mar 2003
    Location
    Wisconsin
    Posts
    1,907
    Man, that is some seriously archaic looking code.

    Thanks god for C

    Sorry I can't help, though.
    Jeremy
    Registered Linux user #346571
    "All The Dude ever wanted was his rug back" - The Dude

  3. #3
    Just Joined!
    Join Date
    Nov 2004
    Posts
    2

    This is generated FORTRAN code.

    C is an algorithmic language. This code was generated from a higher order meta-calculus language--a metaphoric language containing operators for optimization and simulation. The API (library) performs automatic differentiation, which in this case differentiates integration algorithms that integrate the differential equations of motion. The example is a pilot-ejection problem solved as a two point boundary value problem. It would be a major challenge for anyone to program this problem in C. ''

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •