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.

Community
  • 1
  • 1
BillyJean
  • 1,537
  • 1
  • 22
  • 39
  • Why not try explicit dynamic linking? – bash.d Apr 04 '13 at 18:48
  • @bash.d Thanks for the suggestion. How can I tell my compiler that I want that? – BillyJean Apr 04 '13 at 18:49
  • Usually this happens automatically; it seems that the target machine does not have the same library as you do. Maybe [this](http://frigidcode.com/articles/gcc-mixed-static-and-dynamic-linking.shtml) helps you – bash.d Apr 04 '13 at 18:52

2 Answers2

1

Did you add -static when building?

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.

metalhead
  • 558
  • 1
  • 10
  • 24
  • I tried adding `-static`, and now I get the error `FATAL: Kernel too old.. segmentation fault` – BillyJean Apr 04 '13 at 19:41
  • 1
    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? – metalhead Apr 04 '13 at 19:46
  • 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? – BillyJean Apr 04 '13 at 19:50
  • 2
    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. – vonbrand Apr 04 '13 at 23:01
  • 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). – metalhead Apr 05 '13 at 11:54