我可以在我的Ubuntu 9.10上与gcc交叉编译旧版Linux发行版吗? [英] Can I cross compile with gcc for an old version of a Linux distro on my Ubuntu 9.10?

查看:175
本文介绍了我可以在我的Ubuntu 9.10上与gcc交叉编译旧版Linux发行版吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些旧版本的硬件,说SuSE linux运行在它上面。现在我有了这款运行Ubuntu 9.10的奇特开发机器。一些用于编译我的C应用程序(用Python 2.6.x编写)的工具在旧的SuSe框中不可用。那么...是否可以在我的开发盒中编译这个旧机器?



我有以下几个步骤,但想在冒险之前进行交叉检查关掉这个任务:
1.找出我的应用程序需要哪个静态/共享库,并找到/构建它们的目标版本
2.也找到相应的头文件
3.喂正确的标志gcc使用目标头文件和库
4.向gcc提供正确的标志以使用正确的体系结构(i386 / i686),还是需要交叉编译工具链?
5.编译,上传并享受; - )

我经常使用avr-gcc和cc65,两者都是交叉编译。我知道你设置了一个coss编译器来开发类似于gumstix的东西,所以应该可以对旧的/其他的Linux发行版做同样的事情,而不是?

C

解决方案

我会这样做的方法是抓住 oldmachine:/ usr / lib oldmachine:/ usr / include 所以你有eg newmachine:/ oldmachinecompiler / usr / {lib | include} 然后建立一个交叉编译器设置 - sysroot newmachine:/ oldmachinecompiler /



这确实是确保程序中任何库需求(包括libc)的唯一方法与 oldmachine


兼容

I have some old hardware with an old version of say SuSE linux running on it. Now I have this fancy development machine running Ubuntu 9.10. Some of the tools I use to compile my C app (written in Python 2.6.x) are not available on the old SuSe box. So... is it possible to compile for that old machine on my dev box?

I have the following steps in mind, but would like to cross-check before venturing off into this quest: 1. Find out which static/shared libs my app needs and find/build target version of them 2. Also find the corresponding header files 3. Feed the correct flags to gcc to use the target headers and libraries 4. Feed the correct flags to gcc to use the correct architecture (i386/i686), or do I need a cross-compilation toolchain. 5. Compile, upload and enjoy ;-)

I regularly use avr-gcc and cc65, both are cross compiling. I know that you set up a coss compiler for developing something like a gumstix, so it should be possible to do the same for old/other Linux distros, not?

C

解决方案

The way I would approach this is grab your oldmachine:/usr/lib and oldmachine:/usr/include so you have e.g. newmachine:/oldmachinecompiler/usr/{lib|include} then build a cross compiler setting --sysroot to newmachine:/oldmachinecompiler/

This is really the only way to ensure that any library requirements (including libc) in your program are compatible with oldmachine.

这篇关于我可以在我的Ubuntu 9.10上与gcc交叉编译旧版Linux发行版吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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