如何安全地部署使用升级的编译器构建的应用程序 [英] How to safely deploy an application built with an upgraded compiler

查看:135
本文介绍了如何安全地部署使用升级的编译器构建的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序部署在一个centos 6.7平台上,并使用本地C ++编译器构建,即gcc 4.4.7。现在由于某些原因(实际上,升级到Qt 5.7),我需要使用完全支持C ++ 11功能的现代编译器,比如说devtoolset-2中的gcc 4.8.2。另一种可能是从源头上构建一个新版本的gcc。根据 https://gcc.gnu.org/onlinedocs/libstdc++/manual/ abi.html 4.8.3(但未提及4.8.2)版本的gcc向后兼容libstdc ++ 6.0.13(centos 6.7中的默认c ++ lib)。

我已经使用这个新的gcc 4.8.2版本重新编译了应用程序,并且在开发环境中一切似乎都运行良好。该应用程序使用默认系统c ++,gcc和c库。



但是,当涉及到部署6.7时(例如全新安装之后),我问自己它是这样做的安全吗?取而代之的是依赖ABI兼容性,最好是提供最新的C ++和C库,它们与用于构建我的应用程序的gcc版本兼容?

解决方案

很高兴看到别人这样做 - 我最近也开始这样做了!



我的回答不是很权威,但是为了它的价值,我重建了所有我将链接的C ++库,并将它们部署到我的应用程序中。我还将libstdc ++和libgcc_s重新分发,将它们放在特殊位置( / usr / lib / myApplicationName /...)。我确保我的应用程序链接到所有这些重新分配的库,而不是任何原生的。



我担心libc兼容性可能是个问题,但我没有找到我需要对任何C库或libc本身做任何事情。



更新:结果我甚至不需要这样做,因为我正在使用devtoolset ; FML。

I have an application that is deployed on a centos 6.7 plateform and built with the native C++ compiler of the distribution, that is gcc 4.4.7. Now for some reasons ( actually, upgrade to Qt 5.7 ), i need to use a modern compiler with C++11 features fully supported, let's say gcc 4.8.2 from devtoolset-2. Another possibility was to built a new version of gcc from the sources. According to https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html the 4.8.3 (but 4.8.2 is not mentionned ) version of gcc is backward compatible with the libstdc++.6.0.13 ( default c++ lib in centos 6.7 ).

I have recompiled the application with this new gcc 4.8.2 version and everything seems to run fine in the dev environment. The app use the default system c++, gcc and c libs.

However, when it comes to deployment on centos 6.7 ( after a fresh install for example ) i ask myself how safe it is to do so ? Instead on relying on ABI compatibility , would it be better to provide the latest C++ and C libraries that are compatible with the version of gcc that was used to build my app ?

解决方案

Nice to see someone else doing this - I recently started doing it too!

My answer is not very authoritative, but for what it's worth, I rebuild all C++ libraries that I'll be linking against, and deploy those with my application. I also redistribute libstdc++ and libgcc_s, putting them in a special place out of the way (/usr/lib/myApplicationName/...). I ensure that my application links against all of these redistributed libraries instead of whatever's native.

I had a concern that libc compatibility might be a problem, but I haven't found that I need to do anything about any C libraries, or with libc itself.

Update: Turns out I didn't even need to do this, because I'm using devtoolset; FML.

这篇关于如何安全地部署使用升级的编译器构建的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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