[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Do newest versions of g++ work well on old versions of Linux?

From: Robert Heller
Subject: Re: Do newest versions of g++ work well on old versions of Linux?
Date: Sun, 06 Mar 2011 13:21:39 -0600

At Sun, 6 Mar 2011 09:22:56 -0800 (PST) itaj sherman <> 

> If code is supposed to be compiled and/or executed on old versions of
> Linux (a few years old), is it generally a problem to use the newer g+
> + vesions?
> Should we be able to use all new features like c++0X and boost with
> new compiler on older Linux?
> Especially, would the differences in the thread scheduling mechanisms
> between older and newer versions of Linux cause a problem when
> executing code that is compiled with new versions of g++ and boost?
> (considering c++0X and boost contain thread support)

The problem is going to be with shared libraries.  It is quite possible
to build and install a new g++ build chain (including the newer stdc++
libraries) on an older version of Linux (you may have to build it
yourself, rather than use what the distro offers), but if you link it
with the proper shared libraries, the resulting executables won't work
on a base install of the older linux system because it won't have the
newer shared libraries installed.

You could:

1) Ship the newer shared libraries you built and write scripts that set
LD_LIBRARY_PATH to the private area where you install the libraries
(this is sensible if a bunch of executables are being build).

2) Statically link the libraries (this might be sensible if only one
executable is being built).  Note: if it is expected that running
multiple incarnations of the program would be normal, option 1 above
would be better.

I don't know if the thread scheduling mechanisms would matter, except
in terms of runtime performance issues.  It would depend on whether the
kernel (glibc) API is the same or different.  If different, then you
will run into version issues relating to glibc and/or kernel-headers,
which would be a show stopper, unless you used compile-time tests and
selected alternitive code (eg used preprocessor conditionals). I would
*expect* that the C++ compiler's ./configure script would detect the
kernel version, etc. and would build a compiler suitable to the kernel
API in use.  Boost probably includes suitable preprocessor
conditionals. Or else it would refuse to build or install.

> itaj

Robert Heller             -- 978-544-6933 /
Deepwoods Software        --
()  ascii ribbon campaign -- against html e-mail
/\   -- against proprietary attachments


reply via email to

[Prev in Thread] Current Thread [Next in Thread]