[IPOL discuss] multiple compilers [Re: small compilation error in LSD]
Nicolas Limare
nicolas.limare at cmla.ens-cachan.fr
Wed Nov 16 14:58:10 CET 2011
> By the way, is it difficult to install different compilers on the
> same machine ?
No. On my laptop, I have gcc, tcc, clang and i586-mingw32msvc-gcc from
the Debian packages.
Plus icc, suncc and pathcc from the vendor binary distribution (Intel,
Oracle/Sun and Pathscale). Plus nwcc compiled from source. Everything
is in /opt, and I added ~/.local/bin to my path with some symlinks or
trivial wrapper scripts from ~/.local/bin to each compiler, with
different names. I also have dmc (Digital Mars Compiler), a Windows
compiler used via Wine, but this is just an experiment, not very
practical.
I wanted to add pcc and lcc but could not compile them.
We could consider installing different compilers on fuchsia if some
users ask it. gcc, tcc, clang and i586-mingw32msvc-gcc are already
installed.
> Are they all binary compatible ? That is, if I build a library with one
> compiler, can I link it to my object file compiled with a different
> compiler ?
I think it is OK as long as there is a well defined ABI, followed by
the compiler, and they use the same libc. There is a well-defined ABI
for Linux x86 and x86-64, I think all the compilers follow it, and
every compiler should use the libc installed on the system, so I think
it is OK. If I remember correctly, I think I have succesfully linked
two .o produced with different compilers. A quick Google search tells
me C compilers are usually compatible on Unix (but it's not an
absolute truth), C++ compilers may be incompatible, and don't expect
anything to work on Windows...
http://bytes.com/topic/c/answers/218670-link-compatibility-among-c-compilers
http://gcc.gnu.org/onlinedocs/gcc-4.6.2/gcc/Compatibility.html
http://stackoverflow.com/questions/4782714/gcc-vs-ms-c-compiler
PS: And I know that the gfortran anf g95 fortran compilers have
different ABIs.
--
Nicolas LIMARE - CMLA - ENS Cachan http://www.cmla.ens-cachan.fr/~limare/
IPOL - image processing on line http://www.ipol.im/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://tools.ipol.im/mailman/archive/discuss/attachments/20111116/6e09bc06/attachment.pgp>
More information about the discuss
mailing list