1

Web サーバーをコンパイルしようとしましたが、以下のようなことが起こりました。

gcc -o webserv.o webserv.c -c -ansi -pedantic -Wall -lssl -lcrypto
webserv.c: In function ‘main’:
webserv.c:33: warning: ‘OPENSSL_add_all_algorithms_noconf’ is deprecated (declared at /usr/include/openssl/evp.h:828)
webserv.c:34: warning: ‘SSL_load_error_strings’ is deprecated (declared at /usr/include/openssl/ssl.h:1416)
webserv.c:36: warning: ‘TLSv1_server_method’ is deprecated (declared at /usr/include/openssl/ssl.h:1520)
webserv.c:38: warning: ‘SSL_CTX_new’ is deprecated (declared at /usr/include/openssl/ssl.h:1346)
webserv.c:40: warning: ‘ERR_print_errors_fp’ is deprecated (declared at /usr/include/openssl/err.h:287)
webserv.c:44: warning: ‘SSL_CTX_use_certificate_file’ is deprecated (declared at /usr/include/openssl/ssl.h:1402)
webserv.c:45: warning: ‘SSL_CTX_use_PrivateKey_file’ is deprecated (declared at /usr/include/openssl/ssl.h:1401)
webserv.c:47: warning: ‘SSL_CTX_check_private_key’ is deprecated (declared at /usr/include/openssl/ssl.h:1475)
webserv.c:92: warning: ‘SSL_new’ is deprecated (declared at /usr/include/openssl/ssl.h:1481)
webserv.c:94: warning: ‘ERR_print_errors_fp’ is deprecated (declared at /usr/include/openssl/err.h:287)
webserv.c:98: warning: ‘SSL_set_fd’ is deprecated (declared at /usr/include/openssl/ssl.h:1370)
webserv.c:100: warning: ‘SSL_accept’ is deprecated (declared at /usr/include/openssl/ssl.h:1491)
webserv.c:102: warning: ‘ERR_print_errors_fp’ is deprecated (declared at /usr/include/openssl/err.h:287)
webserv.c:106: warning: ‘SSL_get_version’ is deprecated (declared at /usr/include/openssl/ssl.h:1502)
webserv.c:106: warning: ‘SSL_CIPHER_get_name’ is deprecated (declared at /usr/include/openssl/ssl.h:1360)
webserv.c:106: warning: ‘SSL_get_current_cipher’ is deprecated (declared at /usr/include/openssl/ssl.h:1357)
webserv.c:114: warning: ‘SSL_shutdown’ is deprecated (declared at /usr/include/openssl/ssl.h:1532)
webserv.c:116: warning: ‘SSL_free’ is deprecated (declared at /usr/include/openssl/ssl.h:1490)
i686-apple-darwin11-llvm-gcc-4.2: -lssl: linker input file unused because linking not done
i686-apple-darwin11-llvm-gcc-4.2: -lcrypto: linker input file unused because linking not done
gcc -o helper.o helper.c -c -ansi -pedantic -Wall -lssl -lcrypto
helper.c: In function ‘Readline’:
helper.c:32: warning: ‘SSL_read’ is deprecated (declared at /usr/include/openssl/ssl.h:1493)
helper.c: In function ‘Writeline’:
helper.c:68: warning: ‘SSL_write’ is deprecated (declared at /usr/include/openssl/ssl.h:1495)
i686-apple-darwin11-llvm-gcc-4.2: -lssl: linker input file unused because linking not done
i686-apple-darwin11-llvm-gcc-4.2: -lcrypto: linker input file unused because linking not done
gcc -o servreq.o servreq.c -c -ansi -pedantic -Wall -lssl -lcrypto
i686-apple-darwin11-llvm-gcc-4.2: -lssl: linker input file unused because linking not done
i686-apple-darwin11-llvm-gcc-4.2: -lcrypto: linker input file unused because linking not done
gcc -o reqhead.o reqhead.c -c -ansi -pedantic -Wall -lssl -lcrypto
i686-apple-darwin11-llvm-gcc-4.2: -lssl: linker input file unused because linking not done
i686-apple-darwin11-llvm-gcc-4.2: -lcrypto: linker input file unused because linking not done
gcc -o resphead.o resphead.c -c -ansi -pedantic -Wall -lssl -lcrypto
i686-apple-darwin11-llvm-gcc-4.2: -lssl: linker input file unused because linking not done
i686-apple-darwin11-llvm-gcc-4.2: -lcrypto: linker input file unused because linking not done
gcc -o resource.o resource.c -c -ansi -pedantic -Wall -lssl -lcrypto
i686-apple-darwin11-llvm-gcc-4.2: -lssl: linker input file unused because linking not done
i686-apple-darwin11-llvm-gcc-4.2: -lcrypto: linker input file unused because linking not done
gcc -o webserv webserv.o helper.o servreq.o reqhead.o resphead.o resource.o -Wall -lssl -lcrypto
Undefined symbols for architecture x86_64:
  "_server_ssl", referenced from:
      _Readline in helper.o
      _Writeline in helper.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

ここで何が悪いのか誰にもわかりますか?

4

1 に答える 1

1

あなたのコンパイラは警告でリンクを中止するように設定されており、コンパイル段階でコード内に数十の「非推奨」警告が生成されたようです。したがって、コンパイラフラグを変更するか、非推奨の呼び出しを更新するかのいずれかがオプションのようです。

于 2012-05-12T01:45:58.317 に答える