2009年2月16日

[mysql 14726] Re: CentOSでの静的リンクについて

返信ありがとうございます。

ライブラリの指定を並べ替えてコンパイルしてみました。
結果は少しエラー内容が変わりましたが、エラーのままです。
$ gcc -o hoge hoge.o -L/lib -L/usr/lib -L/usr/local/lib
-L/usr/lib/mysql -L/home /yamanaka/src/lib -static -lmysqlclient
-lhttpaccess -lkrb5support -lk5crypto -lgssapi_krb5 -lcom_err -lresolv
-ldl -lselinux -lsepol -lhpdf -lpng -lz -lm -lcrypt -lcrypto -lssl -lnsl

/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+0x55df): 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+0x51e5): warning: Using 'getservbyname' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
(.text+0x1b4): undefined reference to `dlsym'
/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
(.text+0x299): undefined reference to `dlerror'
/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
(.text+0x334): undefined reference to `dlsym'
/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
(.text+0x419): undefined reference to `dlerror'
/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
(.text+0x495): undefined reference to `dlclose'
/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
(.text+0x594): undefined reference to `dlopen'
/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
(.text+0x60a): undefined reference to `dlclose'
/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
(.text+0x641): undefined reference to `dlerror'
/usr/lib/libssl.a(t1_enc.o): In function `tls1_change_cipher_state':
(.text+0xfb7): undefined reference to `COMP_CTX_free'
/usr/lib/libssl.a(t1_enc.o): In function `tls1_change_cipher_state':
(.text+0xfd0): undefined reference to `COMP_CTX_new'
/usr/lib/libssl.a(t1_enc.o): In function `tls1_change_cipher_state':
(.text+0x107e): undefined reference to `COMP_CTX_free'
/usr/lib/libssl.a(t1_enc.o): In function `tls1_change_cipher_state':
(.text+0x1097): undefined reference to `COMP_CTX_new'
/usr/lib/libssl.a(ssl_lib.o): In function `SSL_CTX_load_verify_locations':
(.text+0xbca): undefined reference to `X509_STORE_load_locations'
/usr/lib/libssl.a(ssl_lib.o): In function
`SSL_CTX_set_default_verify_paths':
(.text+0xbfc): undefined reference to `X509_STORE_set_default_paths'
/usr/lib/libssl.a(ssl_lib.o): In function `ssl_init_wbio_buffer':
(.text+0x1205): undefined reference to `BIO_f_buffer'
/usr/lib/libssl.a(ssl_lib.o): In function `ssl_clear_cipher_ctx':
(.text+0x12bf): undefined reference to `COMP_CTX_free'
/usr/lib/libssl.a(ssl_lib.o): In function `ssl_clear_cipher_ctx':
(.text+0x12db): undefined reference to `COMP_CTX_free'
/usr/lib/libssl.a(ssl_lib.o): In function `SSL_set_rfd':
(.text+0x28a3): undefined reference to `BIO_s_socket'
/usr/lib/libssl.a(ssl_lib.o): In function `SSL_set_wfd':
(.text+0x29c3): undefined reference to `BIO_s_socket'
/usr/lib/libssl.a(ssl_lib.o): In function `SSL_set_fd':
(.text+0x2aa4): undefined reference to `BIO_s_socket'
/usr/lib/libssl.a(ssl_err2.o): In function `SSL_load_error_strings':
(.text+0x13): undefined reference to `ERR_load_crypto_strings'
/usr/lib/libssl.a(ssl_cert.o): In function
`SSL_add_file_cert_subjects_to_stack':
(.text+0x10e): undefined reference to `PEM_read_bio_X509'
/usr/lib/libssl.a(ssl_cert.o): In function
`SSL_add_dir_cert_subjects_to_stack':
(.text+0x276): undefined reference to `OPENSSL_DIR_read'
/usr/lib/libssl.a(ssl_cert.o): In function
`SSL_add_dir_cert_subjects_to_stack':
(.text+0x319): undefined reference to `OPENSSL_DIR_end'
/usr/lib/libssl.a(ssl_cert.o): In function `SSL_load_client_CA_file':
(.text+0x6ce): undefined reference to `PEM_read_bio_X509'
/usr/lib/libssl.a(ssl_cert.o): In function `ssl_cert_dup':
(.text+0xeed): undefined reference to `d2i_DHparams'
/usr/lib/libssl.a(ssl_cert.o): In function `ssl_cert_dup':
(.text+0xef7): undefined reference to `i2d_DHparams'
/usr/lib/libssl.a(ssl_ciph.o): In function `load_builtin_compressions':
(.text+0x3c6): undefined reference to `COMP_zlib'
/usr/lib/libssl.a(ssl_ciph.o): In function `ssl_cipher_get_evp':
(.text+0x15de): undefined reference to `EVP_enc_null'
/usr/lib/libssl.a(ssl_rsa.o): In function
`SSL_CTX_use_certificate_chain_file':
(.text+0x2e6): undefined reference to `PEM_read_bio_X509'
/usr/lib/libssl.a(ssl_rsa.o): In function
`SSL_CTX_use_certificate_chain_file':
(.text+0x382): undefined reference to `PEM_read_bio_X509'
/usr/lib/libssl.a(ssl_rsa.o): In function `SSL_CTX_use_PrivateKey_file':
(.text+0x98d): undefined reference to `PEM_read_bio_PrivateKey'
/usr/lib/libssl.a(ssl_rsa.o): In function `SSL_use_PrivateKey_file':
(.text+0xcd3): undefined reference to `PEM_read_bio_PrivateKey'
/usr/lib/libssl.a(ssl_rsa.o): In function `SSL_CTX_use_RSAPrivateKey_file':
(.text+0x1003): undefined reference to `PEM_read_bio_RSAPrivateKey'
/usr/lib/libssl.a(ssl_rsa.o): In function `SSL_use_RSAPrivateKey_file':
(.text+0x13a9): undefined reference to `PEM_read_bio_RSAPrivateKey'
/usr/lib/libssl.a(ssl_rsa.o): In function `SSL_CTX_use_certificate_file':
(.text+0x16c0): undefined reference to `PEM_read_bio_X509'
/usr/lib/libssl.a(ssl_rsa.o): In function `SSL_use_certificate_file':
(.text+0x1896): undefined reference to `PEM_read_bio_X509'
/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_tgt_is_available':
(.text+0x2ea): undefined reference to `krb5_init_context'
/usr/lib/libssl.a(kssl.o): In function `kssl_tgt_is_available':
(.text+0x306): undefined reference to `krb5_free_principal'
/usr/lib/libssl.a(kssl.o): In function `kssl_tgt_is_available':
(.text+0x31c): undefined reference to `krb5_free_principal'
/usr/lib/libssl.a(kssl.o): In function `kssl_tgt_is_available':
(.text+0x32b): undefined reference to `krb5_free_context'
/usr/lib/libssl.a(kssl.o): In function `kssl_tgt_is_available':
(.text+0x36b): undefined reference to `krb5_sname_to_principal'
/usr/lib/libssl.a(kssl.o): In function `kssl_tgt_is_available':
(.text+0x385): undefined reference to `krb5_cc_default'
/usr/lib/libssl.a(kssl.o): In function `kssl_tgt_is_available':
(.text+0x3a6): undefined reference to `krb5_cc_get_principal'
/usr/lib/libssl.a(kssl.o): In function `kssl_tgt_is_available':
(.text+0x3d8): undefined reference to `krb5_get_credentials'
/usr/lib/libssl.a(kssl.o): In function `kssl_keytab_is_available':
(.text+0x445): undefined reference to `krb5_init_context'
/usr/lib/libssl.a(kssl.o): In function `kssl_keytab_is_available':
(.text+0x46e): undefined reference to `krb5_kt_resolve'
/usr/lib/libssl.a(kssl.o): In function `kssl_keytab_is_available':
(.text+0x4aa): undefined reference to `krb5_sname_to_principal'
/usr/lib/libssl.a(kssl.o): In function `kssl_keytab_is_available':
(.text+0x4d7): undefined reference to `krb5_kt_get_entry'
/usr/lib/libssl.a(kssl.o): In function `kssl_keytab_is_available':
(.text+0x4fa): undefined reference to `krb5_kt_close'
/usr/lib/libssl.a(kssl.o): In function `kssl_keytab_is_available':
(.text+0x510): undefined reference to `krb5_free_principal'
/usr/lib/libssl.a(kssl.o): In function `kssl_keytab_is_available':
(.text+0x51f): undefined reference to `krb5_free_context'
/usr/lib/libssl.a(kssl.o): In function `kssl_keytab_is_available':
(.text+0x538): undefined reference to `krb5_kt_free_entry'
/usr/lib/libssl.a(kssl.o): In function `kssl_keytab_is_available':
(.text+0x54e): undefined reference to `krb5_kt_default'
/usr/lib/libssl.a(kssl.o): In function `populate_cksumlens':
(.text+0xa97): undefined reference to `valid_cksumtype'
/usr/lib/libssl.a(kssl.o): In function `populate_cksumlens':
(.text+0xac1): undefined reference to `krb5_checksum_size'
/usr/lib/libssl.a(kssl.o): In function `populate_cksumlens':
(.text+0xafa): undefined reference to `krb5_checksum_size'
/usr/lib/libssl.a(kssl.o): In function `kssl_check_authent':
(.text+0x1378): undefined reference to `d2i_KRB5_ENCDATA'
/usr/lib/libssl.a(kssl.o): In function `kssl_check_authent':
(.text+0x1435): undefined reference to `KRB5_ENCDATA_free'
/usr/lib/libssl.a(kssl.o): In function `kssl_check_authent':
(.text+0x1526): undefined reference to `d2i_KRB5_AUTHENT'
/usr/lib/libssl.a(kssl.o): In function `kssl_check_authent':
(.text+0x15ce): undefined reference to `KRB5_AUTHENT_free'
/usr/lib/libssl.a(kssl.o): In function `kssl_cget_tkt':
(.text+0x16c1): undefined reference to `krb5_init_context'
/usr/lib/libssl.a(kssl.o): In function `kssl_cget_tkt':
(.text+0x16fd): undefined reference to `krb5_sname_to_principal'
/usr/lib/libssl.a(kssl.o): In function `kssl_cget_tkt':
(.text+0x175e): undefined reference to `krb5_free_principal'
/usr/lib/libssl.a(kssl.o): In function `kssl_cget_tkt':
(.text+0x1777): undefined reference to `krb5_free_principal'
/usr/lib/libssl.a(kssl.o): In function `kssl_cget_tkt':
(.text+0x178d): undefined reference to `krb5_auth_con_free'
/usr/lib/libssl.a(kssl.o): In function `kssl_cget_tkt':
(.text+0x179c): undefined reference to `krb5_free_context'
/usr/lib/libssl.a(kssl.o): In function `kssl_cget_tkt':
(.text+0x17be): undefined reference to `krb5_cc_default'
/usr/lib/libssl.a(kssl.o): In function `kssl_cget_tkt':
(.text+0x17e0): undefined reference to `krb5_cc_get_principal'
/usr/lib/libssl.a(kssl.o): In function `kssl_cget_tkt':
(.text+0x18a1): undefined reference to `krb5_get_credentials'
/usr/lib/libssl.a(kssl.o): In function `kssl_cget_tkt':
(.text+0x1925): undefined reference to `krb5_mk_req_extended'
/usr/lib/libssl.a(kssl.o): In function `kssl_cget_tkt':
(.text+0x1999): undefined reference to `d2i_KRB5_APREQ'
/usr/lib/libssl.a(kssl.o): In function `kssl_cget_tkt':
(.text+0x19b6): undefined reference to `i2d_KRB5_ENCDATA'
/usr/lib/libssl.a(kssl.o): In function `kssl_cget_tkt':
(.text+0x19d2): undefined reference to `KRB5_APREQ_free'
/usr/lib/libssl.a(kssl.o): In function `kssl_cget_tkt':
(.text+0x1aaf): undefined reference to `i2d_KRB5_ENCDATA'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x1ca7): undefined reference to `krb5_auth_con_free'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x1cd3): undefined reference to `krb5_auth_con_init'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x1d0c): undefined reference to `krb5_kt_close'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x1d25): undefined reference to `krb5_free_ticket'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x1d3e): undefined reference to `krb5_free_principal'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x1d6e): undefined reference to `krb5_auth_con_getrcache'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x1dae): undefined reference to `krb5_sname_to_principal'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x1de2): undefined reference to `krb5_auth_con_setrcache'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x1e13): undefined reference to `krb5_kt_resolve'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x1e40): undefined reference to `d2i_KRB5_TICKET'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x1ea3): undefined reference to `KRB5_TICKET_free'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x1f3d): undefined reference to `krb5_init_context'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x1f8e): undefined reference to `krb5_get_server_rcache'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x1fe1): undefined reference to `krb5_principal_compare'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x2069): undefined reference to `krb5_kt_default'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x20c9): undefined reference to `krb5_kt_get_entry'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x213f): undefined reference to `krb5_decrypt_tkt_part'
/usr/lib/libssl.a(kssl.o): In function `kssl_sget_tkt':
(.text+0x2165): undefined reference to `krb5_kt_free_entry'
/usr/lib/libssl.a(s3_srvr.o): In function `ssl3_get_cert_verify':
(.text+0x85e): undefined reference to `X509_certificate_type'
/usr/lib/libssl.a(s3_srvr.o): In function `ssl3_send_server_key_exchange':
(.text+0x1e98): undefined reference to `d2i_DHparams'
/usr/lib/libssl.a(s3_srvr.o): In function `ssl3_send_server_key_exchange':
(.text+0x1ea6): undefined reference to `i2d_DHparams'
/usr/lib/libssl.a(s3_clnt.o): In function `ssl3_check_cert_and_algorithm':
(.text+0xda): undefined reference to `X509_certificate_type'
/usr/lib/libssl.a(s3_clnt.o): In function `ssl3_send_client_key_exchange':
(.text+0x2b45): undefined reference to `d2i_DHparams'
/usr/lib/libssl.a(s3_clnt.o): In function `ssl3_send_client_key_exchange':
(.text+0x2b53): undefined reference to `i2d_DHparams'
/usr/lib/libssl.a(s3_lib.o): In function `.L140':
(.text+0x81e): undefined reference to `d2i_DHparams'
/usr/lib/libssl.a(s3_lib.o): In function `.L140':
(.text+0x82c): undefined reference to `i2d_DHparams'
/usr/lib/libssl.a(s3_lib.o): In function `.L189':
(.text+0xb90): undefined reference to `d2i_DHparams'
/usr/lib/libssl.a(s3_lib.o): In function `.L189':
(.text+0xb9a): undefined reference to `i2d_DHparams'
/usr/lib/libssl.a(s3_enc.o): In function `ssl3_change_cipher_state':
(.text+0xec1): undefined reference to `COMP_CTX_free'
/usr/lib/libssl.a(s3_enc.o): In function `ssl3_change_cipher_state':
(.text+0xed7): undefined reference to `COMP_CTX_new'
/usr/lib/libssl.a(s3_enc.o): In function `ssl3_change_cipher_state':
(.text+0xf69): undefined reference to `COMP_CTX_free'
/usr/lib/libssl.a(s3_enc.o): In function `ssl3_change_cipher_state':
(.text+0xf7f): undefined reference to `COMP_CTX_new'
/usr/lib/libssl.a(s3_pkt.o): In function `ssl3_do_compress':
(.text+0x336): undefined reference to `COMP_compress_block'
/usr/lib/libssl.a(s3_pkt.o): In function `ssl3_do_uncompress':
(.text+0x956): undefined reference to `COMP_expand_block'
collect2: ld はステータス 1 で終了しました

