简体   繁体   English

从Ubuntu运行可执行文件到Debian

[英]Run an executable from Ubuntu to Debian

I have a project in C++, but my data is just too big for my computer. 我有一个C ++项目,但我的数据对我的电脑来说太大了。 So, I tried to build my project in a desktop in our lab, but the compiler is too old (4.3.5 and I had 4.8.1 when I developed my code). 所以,我试图在我们实验室的桌面上构建我的项目,但编译器太旧了(4.3.5,当我开发代码时我有4.8.1)。

I do not have the rights to upgrade and the people that do have the rights are just too busy for me this period. 我没有升级的权利,拥有这些权利的人在这段时间对我来说太忙了。 Moreover, they said to me that the Debian version the lab desktop runs on is too old, thus it won't allow a significant upgrade for the compiler. 而且,他们告诉我实验室桌面运行的Debian版本太旧了,因此它不允许对编译器进行重大升级。

So I was hoping that somehow I could manage to copy the executable that I created in my Ubuntu to the desktop with Debian and run it. 所以我希望以某种方式我可以设法将我在Ubuntu中创建的可执行文件复制到Debian并运行它。 But I am afraid I am asking too much so a negative answer is also acceptable. 但我担心我要求太多,所以否定的答案也是可以接受的。

My computer (in which the executable is created): 我的计算机(创建可执行文件):

samaras@samaras-A15:~$ uname -a
Linux samaras-A15 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 15:31:16 UTC 2013 i686 i686 i386 GNU/Linux
samaras@samaras-A15:~$ lsb_release -d
Description:    Ubuntu 12.04.3 LTS

The lab computer and what happens when I run the executable: 实验室计算机以及运行可执行文件时会发生什么:

gsamaras@geomcomp:~/Desktop/code$ uname -a
Linux geomcomp 3.2.0-1-amd64 #1 SMP Fri Feb 17 05:17:36 UTC 2012 x86_64 GNU/Linux
gsamaras@geomcomp:~/Desktop/code$ lsb_release -d
Description:    Debian GNU/Linux 6.0.10 (squeeze)
gsamaras@geomcomp:~/Desktop/code$ ./rkd_sam
./rkd_sam: /usr/lib32/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by ./rkd_sam)
./rkd_sam: /usr/lib32/libstdc++.so.6: version `GLIBCXX_3.4.17' not found (required by ./rkd_sam)
./rkd_sam: /usr/lib32/libstdc++.so.6: version `GLIBCXX_3.4.19' not found (required by ./rkd_sam)

I have hope because they are both Linux systems, but the 32 bit and 64 bit might be an issue... :/ 我有希望,因为它们都是Linux系统,但32位和64位可能是一个问题......:/


With the -static flag, I got an error less, but still.. 使用-static标志,我的错误少了,但仍然...

gsamaras@geomcomp:~/Desktop/code$ ./rkd_sam
./rkd_sam: /usr/lib32/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by ./rkd_sam)
./rkd_sam: /usr/lib32/libstdc++.so.6: version `GLIBCXX_3.4.19' not found (required by ./rkd_sam)

The dependencies are (this on my PC): 依赖项是(这在我的电脑上):

samaras@samaras-A15:~/parallel/rkd_forest/code$ ldd rkd_sam
    linux-gate.so.1 =>  (0xb76f8000)
    libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb75e9000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb75bd000)
    libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb759e000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb73f4000)
    /lib/ld-linux.so.2 (0xb76f9000)

and I am getting 我正在接受

which libstdc++

prints nothing in the lab computer, so that means game over? 在实验室计算机上什么都不打印,这意味着游戏结束?

We don't know what kind of program you are coding, so this is just a wild guess. 我们不知道您编写的是哪种程序,所以这只是一个疯狂的猜测。

Your machine is a 32 bits Intel, so your binary on it is a ia32 (ie x86 32 bits) binary. 你的机器是32位英特尔,所以你的二进制文件是ia32(即x86 32位)二进制文件。 So you will always be limited by the address space (practically at most 2.5 to 3Gbytes of data). 因此,您将始终受到地址空间的限制(实际上最多2.5到3G字节的数据)。

Yoru lab's machine is a 64 bits intel running an old version of Linux Yoru lab的机器是运行旧版Linux的64位intel

You might try to compile on your machine by linking statically (so g++ -static both at compile and at link time, ie make -f Makefile_sam_par clean then make -f Makefile_sam_par CXX='g++ -static' ) 您可以尝试通过静态链接在您的机器上进行编译(因此在编译和链接时都是g++ -static ,即make -f Makefile_sam_par clean然后make -f Makefile_sam_par CXX='g++ -static'

BTW, your Makefile_sam_par is wrong, you should use CXX not CC inside it (since conventionally CXX and CXXFLAGS are for C++, run make -p to get the builtin rules inside make to understand the details, and read documentation of GNU make ), . 顺便说一下,你的Makefile_sam_par是错误的,你应该在其中使用CXX而不是CC (因为传统上 CXXCXXFLAGS用于C ++,运行make -p以获取内部规则make以了解细节,并阅读GNU make的文档),. So correct that first. 所以先纠正。 See this example . 这个例子

If you are ready to spend several days of work, and if you have a lot of disk space (eg 15 Gbytes) available on the lab's desktop you might try to compile a recent binutils and a recent GCC 4.9 compiler (be sure to .... ../configure --prefix=$HOME/soft --program-suffix=-my-4.9 ); 如果您准备好花几天时间工作,并且如果实验室桌面上有大量磁盘空间(例如15 GB),您可能会尝试编译最近的binutils和最近的GCC 4.9编译器(请务必... .. ../configure --prefix=$HOME/soft --program-suffix=-my-4.9 ); it is probably not worth the effort. 这可能不值得努力。

Perhaps try to ask some friend (having a bigger laptop than yours, with a Linux 64 bits and more than 4Gb RAM) to run your program. 也许试着问一些朋友(拥有比你更大的笔记本电脑,使用Linux 64位和超过4Gb RAM)来运行你的程序。

BTW, if your laptop has more than 4Gbytes RAM and some x86-64 processor (which is very common these days, except on netbooks), it is definitely worthwhile to install a 64 bits variant of Linux. 顺便说一句,如果你的笔记本电脑有超过4G字节的RAM和一些x86-64处理器(这些日子很常见 ,除了上网本),安装一个64位的Linux版本绝对是值得的。

You haven't said what sort of physical machine your PC is. 你还没有说过你的PC是什么样的物理机器。 If it's anything recent (except a very small netbook) your best bet may be to switch your kernel to an 'amd64' variant then compile and run the code on your machine using the '-m64' flag to the C++ compiler to get a 64bit executable. 如果它是最近的(除了一个非常小的上网本),你最好的选择可能是将你的内核切换到'amd64'变体,然后在你的机器上使用'-m64'标志编译并运行代码到C ++编译器得到64位可执行文件。

This very machine I'm typing on has a setup like this, 32bit user space, 64bit kernel and a few 64bit programs. 我正在打字的这台机器有这样的设置,32位用户空间,64位内核和一些64位程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM