如何为旧的 linux 发行版构建应用程序,并避免 FATAL: kernel too old 错误? [英] How do I build an app for an old linux distribution, and avoid the FATAL: kernel too old error?

查看:25
本文介绍了如何为旧的 linux 发行版构建应用程序,并避免 FATAL: kernel too old 错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 linux 上分发了我的应用程序的静态链接二进制版本.但是,在使用 2.4 内核的系统上,我在启动时遇到段错误,并显示消息:致命:内核太旧."

I distribute a statically linked binary version of my application on linux. However, on systems with the 2.4 kernel, I get a segfault on startup, and the message: "FATAL: kernel too old."

如何轻松地启动并运行带有 2.4 内核的版本?我需要的一些库甚至在 2003 年左右的旧 linux 发行版上都不可用.是否有 apt-get 安装或可以让我轻松定位旧内核的东西?

How can I easily get a version up and running with a 2.4 kernel? Some of the libraries I need aren't even available on old linux distributions circa 2003. Is there an apt-get install or something that will allow me to easily target older kernels?

推荐答案

最简单的方法就是安装 VirtualBox(或类似的东西,例如 VMWare),安装 CentOS 3 或任何具有 2.4 内核的合适的旧发行版,并在其上构建/测试您的应用程序.

The easiest way is to simply install VirtualBox (or something similar, e.g. VMWare),Install CentOS 3 or any suitable old distro with a 2.4 kernel and build/test your app on that.

由于内核太旧",您可能会依赖 2.4 内核中不存在的某些功能,因此您必须对其进行跟踪和返工.该错误可能只是由静态链接到 glibc 引起的,您可以尝试动态链接到 glibc 和静态链接到所有其他库,但要向后兼容,您必须在旧的 glibv 系统上构建您的应用程序.使用 lsb 工具来构建也有帮助

Since you're getting a "kernel too old", chances are you're relying on some features not present in 2.4 kernels so you'll have to trace down and rework that. The error might simply be caused by linking statically to glibc, you could try linking to glibc dynamically and all your other libs statically, though to be backwards compatible you'd have to build your app on an old glibv system. Using the lsb tools to build could help too

这篇关于如何为旧的 linux 发行版构建应用程序,并避免 FATAL: kernel too old 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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