* > Dear experts on building and linking C++ applications,
>
> according to the blog "Creating portable Linux binaries"
> http://insanecoding.blogspot.de/2012/07/creating-portable-linux-binaries.html
> the following options could make the poly executable more portable
> accross different Linux versions:
>
>   CFLAGS="-static-libgcc -static-libstdc++ -Wl,-Bstatic -lgmp -Wl,-Bdynamic"

I wouldn't rely on toolchain advice that is more than five years old.

Statically linking libgcc and libstdc++ will cause more problems than
it solves unless you can ensure that everything in the process links
statically against those libraries, which means no dlopen and no
reliance on system libraries written in C++.  Worse, these problems
manifest even when running on the exact same system which were used
for building (e.g., exception handling is not working properly).

It may be that this is needed on Ubuntu, but other distributions have
backwards compatibility for the C/C++ runtime across releases, so that
you only have to compile on the oldest release you want to support.

There is also a hybrid linking model for libstdc++, where only newer
bits are linked statically, so that compatibility with the system
libstdc++ is preserved and no new version of libstdc++ is needed at
run time.  But indiscriminate static linking is a bad idea,
particularly for code which has any kind of plug-in framework.
_______________________________________________
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to