使用已编译的应用程序在两个不同的Ubuntu发行版版本上。

huangapple go评论53阅读模式
英文:

Using compiled app on two different Ubuntu distribution versions

问题

I need help and would be very grateful for any advice. I would like my application written in C++, which runs currently on Ubuntu 16.04, to also run on e.g. Ubuntu 20.04, and I would like to have one binary file that will run on both of these systems (only one compilation).

我需要帮助,对任何建议都将非常感激。我希望我的C++应用程序,目前在Ubuntu 16.04上运行,也能在例如Ubuntu 20.04上运行,并且我想要一个二进制文件,可以在这两个系统上运行(只需一次编译)。

I copied the executable from Ubuntu 16.04 to Ubuntu 20.04 and it failed to run, because on Ubuntu 20.04 I have cURL versions 7.68, while on Ubuntu 16.04 I have cURL versions 7.47. So I tried to upgrade the cURL version on Ubuntu 16.04 to the same as it is on Ubuntu 20.04 (7.68) by downloading the .deb file from Ubuntu 20.04 and copying them to Ubuntu 16.04, however, each time I installed such a package, the system informed me that it needed a different package with a newer version to install the one I'm currently trying to install. This process seemed to go on forever until I got to the point where one of these packages could not be installed.

我将可执行文件从Ubuntu 16.04复制到Ubuntu 20.04,但无法运行,因为在Ubuntu 20.04上我有cURL版本7.68,而在Ubuntu 16.04上我有cURL版本7.47。因此,我尝试将Ubuntu 16.04上的cURL版本升级到与Ubuntu 20.04上相同的版本(7.68),方法是从Ubuntu 20.04下载.deb文件并将其复制到Ubuntu 16.04,但是每次我安装这样的包时,系统都会通知我需要一个新版本的不同包才能安装我当前正在尝试安装的包。这个过程似乎永无止境,直到我无法安装其中一个包。

Is this approach correct? Is it at all possible for an application that depends on libraries such as cURL, OpenSSL, etc. to run from only one file on two different Ubuntu distributions?

这种方法正确吗?一个依赖于诸如cURL、OpenSSL等库的应用程序是否可能在两个不同的Ubuntu发行版上仅从一个文件运行?

英文:

I need help and would be very grateful for any advice. I would like my application written in C++, which runs currently on Ubuntu 16.04, to also run on e.g. Ubuntu 20.04, and I would like to have one binary file that will run on both of these systems (only one compilation).

I copied the executable from Ubuntu 16.04 to Ubuntu 20.04 and it failed to run, because on Ubuntu 20.04 I have cURL versions 7.68, while on Ubuntu 16.04 I have cURL versions 7.47. So I tried to upgrade the cURL version on Ubuntu 16.04 to the same as it is on Ubuntu 20.04 (7.68) by downloading the .deb file from Ubuntu 20.04 and copying them to Ubuntu 16.04, however, each time I installed such a package, the system informed me that it needed a different package with a newer version to install the one I'm currently trying to install. This process seemed to go on forever until I got to the point where one of these packages could not be installed.

Is this approach correct? Is it at all possible for an application that depends on libraries such as cURL, OpenSSL, etc. to run from only one file on two different Ubuntu distributions?

答案1

得分: 2

Link your library statically. Then all dependencies are part of the binary. Then it should run smoothly.

When you insist on using dynamic linking, you have to make sure that library locations and binary interfaces remain stable.

英文:

Link your library statically. Then all dependencies are part of the binary. Then it should run smoothly.

When you insist on using dynamic linking, you have to make sure that library locations and binary interfaces remain stable.

huangapple
  • 本文由 发表于 2023年5月15日 03:53:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/76249418.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定