0

I am trying to deploy my application from development environment to users' computer, but I have some issues.

First, I compile and run it on my development computer (higher version Ubuntu11.04):

Ubuntu11.04$ make
Ubuntu11.04$ ./MyApp
Program runs okay.

Then I copied the binaries MyApp to two lower-version machines (users' computer):

Ubuntu10.04$ ./MyApp
/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by ./MyApp)

Ubuntu8.04$ ./MyApp
/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by ./MyApp)
/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by ./MyApp)

However, if I compile the source code on Ubuntu10.04, and run it:

Ubuntu10.04$ make
Ubuntu10.04$ ./MyApp
Program runs okay.

What should I do with this? When I compile it in development environment, how can I set the version number of the used library? I'm not directly using GLIBCXX, I think it's being used implicitly somewhere in my project.

Thx a million.

Peter

Peter Lee
  • 12,931
  • 11
  • 73
  • 100
  • Not really an answer, but possibly an alternative: CDE ( http://www.stanford.edu/~pgbovine/cde.html ) lets you package an executable with all dependencies. – phooji Jul 08 '11 at 01:21
  • It's a nice and quick workaround for demo on a different computer, but I'm afraid it's not a complete solution as I have to deploy my application to customers. – Peter Lee Jul 08 '11 at 01:30

2 Answers2

1

Did you see Link with an older version of libstdc++

I have never installed an older version of g++, but I have included a libstdc++.so in my release and that has worked for me. Best solution I have seen is get your development stuff to work on the oldest possible system. We compile some stuff on Red Hat 9 and it work on everything, but it can be any major issue building on old machines as you say.

Community
  • 1
  • 1
masebase
  • 4,915
  • 3
  • 24
  • 20
  • Hi Paul, thx for your reply. `As for setting up your build system to use only a specific version of the compiler: make sure the standard g++ can't be used (rename the link, remove the package providing it, take it out of PATH)`, what does this mean? I have to install an old version of g++? – Peter Lee Jul 08 '11 at 03:44
  • By the way, as you have said, how to `but I have included a libstdc++.so in my release` (I'm not using it directly, I think it is depended implicitly somewhere). I also want to do this. I have even statically linked boost libs. Is there a corresponding static version of `libstdc++.a`? – Peter Lee Jul 08 '11 at 03:47
  • If you do a ll on /usr/bin/g++ you will find it is link to g++-4.5. They are saying you should change that to point to an older version. I also just noticed on Ubuntu 11.04 that g++.4.4 is in the repository you might try installing it and see if it works by changing the link or just using g++4.4 as your compiler. – masebase Jul 08 '11 at 12:19
  • As for including libstdc++.so you can use the LD_LIBRARY_PATH and point it to all the shared libraries you want to use. Google earth is a good example of this. On the latest version of Google earth I see a ton of .so file in /opt/google/earth/free are they are all overriding the systems version. Hope this makes sense. – masebase Jul 08 '11 at 12:28
  • Thanks for your reply. I googled about LD_LIBRARY_PATH, and I was suggested not to use it. And I found another solution is to add `-static-libstdc++` to the link flags. – Peter Lee Jul 08 '11 at 17:58
0

You have built on version N, and tried to deploy on version M, M<N. You will need to get the deployment computer upgraded, or learn the procedure to compile and link targeting an older version. Since the problem lives in libstdc++, I'm afraid that my advice is to downgrade your entire dev system or upgrade the target, libstdc++ is not easy to deal with. Another answer here has someone's recipe.

Keep in mind that the Ubuntu/Debian community is optimized for open source. From their point of view, the solution to this is for you to distribute source code with the auto* tools, and let the user built it for him or her-self. They don't stay up late making this easy for you.

Here in the evil world of closed source, we keep around VMs running all sorts of old linux distros just so that we can build a single binary that runs in many places.

bmargulies
  • 97,814
  • 39
  • 186
  • 310
  • I'm also thinking of "learn the procedure to compile and link targeting an older version". Say we allow 10.04 users to run my app, we should be able to figure out what version of a specified lib. Maybe, as you said, we should downgrade my dev environment to 10.04, but I'm afraid my dev tools won't run on lower version machines. Very frustrated :-( Thanks for your reply. – Peter Lee Jul 08 '11 at 01:33
  • The problem is that I don't know if Ubuntu even packages what you'd need. – bmargulies Jul 08 '11 at 01:35
  • If you have a noninteractive build process, then you could do your development on the more recent installation, and have a (semi-)automated process to build binaries for deployment on an older installation. If you build a proper Debian package, you can use an existing autobuilder. – Simon Richter Jul 08 '11 at 01:55
  • Hi Simon, thanks for your reply. I'm using CMake to generate my project Makefiles. Then I do `mkdir build; cd build; cmake .. -DCMAKE_BUILD_TYPE=Release; make` to generate. I googled and also found that CMake support Debian packaging, but I just cannot find a good tutorial for this. Please also have a look at this: http://stackoverflow.com/questions/6601403/how-to-deploy-installer-uninstaller-software-to-ubuntu-as-standalone-and-servic – Peter Lee Jul 08 '11 at 03:06