Re: Can g++5.4 link library compiled by gcc4.8 safely?

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

 



On Thu, 14 Nov 2019 at 03:59, leo chen wrote:
>
> Dear developers,
>
> I have got a problem about g++ compatibility.
>
> I want to compile a c++ program by g++5.4, which need to link a library
> compiled by g++4.8. I noticed the dual_abi
> <https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html> since
> g++5.1, so I set -D_GLIBCXX_USE_CXX11_ABI=0 in my CMakeLists.txt. The
> compilation is ok but I got segmentation fault when I run the program.
> To make it clear, the program works well when I downgrade my compiler to
> g++4.8.
> I wonder if there is any way we can link old library compiled by g++4.8
> without downgrade high version g++ compiler (g++5.1 above) ?
>
> Any suggestions and response would be appreciated!.

You haven't said what your code does, or what features you're using,
or what crashes.

If you're using C++11 code compiled with GCC 4.8 and linking to C++11
code compiled with GCC 5, then in general no, you can't do that
safely. See https://stackoverflow.com/a/49119902/981959 for details.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux