在其他发行版运行C可执行程序 [英] Run a C executable in another distro
问题描述
我有我使用Ubuntu 11.10(Linux版的3.0.0-12-仿制PAE内核)开发的C程序。我需要在具有Debian的3.1(Linux版本的2.4.24-OM2)安装在群集运行该程序,并使用英特尔(R)奔腾(R)4 CPU 3.20GHz处理器。
I have a C program that I'm developing using Ubuntu 11.10 (Linux version 3.0.0-12-generic-pae kernel). I need to run that program in a cluster that has Debian 3.1 (Linux version 2.4.24-om2) installed, and uses Intel(R) Pentium(R) 4 CPU 3.20GHz processors.
问题是,我不能Debian的集群中编译,因为它没有安装我的程序需要GSL库,我不知道如何安装它(或使用它)没有根特权。
The problem is that I can't compile in the Debian cluster because it doesn't have installed the GSL library that my program needs, and I don't know how to install it (or make use of it) without root privileges.
如果我尝试运行在Ubuntu编译可执行我(或一个简单的的Hello World 的节目,为的情况下),这是行不通的,即使我使用编译所有GCC选项当集群上执行,这将引发:
If I try to run the executable I compiled in Ubuntu (or a simple hello world program, for the case), it doesn't work, even if I compile using all the gcc options that this throws when executed on the cluster:
gcc --save-temps -fverbose-asm hello_world.c -o hello_world
当我尝试执行我在Ubuntu编译的程序,它抛出:
When I try to execute my program compiled in Ubuntu, it throws:
floating point exception
更新:当我编译使用-static标志,我得到的错误是:
Update: When I compile using the -static flag, the error I get is:
FATAL: kernel too old
Segmentation fault.
所以我可以做的更好的东西比重新实现我使用的GSL的全部功能。
So can I do something better than re-implement all the functions of GSL that I'm using.
推荐答案
最后,我解决了编译GSL库没有root权限。
我uncom pressed来源主目录文件夹中,创建了一个_build目录,../configure跑,然后进行。
At the end, I solved it compiling the GSL library without root privileges. I uncompressed the sources in a folder in the home directory, created a _build directory, and ran ../configure, and then make.
我复制这是内部_build在一个新的〜/路径/ lib目录下创建的目录的.libs的文件,并用:
I copied the files of the .libs directory that was created inside _build in a new ~/path/lib directory, and used:
find -name "*.h" -type f -exec cp {} ~/path/include/gsl \;
要复制所有在GSL源文件夹中生成的头文件(当然有更好的方法来做到这一点)。
To copy all the header files generated in the GSL source folder (surely there was a better way to do that).
然后我试图设置环境变量GCC(C_INCLUDE_PATH,LIBRARY_PATH),但由于某种原因我没能拯救他们(使用和出口,试图改变他们在〜/ profile和〜/ .bash_profile中的文件)。
I then tried to set the environment variables for gcc (C_INCLUDE_PATH, LIBRARY_PATH) but for some reason I wasn't able to save them (used and export, tried to change them in the ~/profile and ~/.bash_profile files).
所以,我用了-I和-L GCC选项的两个文件夹链接。它的工作这种方式。
So, I used the -I and -L gcc options to link the two folders. It worked this way.
这篇关于在其他发行版运行C可执行程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!