Date: Wed, 29 Aug 2001 21:56:20 +0300 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: wsr23 AT Stanford DOT EDU Message-Id: <2427-Wed29Aug2001215619+0300-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9 CC: djgpp AT delorie DOT com In-reply-to: (message from Will Robinson on Wed, 29 Aug 2001 11:24:27 -0700 (PDT)) Subject: Re: linux->dos cross-compiler References: Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > Date: Wed, 29 Aug 2001 11:24:27 -0700 (PDT) > From: Will Robinson > > [wsr23 AT dhcp-197-222 wsr23]$ gcc-dos -v > Reading specs from /opt/djgpp/lib/gcc-lib/i586-pc-msdosdjgpp/3.0.1/specs This looks okay, but what's the contents of this specs file? Also, what does the compiler print under -v when it links a program? I'm specifically looking for the -lfoo switches which it passes to the linker. > Also, if it makes any difference, know that I'm linking with an explicit > "ld-dos" command line, not with gcc-dos itself. Why don't you use gcc-dos? That might be part of your problem. In any case, if you invoke the linker directly, you should mention there crt0.o and the DJGPP linker script. Otherwise the programs might not link correctly. > > Also, note that "-lc -lstdc++ -lgcc" is not what you need to put at > > the end of the link command if GCC doesn't get that by itself. The > > correct list of libraries is "-lc -lgcc -lc" (yes, -lc should appear > > twice, and in the order shown), and for C++ programs it should be > > "-lstdc++ -lm -lc -lgcc -lc". > > Wow! I don't understand why that helped, but it did. It helped because GNU ld is a one-pass linker: if libgcc.a needs tolower, it won't find that because libc.a is before libgcc.a on the command line you used. This is why you generally should use gcc-dos to link: it will automatically pass the libraries in correct order to the linker. > /opt/djgpp/i586-pc-msdosdjgpp/lib/libgcc.a(unwind-dw2-fde.o): In function > `read_encoded_value_with_base': > unwind-dw2-fde.c:211: multiple definition of `__register_frame_info' > /opt/djgpp/i586-pc-msdosdjgpp/lib/libc.a(rfinfo.o)(.text+0x0):rfinfo.c: > first defined here Sorry, my bad: you should say "-lstdc++ -lm -lgcc -lc -lgcc".