3

I am compiling a program through clang+llvm (version 3.1) and trying to run it on a computer which also has the same clang+llvm version. I'm compiling on Ubuntu 10, but the other computer where I'm trying to run has CentOS 5. There (in CentOS), I also encounter problems compiling through LLVM (a compiler pass is implemented in LLVM). That is why I thought about compiling on Ubuntu, take the exe from there and just run it on the CentOS machine.

However, when I try to do that, I get the following error.

./main: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by ./main)
./main: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by ./main)

How can I solve this. Please note that I do not have root accesses on that machine.

pythonic
  • 20,589
  • 43
  • 136
  • 219

3 Answers3

3

One solution would be to copy the library from your working Ubuntu machine to your CentOS machine. Put in your Home/Workdir/whereever(TM) and set your LD_PRELOAD variable to that library. But that can be quite tedious as it is possible that this is not the only library that is missing (and maybe libraries depend on other libraries, that you also need...).

This also only works, if both machines have the same architecture (e.g. it wont work if your ubuntu machine is 32 bit and your CentOS 64).

flolo
  • 15,148
  • 4
  • 32
  • 57
  • Another option which come to my mind is compiling the program static (i.e. all necessary library functions got included). – flolo Mar 27 '12 at 05:46
2

Centos 5 uses an older version of libstdc++ than Ubuntu 11.04 or 11.10, so can't use binaries from there.

Either compile on Centos 5, or find a older compile environment that does work. If you were using gcc, you could also investigate the LSB compiler environment.

Douglas Leeder
  • 52,368
  • 9
  • 94
  • 137
1

Cross compilation is always a difficult issue. In your case you have different c++ library versions on the two machines. In case you do not need to do this often, I suggest you try and solve your compilation issue on CentOS. It's probably the easier way round.

Azrael3000
  • 1,847
  • 12
  • 23
  • Yes. GCC is a compiler suite, so it comes with a c++ and a c compiler. Since your c++ libraries do not match, neither will your c libraries. – Azrael3000 Mar 26 '12 at 12:41