> 指摘し忘れていましたが「-lmysqlclient」が「-lssl」よりも右に
> 指定してあるのは、おかしいです。
> 他に「-lssl」より右のライブラリー群でsslライブラリーを呼んだ
> り、「-lcrypto」より右のライブラリー群でcryptoライブラリーを
> 呼んだりしていないですか?

上記のほかにもライブラリの順番を変えてみましたが
(ライブラリ指定の最後の4つ -lssl -lnsl -lcrypt -lcrypto を入れ替えてみ
ました)
しかし結果は上記と同じでした。

やっぱりyumでの運用は無理なのかと諦めかけ
別のマシンを用意して mysql-5.0.75.tar.gz をMySQLのサイトからダウンロード
して展開し
# ./configure --with-charset=ujis --with-extra-charsets=all
--with-other-libc=/usr/lib/ --with-client-ldflags=-all-static
# make
# make install
を行いました。
その後、上記と同様にコンパイルを実行したところSSL関係のエラーは表示され
なくなったものの glibc のエラーは残ったままでした。
/usr/local/lib/mysql/libmysqlclient.a(mf_pack.o): In function
`unpack_dirname':
mf_pack.c:(.text+0x906): warning: Using 'getpwnam' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/local/lib/mysql/libmysqlclient.a(libmysql.o): In function
`read_user_name':
libmysql.c:(.text+0x2f2f): warning: Using 'getpwuid' in statically
linked applications requires at runtime the shared libraries from the
glibc version used for linking
/usr/local/lib/mysql/libmysqlclient.a(mf_pack.o): In function
`unpack_dirname':
mf_pack.c:(.text+0x90f): warning: Using 'endpwent' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/local/lib/mysql/libmysqlclient.a(my_gethostbyname.o): In function
`my_gethostbyname_r':
my_gethostbyname.c:(.text+0x30): warning: Using 'gethostbyname_r' in
statically linked applications requires at runtime the shared libraries
from the glibc version used for linking
/usr/local/lib/mysql/libmysqlclient.a(libmysql.o): In function
`mysql_server_init':
libmysql.c:(.text+0x34b5): warning: Using 'getservbyname' in statically
linked applications requires at runtime the shared libraries from the
glibc version used for linking
/usr/local/lib/mysql/libmysqlclient.a(my_compress.o): In function
`my_uncompress':
my_compress.c:(.text+0x60): undefined reference to `uncompress'
/usr/local/lib/mysql/libmysqlclient.a(my_compress.o): In function
`my_compress_alloc':
my_compress.c:(.text+0x102): undefined reference to `compress'
/usr/local/lib/mysql/libmysqlclient.a(my_compress.o): In function
`my_compress':
my_compress.c:(.text+0x1ae): undefined reference to `compress'
collect2: ld はステータス 1 で終了しました
make: *** [nc_entry.cgi] エラー 1

すいません。
よろしくお願い致します。

--------------------------------------
Power up the Internet with Yahoo! Toolbar.
http://pr.mail.yahoo.co.jp/toolbar/


投稿者 xml-rpc : 2009年2月16日 16:44
役に立ちました?:
過去のフィードバック 平均:(0) 総合:(0) 投票回数:(0)
本記事へのTrackback: http://hoop.euqset.org/blog/mt-tb2006.cgi/82232
トラックバック
コメント
コメントする




画像の中に見える文字を入力してください。