简体   繁体   English

我可以用更新的gcc / clang来定位旧的linux吗? C ++

[英]Can I target older linux with newer gcc/clang? C++

Right now I compile my C++ software on a certain old version of linux (SLED 10) using the provided gcc and it can run on most newer versions as they have a newer glibc. 现在我使用提供的gcc在某个旧版本的Linux(SLED 10)上编译我的C ++软件,它可以在大多数新版本上运行,因为它们有更新的glibc。 Problem is, that old gcc doesn't support C++11 and I'd really like to use the new features. 问题是,旧的gcc不支持C ++ 11,我真的很想使用新功能。

Now I have some ideas, but I'm sure others have the same need. 现在我有一些想法,但我相信其他人也有同样的需求。 What's actually worked for you? 什么对你有用?

Ideas: 思路:

  1. Build on a newer system, static link to newer glibc. 构建一个更新的系统,静态链接到更新的glibc。 (Not possible, right?) (不可能,对吧?)
  2. Build on a newer system, compile and link against an older glibc. 构建在较新的系统上,编译并链接旧的glibc。
  3. Build on an older system using an updated gcc, link against older glibc. 使用更新的gcc构建旧系统,链接旧glibc。
  4. Build on a newer system, dynamic link to newer glibc, set RPath and provide our glibc with installer. 构建一个更新的系统,动态链接到更新的glibc,设置RPath并为我们的glibc提供安装程序。

As a bonus, my software also support plugins and has an SDK. 作为奖励,我的软件也支持插件,并有一个SDK。 I'd really prefer that my customers could compile against my libraries without a huge hassle. 我真的更喜欢我的客户可以编译我的库而不会有太大的麻烦。

Thanks in advance. 提前致谢。 Ideas welcome, proven solutions preferred. 欢迎提供,经过验证的解决方案

Build with the newer gcc. 使用较新的gcc构建。 Either install the new compiler on the old machine or comile on your new machine and install the necessary dynamic libraries on the old machine. 在旧计算机上安装新编译器或在新计算机上安装新编译器,并在旧计算机上安装必要的动态库。

Note that multiple versions of libc (and also libstdc++) are supported on a single machine since they are typically versioned (ie libc.so.5, libc.so.6, etc) 请注意,单个计算机上支持多个版本的libc(以及libstdc ++),因为它们通常是版本化的(即libc.so.5,libc.so.6等)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取我的makefile来编译/链接旧的和较新的GCC / GNU库? C ++ - How can I get my makefile to compile/link older and newer GCC/GNU libraries? C++ 可以通过C和C ++方法优化LTO for gcc或clang - Can LTO for gcc or clang optimize across C and C++ methods 有没有比 GCC 或 Clang 实现更直观的方式在 Linux 中的 C++ 中使用内联汇编? - Is there a more intuitive way to use Inline Assembly in C++ in Linux than the GCC or Clang implementation? 如何在clang(或gcc)中解码C ++名称? - How to demangle a C++ name in clang (or gcc)? Visual C ++初始化与gcc和clang的不一致 - Visual C++ initialization inconsistence with gcc and clang Gcc和clang之间的C ++不一致 - C++ inconsistency between gcc and clang C ++ MSVC / GCC / Clang编译器错误 - C++ MSVC/GCC/Clang compilers bug 如何使用 Clang/GCC 在 Mac 上为 C/C++ 设置 VSCode? - How do I set up VSCode for C/C++ on Mac with Clang/GCC? 我可以升级Xcode以支持更新版本的GCC来学习C ++ 0x吗? - Can I upgrade Xcode to support a newer version of GCC to learn C++0x? 如果 LR(1) 解析器无法解析 c++,gcc/clang 如何解析它? - How does gcc/clang parse c++ if it can't be parsed by a LR(1) parser?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM