[CMake] Comaptibility with older gcc

Craig Scott craig.scott at crascit.com
Sat Jan 28 05:46:40 EST 2017


It's probably outside of the set of possible solutions to your particular
problem, but I'll mention this one in case it interests others following
the topic. For potentially the broadest compatibility, one could consider
using the LSB (Linux Standards Base) to build binaries that are guaranteed
to run across a lot of different distributions and versions. Unfortunately,
the LSB tends to trail quite a long way behind the latest capabilities and
it seems to have lost momentum in recent years, but I've used it in the
past to build one binary package which can then be deployed to many systems
(this included a full GUI Qt application). If you want to use C++11 or
later though, from what I understand I think you're out of luck (but do
your own research, I could be wrong on that).

One place to start with the LSB is the LSB Navigator. It contains links to
the official parts of the standard so you can get a formal reference to
what it covers.

http://www.linuxbase.org/navigator/commons/welcome.php

Something potentially more useful for your particular case is the
application checker included in the LSB tools. It can analyse a whole
package or just an application and provide a report listing any symbols
that will be missing on a variety of different linux distributions.

https://wiki.linuxfoundation.org/lsb/check-your-app

I've found that app checker to be particularly useful in the past, but it
has been some years since I've used it, so I can't comment on how good it
is these days.

Don't worry so much about the certification aspects of the LSB, it's useful
just to build/test portable applications and packages and you don't have to
go the certification route just to use the LSB tools. Many linux
distributions don't seek to certify themselves but offer pretty good
compliance anyway (or at least they used to).




On Sat, Jan 28, 2017 at 8:45 PM, Dan Liew <dan at su-root.co.uk> wrote:

> > I was also doubting about libstdc++ versions, is there maybe a way of
> asking
> > Cmake to statistically include it in the built library?
>
> I assume you mean statically. If so then you could try invoking cmake
> like this on the command line.
>
> ```
> mkdir new_build_dir
> cd new_build_dir
> CXXFLAGS="-static-libstdc++ " CFLAGS="-static-libstdc++" cmake
> /path/to/source/tree
> make -j$(nproc)
> ```
>
> Note that `new_build_dir` must be empty every time you invoke the
> `cmake` command
> because it will only try to detect your compiler once. Subsequent
> invocations of cmake
> in an existing build directory does not change the compiler and
> setting CXXFLAGS and
> CFLAGS to different values has no effect.
>
> However I don't think this is the best approach. I think you would be
> much better of recreating
> the production environment on your development machine. This makes it
> much easier to reproduce
> issues you may hit in production.
>
> There are many ways about doing this but my suggestion would be to use
> Docker or a virtual machine for that purpose.
>
> You mention you want to use Eclipse so what you could do is develop
> your application on your local machine (i.e. outside of Docker or the
> virtual machine)
> but have your source files mounted into your Docker container (these
> are called volume mounts) or the virtual machine.
>
> That way you can use Eclipse for your development locally but when you
> want to, you can do a build inside the container/vm using the same
> source files
> to test the build still works and also produce binaries that will
> "just work" on your production system.
>
> HTH,
> Dan.
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>



-- 
Craig Scott
Melbourne, Australia
https://crascit.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170128/ae2b157f/attachment.html>


More information about the CMake mailing list