出于某种原因,我在这个特定的C ++文件中获得了MD5和RAND_bytes的未定义符号。 OpenSSL已将自身(libssl和libcrypto)安装到/ usr / lib和/ usr / include / openssl /。
libtool: link: (cd ".libs" && rm -f "libeapgpsk.so.1" && ln -s "libeapgpsk.so.1.0.0" "libeapgpsk.so.1")
libtool: link: (cd ".libs" && rm -f "libeapgpsk.so" && ln -s "libeapgpsk.so.1.0.0" "libeapgpsk.so")
libtool: link: ar cru .libs/libeapgpsk.a eap-gpsk/eap_gpsk_fsm.o
libtool: link: ranlib .libs/libeapgpsk.a
libtool: link: ( cd ".libs" && rm -f "libeapgpsk.la" && ln -s "../libeapgpsk.la" "libeapgpsk.la" )
depbase=`echo tests/md5_test.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
g++ -DPACKAGE_NAME=\"OpenDiameter\" -DPACKAGE_TARNAME=\"opendiameter\" -DPACKAGE_VERSION=\"1.0.7-i\" -DPACKAGE_STRING=\"OpenDiameter\ 1.0.7-i\" -DPACKAGE_BUGREPORT=\"vfajardo@tari.toshiba.com\" -DPACKAGE_URL=\"\" -DPACKAGE=\"opendiameter\" -DVERSION=\"1.0.7-i\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_IFADDRS_H=1 -DHAVE_SHADOW_H=1 -DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1 -DHAVE_GETIFADDRS=1 -I. -Wall -I/usr -I/usr -fno-strict-aliasing -I../include -I../libeap/include -DOS_LINUX -I/usr/include/openssl -I/usr/include/openssl -MT tests/md5_test.o -MD -MP -MF $depbase.Tpo -c -o tests/md5_test.o tests/md5_test.cxx &&\
mv -f $depbase.Tpo $depbase.Po
In file included from ../include/aaa_dictionary_api.h:45:0,
from ../include/aaa_parser_api.h:38,
from ../libeap/include/eap.hxx:54,
from tests/md5_test.cxx:45:
../include/framework.h:1653:7: warning: ‘typedef’ was ignored in this declaration [enabled by default]
In file included from ../include/aaa_parser_api.h:38:0,
from ../libeap/include/eap.hxx:54,
from tests/md5_test.cxx:45:
../include/aaa_dictionary_api.h:58:1: warning: ‘typedef’ was ignored in this declaration [enabled by default]
tests/md5_test.cxx: In constructor ‘EapTask::EapTask()’:
tests/md5_test.cxx:71:45: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
tests/md5_test.cxx: In constructor ‘PeerApplication::PeerApplication(EapTask&, ACE_Semaphore&)’:
tests/md5_test.cxx:418:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
tests/md5_test.cxx: In constructor ‘StandAloneAuthApplication::StandAloneAuthApplication(EapTask&, ACE_Semaphore&)’:
tests/md5_test.cxx:460:80: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
tests/md5_test.cxx: In constructor ‘BackendAuthApplication::BackendAuthApplication(EapTask&, ACE_Semaphore&, bool)’:
tests/md5_test.cxx:514:58: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
tests/md5_test.cxx: In constructor ‘PassThroughAuthApplication::PassThroughAuthApplication(EapTask&, ACE_Semaphore&, bool)’:
tests/md5_test.cxx:576:62: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
/bin/bash ../libtool --tag=CXX --mode=link g++ -I/usr/include/openssl -L/usr/lib -o md5_test tests/md5_test.o -ldl -lssl -lcrypto -lACE_SSL -lACE -lACEXML_Parser -lACEXML -lpthread -lboost_system -lboost_thread -lboost_system -lboost_thread -lACEXML -lACEXML_Parser -ldl -lssl -lcrypto ../libeap/libeap.la ../libeap/libeaparchie.la ../libeap/libeapgpsk.la -lboost_system -lboost_thread -lACEXML -lACEXML_Parser -ldl -lssl -lcrypto
libtool: link: g++ -I/usr/include/openssl -o .libs/md5_test tests/md5_test.o -L/usr/lib /usr/lib/libACE_SSL.so /usr/lib/libACE.so -lpthread ../libeap/.libs/libeap.so ../libeap/.libs/libeaparchie.so ../libeap/.libs/libeapgpsk.so -lboost_system -lboost_thread /usr/lib/libACEXML.so /usr/lib/libACEXML_Parser.so -ldl -lssl -lcrypto
../libeap/.libs/libeap.so: undefined reference to `MD5@OPENSSL_1.0.0'
../libeap/.libs/libeap.so: undefined reference to `RAND_bytes@OPENSSL_1.0.0'
collect2: ld returned 1 exit status
以下是Makefile.am对此负责:
## Process this file with automake to produce Makefile.in
srcdir = @srcdir@
VPATH = @srcdir@
AM_CPPFLAGS = @L_CPPFLAGS@ \
-I@top_srcdir@/include \
-I@top_srcdir@/libeap/include \
-D@HOST_OS@
AM_LDFLAGS = @L_LDFLAGS@
if compile_EAPTLS
CORE_SRC = eapcore/eap_fsm.cxx \
eapcore/eap_peerfsm.cxx \
eapcore/eap_authfsm.cxx \
eapcore/eap_standalone_authfsm.cxx \
eapcore/eap_backend_authfsm.cxx \
eapcore/eap_passthrough_authfsm.cxx \
eapcore/eap_identity.cxx \
eapcore/eap_method_registrar.cxx \
eapcore/eap_policy.cxx \
eapcore/eap_notification.cxx \
eapcore/eap_md5.cxx
CORE_HDR = include/eap_api.h \
include/eap.hxx \
include/eap_authfsm.hxx \
include/eap_fsm.hxx \
include/eap_identity.hxx \
include/eap_log.hxx \
include/eap_md5.hxx \
include/eap_method_registrar.hxx \
include/eap_notification.hxx \
include/eap_parser.hxx \
include/eap_peerfsm.hxx \
include/eap_policy.hxx \
include/eap_archie_crypto.hxx \
include/eap_archie_fsm.hxx \
include/eap_archie_parser.hxx \
include/eap_archie.hxx \
include/eap_gpsk_crypto.hxx \
include/eap_gpsk_fsm.hxx \
include/eap_gpsk_parser.hxx \
include/eap_gpsk.hxx \
include/eap_tls.hxx \
include/eap_tls_mng.hxx \
include/eap_tls_session.hxx \
include/eap_tls_parser.hxx \
include/eap_tls_fsm.hxx \
include/eap_tls_xml_data.hxx \
include/eap_tls_xml_parser.hxx \
include/eap_tls_data_defs.hxx
else
CORE_SRC = eapcore/eap_fsm.cxx \
eapcore/eap_peerfsm.cxx \
eapcore/eap_authfsm.cxx \
eapcore/eap_standalone_authfsm.cxx \
eapcore/eap_backend_authfsm.cxx \
eapcore/eap_passthrough_authfsm.cxx \
eapcore/eap_identity.cxx \
eapcore/eap_method_registrar.cxx \
eapcore/eap_policy.cxx \
eapcore/eap_notification.cxx \
eapcore/eap_md5.cxx
CORE_HDR = include/eap_api.h \
include/eap.hxx \
include/eap_authfsm.hxx \
include/eap_fsm.hxx \
include/eap_identity.hxx \
include/eap_log.hxx \
include/eap_md5.hxx \
include/eap_method_registrar.hxx \
include/eap_notification.hxx \
include/eap_parser.hxx \
include/eap_peerfsm.hxx \
include/eap_policy.hxx \
include/eap_archie_crypto.hxx \
include/eap_archie_fsm.hxx \
include/eap_archie_parser.hxx \
include/eap_archie.hxx \
include/eap_gpsk_crypto.hxx \
include/eap_gpsk_fsm.hxx \
include/eap_gpsk_parser.hxx \
include/eap_gpsk.hxx
endif
ARCHIE_SRC = eap-archie/eap_archie_fsm.cxx
GPSK_SRC = eap-gpsk/eap_gpsk_fsm.cxx
if compile_EAPTLS
TLS_SRC = eap-tls/eap_tls_mng.cxx \
eap-tls/eap_tls_crypto.cxx \
eap-tls/eap_tls_fsm.cxx \
eap-tls/eap_tls_xml_data.cxx \
eap-tls/eap_tls_xml_parser.cxx
endif
includedir = $(prefix)/include/opendiameter/eap
include_HEADERS = $(CORE_HDR)
sysconfdir = $(prefix)/etc/opendiameter/eap
sysconf_DATA = config/client.eap-tls.xml \
config/server.eap-tls.xml
if compile_EAPTLS
lib_LTLIBRARIES = libeap.la libeaparchie.la libeapgpsk.la libeaptls.la
else
lib_LTLIBRARIES = libeap.la libeaparchie.la libeapgpsk.la
endif
libeap_la_SOURCES = $(CORE_SRC) $(CORE_HDR)
libeaparchie_la_SOURCES = $(ARCHIE_SRC)
libeapgpsk_la_SOURCES = $(GPSK_SRC)
if compile_EAPTLS
libeaptls_la_SOURCES = $(TLS_SRC)
endif
libeap_la_LIBADD = -ldl -lssl -lcrypto
libeap_la_LDFLAGS = -version-info 1:0:0 -lssl -lcrypto
libeap_la_AR = $(AR) -qcs
libeaparchie_la_LDFLAGS = -version-info 1:0:0
libeaparchie_la_AR = $(AR) -qcs
libeapgpsk_la_LDFLAGS = -version-info 1:0:0
libeapgpsk_la_AR = $(AR) -qcs
if compile_EAPTLS
libeaptls_la_LDFLAGS = -version-info 1:0:0
libeaptls_la_AR = $(AR) -qcs
LDADD = @L_LIBS@ \
$(top_builddir)/libeap/libeap.la \
$(top_builddir)/libeap/libeaparchie.la \
$(top_builddir)/libeap/libeapgpsk.la \
$(top_builddir)/libeap/libeaptls.la \
$(top_builddir)/libdiamparser/libdiamparser.la
else
LDADD = @L_LIBS@ \
$(top_builddir)/libeap/libeap.la \
$(top_builddir)/libeap/libeaparchie.la \
$(top_builddir)/libeap/libeapgpsk.la
endif
if compile_EAPTLS
noinst_PROGRAMS = md5_test archie_test gpsk_test tls_test
else
noinst_PROGRAMS = md5_test archie_test gpsk_test
endif
md5_test_SOURCES = tests/md5_test.cxx -lssl -lcrypto
archie_test_SOURCES = tests/archie_test.cxx
gpsk_test_SOURCES = tests/gpsk_test.cxx
if compile_EAPTLS
tls_test_SOURCES = tests/tls_test.cxx
endif
EXTRA_DIST = config
我怀疑autotools没有做某事,因为我没有指定它这样做。在文件md5_test.c里面,但它仍然是错误。
#include <openssl/md5.h>
#include <openssl/rand.h>
非常感谢任何帮助。
编辑: 我挖掘了库,看看是否有版本信息,它让我陷入了这个非常有趣的困境 - 使用这个命令编译时openssl 1.0.0m:./ config --prefix = / usr --openssldir = / etc / ssl - -libdir = lib shared
生成两组共享对象:
/usr/lib/x86_64-linux-gnu/
/usr/lib
/ usr / lib / x86_64-linux-gnu中的共享对象/生成一个版本(使用objdump -T)
00000000001546b0 g DF .text 0000000000000108 OPENSSL_1.0.0 PKCS7_to_TS_TST_INFO
/ usr / lib中的共享对象产生了这个:
000000000012ee20 g DF .text 000000000000000c Base BIO_new_CMS
如何解决这个问题,因为这看起来非常不标准......?
答案 0 :(得分:4)
从您的图书馆的-lssl -lcrypto
移除LDFLAGS
;链接编辑器的工作方式,LDFLAGS
在目标文件之前传递,这意味着它们被丢弃;在链接编辑器的至少某个版本中,在目标文件之前传递的库也被“列入黑名单”,或者确切地说,它们在再次传递时会被忽略。
您在-lssl -lcrypto
和LDFLAGS
两次传递LIBADD
,因此您可能会触发此行为。