This is the mail archive of the
gcc-testresults@gcc.gnu.org
mailing list for the GCC project.
Telling GCC to add automatically libraries for linking...
- From: Serge Cohen <sergecohen at users dot sourceforge dot net>
- To: gcc-patches at gcc dot gnu dot org,gcc-testresults at gcc dot gnu dot org
- Date: Mon, 1 Sep 2003 23:55:41 +0200
- Subject: Telling GCC to add automatically libraries for linking...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Sorry for the cross post, but I've sent this message to the gcc-help
nearly a week ago and had no answer, I hope that some one on these list
will be able to help... (Follow the original message posted on
gcc-help) Thanks for any help.
Hi;
**** Let me first explain in which context I am:
I'm in the process to build gcc 3.3.1 on an alpha (WITH threads).
After the first build I realised (after 2 days) that any C++ program
should be linked with libpthreads (with s), otherwise the executable
crashes.
I've found a way around that: setting env. variable LIBS to -lpthreads
BEFORE the make command.
Then I wanted to test the compiler, and I discovered that this trick
works perfectly for g++ (only 2 FAIL for 8041 PASS), but I still have
problems making executable from Fortran or Objective-C....
Looking at the test logs, again I found that some libraries should be
added for linking into executable (libthread --without s this time--
for Fortran, and librt and libpthread for Objectvie-C).
I' ve tried the same trick as for libpthreads (adding them to LIBS
before bootstrapping)... but it does not work. Indeed I have tried
before running the configure script.
In the mean time I've check that this is the only problem, by editing
the g77.exp and objc.exp files from the testsuite (so that the proper
libraries are added for every made executable): This yield a perfect
test (No FAIL for g77 --compared to 784 FAIL, 1031 PASS--, and no FAIL
for objc --compared to 500 FAIL, 178 PASS--)
When running the not modified testsuite, the PASS are indeed the
compiling test... any 'executing' test is FAIL.
**** So now my question:
Is their any (proper) way to tell GCC during its building that any time
it'll make executable from a certain type of source, it should add
given library(ies) to the linker call?
Indeed I guess there is, as gcc is adding libfrtbegin to any Fortran
sources when it call ld to link them, so the more interesting question
(implied by the previous) is HOW?
Thanks in advance for any info on that.
Serge.
PS: I've tried to search the gcc lists for this issues, but all my
attempt fell due to bad search motif I guess (much to much answer, most
of them being 'noise' regarding my problem)... so I hope you'll accept
my anticipated apologies if this info can be found on web (or
documentation).
________________________________________________________
Serge COHEN
GPG Key ID: 9CBB58FB
N.K.I.
Department of Molecular Carcinogenesis
Plesmanlaan 121
1066 CX Amsterdam; NL
Offi: + 31 20-512-1957
E-Mail: scohen@nki.nl
________________________________________________________
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (Darwin)
iD8DBQE/U8BF5EPeG5y7WPsRAumSAJ4oWo84Iq29cz4cu47lEr8dHjUpCwCgqVze
D2PFzz2xaNzB0VhZSB5nwkY=
=wFFg
-----END PGP SIGNATURE-----