Multiple GCC and multiple sets of shared libraries

Joe Hsu nagual.hsu@gmail.com
Mon Aug 14 08:04:00 GMT 2006


Hi John:
  Unfortunately, I still failed.

   My gcc-2.96 is now located in /usr/local/redhat-7.3/usr/bin/gcc.
All share libraries clonned from redhat 7.3 are now in
/usr/local/redhat-7.3/lib.

Then I have a testing program named test.c:

#include <stdio.h>
#include <pthread.h>

static pthread_cond_t cond;
int main(int argc, char *argv[])
{
       pthread_cond_init(&cond, NULL);
       return 0;
}

   Then I compile test.c using the following command:
/usr/local/redhat-7.3/usr/bin/gcc -Wl,-rpath,/usr/local/redhat-7.3 -o
test test.c -lpthread

   And then this binary executable cannot be executed in a real RedHat
7.3 environment because "./test: /lib/i686/libpthread.so.0: version
`GLIBC_2.3.2' not found (required by ./test)".

   Apparently, when compiling, /lib/i686/libpthread.so.0 is used, instead
of /usr/local/redhat-7.3/lib/i686/libpthread.so.0.

   Where do I go wrong? anybody please?



2006/8/11, John Love-Jensen <eljay@adobe.com>:
> Hi Joe,
>
> "GCC 2.96" is not a GCC release.  It is a Red Hat release, and not supported
> by GCC.
>
> You may have better luck getting your question answered on a Red Hat forum
> that supports 2.96.
>
> That being said, your question does not strike me as particular to 2.96, but
> rather a generic Linux linker & loader question.
>
> You may want to investigate the linker -rpath switch (used via
> -Wl,-rpath,/usr/local/gc/2.96 by the gcc toolchain driver), which can be
> used to bake in the desired shared library path into your application.
>
> Note for the paranoid:  there is potential for a security hole, especially
> if using relative paths.
>
> There may be other caveats, such as which path has precedence and such, that
> you'll want to double-check.
>
> HTH,
> --Eljay
>
>


-- 
The sun is shinny but the ice is slippery.



More information about the Gcc-help mailing list