Re: RH AS2.1 Statically linked application gives reloc error in RH9.0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 15 Sep 2003 07:42:19 -0500, Muthu_T@xxxxxxxx wrote:

>    I have a statically linked application which dynamically loads the
> library. This application compiled in AS2.1 and runs fine with AS2.1 and
> RH 8.0. But in RH 9.0 it gives relocation error.
> 
> AS2.1 uses GCC 2.96.
> RH9.0 uses GCC 3.2.2.

And more important for a statically linked binary which calls
dlopen(), a different version of glibc.

> -----[ mystatic.cpp ]----------------
> 
> #include <iostream.h>
> #include <dlfcn.h>
> 
> #define LIBNAME "libz.so"
> 
> int main()
> {
>         void *pHandle = dlopen(LIBNAME, RTLD_NOW);
>         cout << "After Loading " << LIBNAME << endl << dlerror() <<
> endl;

You should really check the pointer returned by dlerror() since it can
be NULL. Don't rely on your system to print "(null)".

>         if (pHandle) {
>                 cout << "Loaded Successfully!" << endl;
>                 dlclose(pHandle);
>                 cout << "Unloaded Successfully!" << endl;
>         }
>         return 0;
> }
>
> 
> -----[ output in AS2.1 & 8.0 ] --------------------
> 
> # g++ -static mystatic.cpp  -ldl
> # ./a.out
> After Loading libz.so
> (null)
> Loaded Successfully!
> Unloaded Successfully!
> 
> ----[ output in RH 9.0 ] --------------------------
> # ./a.out
> After Loading libz.so
> /lib/tls/libc.so.6: unexpected reloc type 0x0e

You need to recompile the binary on RHL 9 or link all your stuff
statically.

- -- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/Zbfu0iMVcrivHFQRAkf+AJ4nRQrZIuUwtDHETS101j5+SdkalQCff0Hh
RU4tZ/6M9akI5wZKFpujBz8=
=s2P3
-----END PGP SIGNATURE-----


-- 
Shrike-list mailing list
Shrike-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/shrike-list

[Index of Archives]     [Fedora Users]     [Centos Users]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat Phoebe Beta]     [Yosemite Forum]     [Fedora Discussion]     [Gimp]     [Stuff]     [Yosemite News]

  Powered by Linux