From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris To: GCC Help Subject: Linking g77 programs (pt2) Date: Mon, 26 Feb 2001 09:51:00 -0000 Message-id: <01022617511300.11374@sac6.sta.man.ac.uk> X-SW-Source: 2001-02/msg00261.html see bottom. ---------- Forwarded Message ---------- Subject: Linking g77 programs Date: Mon, 26 Feb 2001 17:26:27 +0000 From: Chris To: GCC Help To start with I will warn you that I am running redhat 7, which is improving considerably each time I use it and install an update. On reflection I like the way no matter how unstable a UNIX systems supposed to be, it is still rock steady (at least in my case). Anyway I think I have a problem with ld. When I was running redhat 6.1 and presumbably a earlier version of binutils I had no problems doing the following. I've tried doing a few things, but to no avail so far - I'm open for all amazing gobsmacking easy suggestions - I'm bound to have missed something. I used to be able to do this. g77 cstplb.f grdgnc.f and it would produce a linked executable a.out in the standard unix manner. Now when I try it, it spews; I think would be an apt description. I'm thinking that maybe I'm missing some option e.g. -lxxxxx where that's a library, but that should all be handled by g77 being called. Here's what happens. g77 cstplb.f grdgnc.f /tmp/ccYXwoyo.o: In function `MAIN__': /tmp/ccYXwoyo.o(.text+0x0): multiple definition of `MAIN__' /tmp/ccEmR1CQ.o(.text+0x0): first defined here /usr/bin/ld: Warning: size of symbol `MAIN__' changed from 4505 to 3323 in I'm kind of curious as to what happens in the above line. /tmp/ccYXwoyo.o /tmp/ccEmR1CQ.o: In function `MAIN__': /tmp/ccEmR1CQ.o(.text+0x4ab): undefined reference to `groute_' /tmp/ccEmR1CQ.o(.text+0x4b3): undefined reference to `ropen_' /tmp/ccEmR1CQ.o(.text+0x107b): undefined reference to `rclose_' /tmp/ccEmR1CQ.o: In function `pspace_': /tmp/ccEmR1CQ.o(.text+0x11ae): undefined reference to `grpsiz_' /tmp/ccEmR1CQ.o(.text+0x1222): undefined reference to `gvport_' /tmp/ccEmR1CQ.o(.text+0x123a): undefined reference to `gwbox_' /tmp/ccEmR1CQ.o: In function `map_': /tmp/ccEmR1CQ.o(.text+0x1264): undefined reference to `glimit_' /tmp/ccEmR1CQ.o(.text+0x126c): undefined reference to `gscale_' /tmp/ccEmR1CQ.o: In function `mapyl_': /tmp/ccEmR1CQ.o(.text+0x12c6): undefined reference to `glimit_' /tmp/ccEmR1CQ.o(.text+0x12ce): undefined reference to `gscale_' /tmp/ccEmR1CQ.o: In function `mapxl_': /tmp/ccEmR1CQ.o(.text+0x1379): undefined reference to `glimit_' /tmp/ccEmR1CQ.o(.text+0x1381): undefined reference to `gscale_' /tmp/ccEmR1CQ.o: In function `box_': /tmp/ccEmR1CQ.o(.text+0x13ef): undefined reference to `gvect_' /tmp/ccEmR1CQ.o: In function `axessi_': /tmp/ccEmR1CQ.o(.text+0x141d): undefined reference to `box2mm_' /tmp/ccEmR1CQ.o(.text+0x1432): undefined reference to `rtxhei_' /tmp/ccEmR1CQ.o(.text+0x1448): undefined reference to `raxbti_' /tmp/ccEmR1CQ.o(.text+0x145c): undefined reference to `box2mm_' /tmp/ccEmR1CQ.o(.text+0x1479): undefined reference to `raxis_' /tmp/ccEmR1CQ.o(.text+0x149f): undefined reference to `box2mm_' /tmp/ccEmR1CQ.o(.text+0x14b4): undefined reference to `rtxhei_' /tmp/ccEmR1CQ.o(.text+0x14ca): undefined reference to `raxbti_' /tmp/ccEmR1CQ.o(.text+0x14de): undefined reference to `box2mm_' /tmp/ccEmR1CQ.o(.text+0x14fb): undefined reference to `raxis_' /tmp/ccEmR1CQ.o: In function `axeyli_': /tmp/ccEmR1CQ.o(.text+0x152b): undefined reference to `box2mm_' /tmp/ccEmR1CQ.o(.text+0x1540): undefined reference to `rtxhei_' /tmp/ccEmR1CQ.o(.text+0x1556): undefined reference to `raxbti_' /tmp/ccEmR1CQ.o(.text+0x156a): undefined reference to `box2mm_' /tmp/ccEmR1CQ.o(.text+0x159f): undefined reference to `raxis_' /tmp/ccEmR1CQ.o(.text+0x15bb): undefined reference to `raxaxl_' /tmp/ccEmR1CQ.o(.text+0x15d7): undefined reference to `raxlfo_' /tmp/ccEmR1CQ.o(.text+0x1635): undefined reference to `box2mm_' /tmp/ccEmR1CQ.o(.text+0x164a): undefined reference to `rtxhei_' /tmp/ccEmR1CQ.o(.text+0x165f): undefined reference to `raxpat_' /tmp/ccEmR1CQ.o(.text+0x1673): undefined reference to `box2mm_' /tmp/ccEmR1CQ.o(.text+0x1690): undefined reference to `raxis_' /tmp/ccEmR1CQ.o: In function `axexli_': /tmp/ccEmR1CQ.o(.text+0x16c7): undefined reference to `box2mm_' /tmp/ccEmR1CQ.o(.text+0x16dc): undefined reference to `rtxhei_' /tmp/ccEmR1CQ.o(.text+0x16f2): undefined reference to `raxbti_' /tmp/ccEmR1CQ.o(.text+0x1706): undefined reference to `box2mm_' /tmp/ccEmR1CQ.o(.text+0x173b): undefined reference to `raxis_' /tmp/ccEmR1CQ.o(.text+0x1757): undefined reference to `raxaxl_' /tmp/ccEmR1CQ.o(.text+0x1773): undefined reference to `raxlfo_' /tmp/ccEmR1CQ.o(.text+0x17d1): undefined reference to `box2mm_' /tmp/ccEmR1CQ.o(.text+0x17e6): undefined reference to `rtxhei_' /tmp/ccEmR1CQ.o(.text+0x17fb): undefined reference to `raxpat_' /tmp/ccEmR1CQ.o(.text+0x180f): undefined reference to `box2mm_' /tmp/ccEmR1CQ.o(.text+0x182c): undefined reference to `raxis_' /tmp/ccEmR1CQ.o: In function `contia_': /tmp/ccEmR1CQ.o(.text+0x199b): undefined reference to `box2mm_' /tmp/ccEmR1CQ.o(.text+0x19b0): undefined reference to `rtxhei_' /tmp/ccEmR1CQ.o(.text+0x19c3): undefined reference to `rshade_' /tmp/ccEmR1CQ.o(.text+0x19d9): undefined reference to `rclass_' /tmp/ccEmR1CQ.o(.text+0x19f3): undefined reference to `gcnw2s_' /tmp/ccEmR1CQ.o: In function `ptjoin_': /tmp/ccEmR1CQ.o(.text+0x1b54): undefined reference to `gvect_' /tmp/ccEmR1CQ.o: In function `pjoin2_': /tmp/ccEmR1CQ.o(.text+0x1b97): undefined reference to `gvect_' /tmp/ccEmR1CQ.o: In function `ptplot_': /tmp/ccEmR1CQ.o(.text+0x1ce6): undefined reference to `bdimx_' /tmp/ccEmR1CQ.o(.text+0x1cf9): undefined reference to `box2mm_' /tmp/ccEmR1CQ.o(.text+0x1d43): undefined reference to `bpoint_' /tmp/ccEmR1CQ.o: In function `frame_': /tmp/ccEmR1CQ.o(.text+0x1d57): undefined reference to `gempty_' /tmp/ccEmR1CQ.o(.text+0x1d66): undefined reference to `gdiagc_' /tmp/ccEmR1CQ.o(.text+0x1d78): undefined reference to `gdiagc_' /tmp/ccEmR1CQ.o(.text+0x1d80): undefined reference to `gclear_' /tmp/ccEmR1CQ.o: In function `vector_': /tmp/ccEmR1CQ.o(.text+0x224d): undefined reference to `gvect_' collect2: ld returned 1 exit status It seems to me the code compiles okay, but the linker fails - Is there a workaround for this? Thanks, Chris ------------------------------------------------------- It since occurred to me that an output of g77 -v could be useful...so [chris@sac6 chris]$ g77 -v g77 version 2.96 20000731 (Red Hat Linux 7.0) (from FSF-g77 version 0.5.26 20000731 (Red Hat Linux 7.0)) Driving: g77 -v -c -xf77-version /dev/null -xnone Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs gcc version 2.96 20000731 (Red Hat Linux 7.0) /usr/lib/gcc-lib/i386-redhat-linux/2.96/tradcpp0 -lang-fortran -v -D__GNUC__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_i386__ /dev/null /dev/null GNU traditional CPP version 2.96 20000731 (Red Hat Linux 7.0) /usr/lib/gcc-lib/i386-redhat-linux/2.96/f771 -fnull-version -quiet -dumpbase g77-version.f -version -fversion -o /tmp/cc7j3dSM.s /dev/null GNU F77 version 2.96 20000731 (Red Hat Linux 7.0) (i386-redhat-linux) compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.0). GNU Fortran Front End version 0.5.26 20000731 (Red Hat Linux 7.0) as -V -Qy -o /tmp/ccjfMBbU.o /tmp/cc7j3dSM.s GNU assembler version 2.9.5 (i386-redhat-linux) using BFD version 2.9.5.0.31 ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o /tmp/cchVwwUg /tmp/ccjfMBbU.o /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crti.o /usr/lib/gcc-lib/i386-redhat-linux/2.96/crtbegin.o -L/usr/lib/gcc-lib/i386-redhat-linux/2.96 -L/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../.. -lg2c -lm -lgcc -lc -lgcc /usr/lib/gcc-lib/i386-redhat-linux/2.96/crtend.o /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crtn.o /tmp/cchVwwUg __G77_LIBF77_VERSION__: 0.5.26 20000731 (prerelease) @(#)LIBF77 VERSION 19991115 __G77_LIBI77_VERSION__: 0.5.26 20000731 (prerelease) @(#) LIBI77 VERSION pjw,dmg-mods 19991115 __G77_LIBU77_VERSION__: 0.5.26 20000731 (prerelease) @(#) LIBU77 VERSION 19980709