1

I have a project in C++, but my data is just too big for my computer. 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).

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.

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. 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... :/


With the -static flag, I got an error less, but still..

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?

Community
  • 1
  • 1
gsamaras
  • 71,951
  • 46
  • 188
  • 305

2 Answers2

2

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. So you will always be limited by the address space (practically at most 2.5 to 3Gbytes of data).

Yoru lab's machine is a 64 bits intel running an old version of Linux

You might try to compile on your machine by linking statically (so g++ -static both at compile and at link time, i.e. make -f Makefile_sam_par clean then 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), . 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 (e.g. 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); 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.

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.

Community
  • 1
  • 1
Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547
  • What info do you want on my program? It is C++, using vectors, heaps and such from STL. My data are of 2.6 Gbyte size. How did you find the number? I will try now, but you mean `g++` right? – gsamaras Apr 03 '15 at 19:51
  • The 2.5 to 3Gbytes limit is for your entire process. Not only for the data. So it probably won't fit. – Basile Starynkevitch Apr 03 '15 at 19:52
  • 1
    You can also list the library dependencies with `ldd`, copy them all to the same dir as the executable, and run it with `LD_LIBRARY_PATH=. ./yourprogram` – that other guy Apr 03 '15 at 19:54
  • 1
    @G.Samaras When I suggested copying the files, I meant copy them from your source system. Not from the target system, whose libraries we're trying to avoid. – that other guy Apr 03 '15 at 20:04
  • Well I did the `ldd` in my PC. Then I am not sure what you want me to do. I will check back tomorrow for comments/answer, I really need to hit the road right now, thanks. – gsamaras Apr 03 '15 at 20:07
  • The `-static` with `make` did not produce an exe. `samaras@samaras-A15:~/parallel/rkd_forest/code$ g++ -static -std=c++0x -O3 -c -Wall main_sam.cpp samaras@samaras-A15:~/parallel/rkd_forest/code$ make CXX='g++ -static' main_sam.o -o rkd_sam make: `main_sam.o' is up to date.` – gsamaras Apr 03 '15 at 20:15
  • I improved my answer. – Basile Starynkevitch Apr 03 '15 at 20:54
  • It worked. I upvoted your linked answer too, but I will give five more upvotes in selected answers, because these experiments are important to me. Can I ask why should I use `CXX` instead of `CC`? Maybe the later is for C? – gsamaras Apr 04 '15 at 13:05
  • Unfortunately, I could not satisfy me purpose. http://stackoverflow.com/questions/29447736/same-memory-limitation-to-a-bigger-machine – gsamaras Apr 04 '15 at 14:46
1

You haven't said what sort of physical machine your PC is. 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.

This very machine I'm typing on has a setup like this, 32bit user space, 64bit kernel and a few 64bit programs.

user3710044
  • 2,261
  • 15
  • 15