1

I've written a program which compiles and runs as expected (without problems) on my Ubuntu 12.10 distribution at home. I then transfer my program to my university server, where I was first met with an error (similar to this question)

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

As suggested in the thread, I then added -static-libstdc++ to the linker settings, such that I use static linking. Now I get the error

undefined symbol: _ZNSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE

I haven't been able to find any information about this online, but I thought perhaps it is yet another linker problem. If anyone has some input, I would be happy to read it as I am all out of good ideas.

3
  • Why not try explicit dynamic linking? Commented Apr 4, 2013 at 18:48
  • @bash.d Thanks for the suggestion. How can I tell my compiler that I want that? Commented Apr 4, 2013 at 18:49
  • Usually this happens automatically; it seems that the target machine does not have the same library as you do. Maybe this helps you Commented Apr 4, 2013 at 18:52

2 Answers 2

1

This is a pretty standard example of compiling against one version of the C runtime library and trying to run it against another. Statically compiling should help.

Sign up to request clarification or add additional context in comments.

5 Comments

I tried adding -static, and now I get the error FATAL: Kernel too old.. segmentation fault
I'm afraid you will need to match your university server environment on your ubuntu machine and compile against that in order for it to work. Make sure that the architectures are compatible (32- vs. 64-bit). Wouldn't it just be easier to port the code to the university machine and build it there?
I'm using the Boost library on my Ubuntu machine at home.. I highly doubt that the university server has that :-(. Does this mean that the university server also needs to run Ubuntu 12.10 in order for this to work? Or is it something related to the C++ libraries only?
Nope. Recompile in the new environment. If the C library changes in an incompatible way, it's a sure bet there are many deeper problems.
If the university server doesn't have it installed, you can install it in your home dir or download the source and build it yourself. That will be easier than trying to shoe-horn the software built on Ubuntu to run on RHEL (or whatever your university is running).
1

Did you add -static when building?

1 Comment

The only thing I have done is to add -static-libstdc++ to the linker settings of my IDE (CodeBlocks)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.