0

I built protocol buffers C++ project on my local linux machine and it works fine when executed using ant-run during a java maven build still on my local machine.

However, when I transfer the generated C++ executable ("protoc_linux" in the snippet below) to another linux machine, the following error occurs:

[INFO] Executing tasks
    [mkdir] Created dir: /home/user00/jobs/n1/myHomeProject/myProject/target/generated-sources
     [exec] /home/user00/jobs/n1/myHomeProject/myProject/resources/protoc_linux: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.10' not found (required by /home/user00/jobs/n1/myHomeProject/myProject/resources/protoc_linux)
     [exec] Result: 1
[INFO] Executed tasks

Would anyone know why this happens?

elieone
  • 1
  • 1
  • This question is very similar to [/usr/lib/libstdc++.so.6: version GLIBCXX_3.4.15 not found](http://stackoverflow.com/q/5216399/1380680). You might have to update your installation on the other linux machine, or link `libstdc++` statically. – Reinier Torenbeek Feb 20 '15 at 23:39

2 Answers2

1

The problem is that your protoc binary is built against a newer version of the C++ standard libraries, and you are trying to run it on a machine that has an older version. Unfortunately, this just won't work. In general a binary built on an old Linux distro will work on new Linux distros, but binaries built on new Linux distros (especially C++ binaries) are unlikely to work on old Linux distros.

You might be able to work around this if you recompile protocol buffers linking the C++ library statically, like:

./configure LIBS='-static-libstdc++ -static-libgcc'
make clean
make

This might produce a protoc binary that works on older distros, but there can still be incompatibilities in the C library. If so, here is a great blog post describing this problem in detail and various ways to work around it:

http://insanecoding.blogspot.in/2012/07/creating-portable-linux-binaries.html

However, if you are not a C/C++ programmer normally, this is probably deeper than you want to dig to solve this problem.

Kenton Varda
  • 41,353
  • 8
  • 121
  • 105
0

Just a guess of mine: Verify that the folder "user" exists.

I devided the output line into three lines just for an better overview.

[exec] /home/user00/jobs/n1/myHomeProject/myProject/resources/protoc_linux:
       /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.10' not found
       (required by /home/user00/jobs/n1/myHomeProject/myProject/resources/protoc_linux)

It seems like you program is executed within the directory "home/user00/[...]/protoc_linux". But it requires some source that is defined to be at "/usr/[...]"

So i think on your folder "user" exists only on your first linux server, but the rest only have folders like "user00". So when executing the programm searches for a folder called "user" but cant find it, as it does not exists -> file not found exception.

Krummy
  • 658
  • 15
  • 24