[opensuse-programming] Linking to libraries of different compilers
Hi, Is it safe to link an application against libraries compiled with a different compiler? For example, to compile Linpack using gcc, and then to link with static libraries (libacml_mp.a and libmpich.a) compiled with PGI. My presumption is that it is safe to do so, since objects/libraries in Linux (SLES9) must follow a certain format (ELF?). But with my shallow knowledge in compilers, it's better to ask to this list. Regards, Verdi -- "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ... Jetzt GMX TopMail testen: www.gmx.net/de/go/mailfooter/topmail-out --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org
On Sat, 24 Mar 2007 10:22:31 +0100 "Verdi March" <cincaipatron@gmx.net> wrote:
Hi,
Is it safe to link an application against libraries compiled with a different compiler? For example, to compile Linpack using gcc, and then to link with static libraries (libacml_mp.a and libmpich.a) compiled with PGI.
My presumption is that it is safe to do so, since objects/libraries in Linux (SLES9) must follow a certain format (ELF?). But with my shallow knowledge in compilers, it's better to ask to this list. In general, yes you can. Many times companies send libraries compiled with a different compiler. There are caveats, of course. The main thing is that the libraries you link against have the same APIs that are included in the associated header files. You've also got to be careful about is system calls and api changes between libraries. -- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
On Saturday 24 March 2007 11:05, Jerry Feldman wrote:
On Sat, 24 Mar 2007 10:22:31 +0100
"Verdi March" <cincaipatron@gmx.net> wrote:
Hi,
Is it safe to link an application against libraries compiled with a different compiler? For example, to compile Linpack using gcc, and then to link with static libraries (libacml_mp.a and libmpich.a) compiled with PGI.
My presumption is that it is safe to do so, since objects/libraries in Linux (SLES9) must follow a certain format (ELF?). But with my shallow knowledge in compilers, it's better to ask to this list.
In general, yes you can. Many times companies send libraries compiled with a different compiler. There are caveats, of course. The main thing is that the libraries you link against have the same APIs that are included in the associated header files. You've also got to be careful about is system calls and api changes between libraries.
Naturally, the APIs must be consistent, but that's pretty much a given. Actually, it is the ABI (Application Binary Interface), which defines how functions / subroutines are called, parameters are passed and results returned, that governs compiler compatibility. A bit of cursory searching on the Internet suggests that these compilers are in fact compatible and used together by some users. Randall Schulz --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org
On Sat, 24 Mar 2007 11:25:25 -0700 Randall R Schulz <rschulz@sonic.net> wrote:
Naturally, the APIs must be consistent, but that's pretty much a given.
Actually, it is the ABI (Application Binary Interface), which defines how functions / subroutines are called, parameters are passed and results returned, that governs compiler compatibility.
A bit of cursory searching on the Internet suggests that these compilers are in fact compatible and used together by some users. There were some changes in the C++ ABI changed in some of the more recent GCC compilers. Then following web site has a description of some of the changes: http://developer.kde.org/policies/compatpolicy.html
Back a few years ago, a certain well known research institute was trying to get some vendors to port their code. It would run when built and linked against GCC 2.95. We decided we were not going to spend the resources on it, as did some of our competitors. Just to compile it, we had to import the entire GCC 2.95 environment. So back to my original statement, yes you can generally build with an older library and your code should work with newer libraries, but the caveat is with any changes. I believe that you would be safe with the linpack stuff. I was actually using that to benchmark x86/Opteron/Itanium at one point. -- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
participants (3)
-
Jerry Feldman
-
Randall R Schulz
-
Verdi March