1

This is my goal: I developed software in Linux and I need to distribute it without source code. The idea is to create a zip file that contains all the necessary items to run the executable. The user will download the zip, extract it, double-click, and the software will start on any Linux-based machine. For motivations that I'm not gonna explain, I can't use deb/rpm/etc or an installer.

The sw has the following dependencies:

  1. some libraries (written by myself that depends on OpenCV), compiled with g++, creating .a files (i.e. static libraries)
  2. OpenCV, in shared libraries, that have several depenencies

I compile my program with gcc, and I link it with:

$ gcc -o my_exe <*.o files> -L<path my_lib> -Wl,--rpath,\$$ORIGIN/lib -lm -lstdc++ -lmy_lib -lopencv

Then I do:

$ ldd my_exe

and I copy all the libraries here listed in ./lib, and I create the .zip.

I copy the zip in an another machine, the dependencies listed by ldd my_exe are satisfied and correctly point to ./lib but when I launch the program, I get the following error:

$ ./my_exe: relocation error: lib/libglib-2.0.so.0: symbol strncmp, version GLIBC_2.2.5 not defined in file libc.so.6 with link time reference

What's wrong? Where is my mistake?

Some additional info:

$ -bash-3.2$ nm -D lib/libc.so.6  |grep strncmp
0000000000083010 T strncmp
$ -bash-3.2$ strings lib/libc.so.6 |grep GLIBC_2.2
GLIBC_2.2.5
GLIBC_2.2.6

I'm using gcc 4.4.5, Ubuntu with a kernel 2.6.35 SMP, 64bit. The machine that I tried is 64bit SMP kernel 2.6 as well.

chrisaycock
  • 36,470
  • 14
  • 88
  • 125
Alessandro
  • 11
  • 2
  • Your error statement has glib version 2.0, whereas your `strings` lists glib version 2.2. Could that be the culprit? – chrisaycock Apr 27 '11 at 15:51
  • In the second machine, I do: -bash-3.2$ ldd my_exe|grep glib libglib-2.0.so.0 => lib/libglib-2.0.so.0 (0x00007fc7d5f47000) -bash-3.2$ strings lib/libglib-2.0.so.0|grep GLIB GLIBC_2.8 GLIBC_2.4 GLIBC_2.3 GLIBC_2.7 GLIBC_2.3.4 GLIBC_2.9 GLIBC_2.2.5 So, it seems that GLIBC is present. In any case in the local machine the program works.. – Alessandro Apr 27 '11 at 16:06

1 Answers1

0

You seems to re-invent what package managers (for .deb, .rpm, ...) are doing. Why don't you want to make a real package. It would make things simpler and more robust.

And since you code in C++, you will have hard time in making a thing which will work with different versions of libstdc++*.so

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547