Different binary size

llewelly@xmission.com llewelly@xmission.com
Tue Mar 23 13:02:00 GMT 2004


Admin-Stress <meerkapot@yahoo.com> writes:

> I compiled a program in two machines, both are using the same gcc, MySQL library, and glibc (both
> are RedHat 9).
> 
> The first machine (MACHINE_1) produced 20 KB binary size, but in second machine (MACHINE_2)
> produced 181 KB binary size.
> 
> I know that the problem is MACHINE_2 cant dynamically link the libray. How can I fix this in
> MACHINE_2 so it can produce dynamic link? 
> 
> Here is my compile script :
> 
> gcc -o iaac iaac.c -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient -lz
> 
> Please help me.
> 
> in MACHINE_1 :
> 
> $ ldd iaac
>         libmysqlclient.so.12 => /usr/lib/libmysqlclient.so.12 (0x4001c000)
>         libz.so.1 => /usr/lib/libz.so.1 (0x40052000)
>         libc.so.6 => /lib/libc.so.6 (0x40060000)
>         libcrypt.so.1 => /lib/libcrypt.so.1 (0x40187000)
>         libnsl.so.1 => /lib/libnsl.so.1 (0x401b3000)
>         libm.so.6 => /lib/libm.so.6 (0x401c7000)
>         libnss_files.so.2 => /lib/libnss_files.so.2 (0x401e8000)
>         libnss_dns.so.2 => /lib/libnss_dns.so.2 (0x401f3000)
>         libresolv.so.2 => /lib/libresolv.so.2 (0x401f7000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

My first guess is that MACHINE_2 lacks shared versions of some of
    these libraries. Look for libcrypt.so, libnsl.so, libm.so, etc, on
    MACHINE_2. If you cannot find them, you need to install them.

> 
> in MACHINE_2 :
> 
> $ ldd iaac
>         libz.so.1 => /usr/lib/libz.so.1 (0x4001d000)
>         libc.so.6 => /lib/i686/libc.so.6 (0x4002c000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
[snip]



More information about the Gcc-help mailing list