This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Telling GCC to add automatically libraries for linking...


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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/T2dI5EPeG5y7WPsRAiYHAKClhHuxHBQpuB91xUW2i7XIzAy63ACfXTRP
fHNAjb9I4N5gyOR/bkq7b7Q=
=DSMp
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]