LINUX.ORG.RU

Static linking


0

0

Столкнулся с проблемой - написал прожку на C которая работает с mysql, когда компиля с dynamic linking все работает отлично, но мне нужен static linking и при компиляции я получаю вот такую мессагу: gcc test.c -I/usr/include/mysql -fexceptions -fstack-protector --param=ssp-buffer-size=4 -L/usr/lib/mysql -lmysqlclient -lcrypt -lnsl -L/usr/lib -lssl -lcrypto -static test.c: In function ‘main’: test.c:29: warning: return type of ‘main’ is not ‘int’ test.c:167:35: warning: no newline at end of file /usr/lib/mysql/libmysqlclient.a(mf_pack.o): In function `unpack_dirname': (.text+0x5d0): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/mysql/libmysqlclient.a(libmysql.o): In function `read_user_name': (.text+0x54af): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/mysql/libmysqlclient.a(mf_pack.o): In function `unpack_dirname': (.text+0x5df): warning: Using 'endpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/mysql/libmysqlclient.a(my_gethostbyname.o): In function `my_gethostbyname_r': (.text+0x30): warning: Using 'gethostbyname_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/mysql/libmysqlclient.a(libmysql.o): In function `mysql_server_init': (.text+0x50b1): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/mysql/libmysqlclient.a(my_compress.o): In function `my_uncompress': (.text+0x60): undefined reference to `uncompress' /usr/lib/mysql/libmysqlclient.a(my_compress.o): In function `my_compress_alloc': (.text+0x102): undefined reference to `compress' /usr/lib/libssl.a(kssl.o): In function `get_rc_clockskew': (.text+0x111): undefined reference to `krb5_rc_default' /usr/lib/libssl.a(kssl.o): In function `get_rc_clockskew': (.text+0x12c): undefined reference to `krb5_rc_initialize' /usr/lib/libssl.a(kssl.o): In function `get_rc_clockskew': (.text+0x152): undefined reference to `krb5_rc_get_lifespan' /usr/lib/libssl.a(kssl.o): In function `get_rc_clockskew': (.text+0x16c): undefined reference to `krb5_rc_destroy' /usr/lib/libssl.a(kssl.o): In function `kssl_validate_times': (.text+0x1a4): undefined reference to `krb5_init_context' /usr/lib/libssl.a(kssl.o): In function `kssl_validate_times': (.text+0x1c7): undefined reference to `krb5_timeofday' /usr/lib/libssl.a(kssl.o): In function `kssl_validate_times': (.text+0x1ea): undefined reference to `krb5_free_context' /usr/lib/libssl.a(kssl.o): In function `kssl_krb5_free_data_contents': (.text+0x271): undefined reference to `krb5_free_data_contents' /usr/lib/libssl.a(kssl.o): In function `kssl_keytab_is_available': (.text+0x2b5): undefined reference to `krb5_init_context' /usr/lib/libssl.a(kssl.o): In function `kssl_keytab_is_available': (.text+0x2de): undefined reference to `krb5_kt_resolve' /usr/lib/libssl.a(kssl.o): In function `kssl_keytab_is_available': (.text+0x31a): undefined reference to `krb5_sname_to_principal' /usr/lib/libssl.a(kssl.o): In function `kssl_keytab_is_available': (.text+0x347): undefined reference to `krb5_kt_get_entry' /usr/lib/libssl.a(kssl.o): In function `kssl_keytab_is_available': (.text+0x36a): undefined reference to `krb5_kt_close' /usr/lib/libcrypto.a(c_zlib.o): In function `zlib_stateful_expand_block': (.text+0x96): undefined reference to `inflate' /usr/lib/libcrypto.a(c_zlib.o): In function `zlib_stateful_compress_block': (.text+0x126): undefined reference to `deflate' collect2: ld returned 1 exit status

В чем может быть проблема?

P.S. Это мой первый опыт писания под Linux, дистр Fedora 8, все либы и хедеры стоят.

anonymous

Re: Static linking

офтоп: Видимо на лоре сообщения тоже пишите впервые?)) Форматирование кошмар.

aton ()

Re: Static linking

>gcc test.c -I/usr/include/mysql -fexceptions -fstack-protector --param=ssp-buffer-size=4 -L/usr/lib/mysql -lmysqlclient -lcrypt -lnsl -L/usr/lib -lssl -lcrypto -static

добавь линковку zlib и керберос5.

и -static рекомендую указывать до указания первой либы.

cvv ★★★★★ ()

Re: Static linking

> В чем может быть проблема?

мои глаза O_o

anonymous ()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.