什么是需要使用GCC的新版本比平台提供 [英] What is needed to use a newer version of GCC than the platform provides

查看:117
本文介绍了什么是需要使用GCC的新版本比平台提供的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在看的潜在使用GCC的新版本(如5.2),比有些人认为我需要支持(GCC 4.1)的平台提供的,我想至少有C ++ 11的特性,也许甚至一些C ++ 14的事情。我只是提供了一个可执行程序,那我希望这个平台的用户能够与链接不是静态的或共享库。

我能够编译GCC 5.2和Boost 1.59(用C ++ API我使用目前唯一的LIB),并把它与工作所以对于那些放在旁边的可执行文件,并添加$ ORIGIN到RPATH测试系统上拥有4.4。

不过,我在别的什么,我需要充分做到这一点,并确保一切是正确的/安全不清楚。例如我注意到的libc,libm中,的libpthread等,而不是GCC构建的一部分,它仍然采用了系统版本,与许多其他第三方库(如zlib的,的libpng,等等)。我是否需要重建和分发所有这些是安全的?他们是一套标准的规则,讲?

也知道如果我要静态链接一些事情,并再次规则是什么?例如仅仅使用-​​static失败,因为它去寻找,我没有在该系统上的静态pthread的(我假设其他系统提供的库)。理想情况下我想保持我的包下来的大小。


解决方案

  

不过,我在别的什么,我需要充分做到这一点,并确保一切是正确的/安全不清楚。例如我注意到的libc,libm中,的libpthread等,而不是GCC构建的一部分,它仍然采用了系统版本,与许多其他第三方库(如zlib的,的libpng,等等)。我是否需要重建和分发所有这些是安全的?他们是一套标准的规则,讲?


运行 LDD 你的可执行文件和共享库,以确保它加载的libstdc ++ 从正确的位置libgcc_s ,如果动态链接它们。这些都是一般需要运行应用程序建有G ++。只有两个依赖

通常情况下,你并不需要提供自己的库的版本, C 接口,除非你的应用程序需要更新的版本不兼容的API。

I am looking at the potential to use a newer version of GCC (e.g. 5.2) than is provided by some of the platforms that I need to support (GCC 4.1) as I would like to at least have C++11 features, and maybe even some C++14 things. I just provide an executable program, not static or shared libraries that I expect users of the platform to be able to link with.

I was able to compile GCC 5.2 and Boost 1.59 (the only lib with a C++ API I am using currently) and get it working with the so's for those placed alongside the executable and adding $ORIGIN to RPATH on a test system which has 4.4.

But I am unclear on what else I need to do this fully and ensure everything is correct/safe. e.g. I noticed libc, libm, libpthread, etc. are not part of the GCC build, and it still uses the system version, as with many other third party libraries (e.g. zlib, libpng, etc.). Do I need to rebuild and distribute all those to be safe? Is their a standard set of rules to tell?

Also wondering if I should statically link some things and again what the rules are? e.g. just using "-static" fails because it goes looking for a static pthread that I don't have on that system (and I assume other system-provided libraries). Ideally I want to keep the size of my package down.

解决方案

But I am unclear on what else I need to do this fully and ensure everything is correct/safe. e.g. I noticed libc, libm, libpthread, etc. are not part of the GCC build, and it still uses the system version, as with many other third party libraries (e.g. zlib, libpng, etc.). Do I need to rebuild and distribute all those to be safe? Is their a standard set of rules to tell?

Run ldd on your executables and shared libraries to make sure that it loads libstdc++ and libgcc_s from the correct location, if you link them dynamically. These are the only two dependencies normally required to run your applications built with g++.

Normally, you do not need to provide your own versions of libraries with C interface, unless your application requires newer versions with incompatible APIs.

这篇关于什么是需要使用GCC的新版本比平台提供的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