[英]undefined reference EVP_sha1 , HMAC, Id returned 1 exit status
i´ve got a problem with the Error above. 我上面的错误有问题。 In m Code is the HMAC implemented.
在m代码中实现了HMAC。 i tried solving the problem with this link: Here
我试图通过此链接解决问题: 这里
But it just doesnt work so i hope you can help me. 但它只是行不通,所以我希望你能帮助我。 im really stuck with this and played with the QMAKE_CXXFLAGS but just got no positiv solution.
我真的坚持了这一点,并与QMAKE_CXXFLAGS一起玩,但没有正定的解决方案。
here is the .pro: 这是.pro:
QT += core gui webkit network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = csui
TEMPLATE = app
#QMAKE_CFLAGS_RELEASE += -lssl -lcrypto
#QMAKE_CFLAGS_RELEASE += -lcrypto
target.path = /home/msw
INSTALLS += target
SOURCES += main.cpp\
mainwindow.cpp \
qcolpushbutton.cpp \
librfid/mifare.cpp \
librfid/list.cpp \
librfid/brp.cpp \
qrfid.cpp \
qscaledlabel.cpp \
statelogic.cpp \
qcsnp.cpp \
qchargepoint.cpp \
qi2cnode.cpp \
libhotp-tan.cpp
HEADERS += mainwindow.h \
qcolpushbutton.h \
debug.h \
config.h \
librfid/mifare.h \
librfid/list.h \
librfid/brp.h \
qrfid.h \
qscaledlabel.h \
statelogic.h \
qcsnp.h \
qchargepoint.h \
qi2cnode.h \
libhotp-tan.h
FORMS += mainwindow.ui
RESOURCES += \
res/res.qrc
and the links from the Makefile 以及Makefile中的链接
CFLAGS = -pipe -isystem /home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/include -isystem /home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/include -O2 -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -isystem /home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/include -isystem /home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/include -O2 -Wall -W -D_REENTRANT $(DEFINES)
13:45:58: Führe Schritte für Projekt csui aus... 13:45:59: Starte "/opt/qt-4.8.3e-armhf/sysroot-cross/bin/qmake" '/home/msw/Arbeitsfläche/Experimentelles Programm/csui.pro' -r -spec /opt/qt-4.8.3e-armhf/sysroot-target/usr/mkspecs/qws/linux-ptx-g++ 13:45:59: Der Prozess "/opt/qt-4.8.3e-armhf/sysroot-cross/bin/qmake" wurde normal beendet. 13:45:59: Starte "/usr/bin/make" -w make: Entering directory `/home/msw/Arbeitsfläche/Experimentelles Programm' arm-1136jfs-linux-gnueabihf-g++ -L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/lib -L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/lib -Wl,-rpath-link -Wl,/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/lib -Wl,-rpath-link -Wl,/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/lib -Wl,-O1 -o csui main.o mainwindow.o qcolpushbutton.o mifare.o list.o brp.o qrfid.o qscaledlabel.o statelogic.o qcsnp.o qchargepoint.o qi2cnode.o libhotp-tan.o moc_mainwindow.o moc_qcolpushbutton.o moc_qrfid.o moc_qscaledlabel.o moc_statelogic.o moc_qcsnp.o moc_qchargepoint.o moc_qi2cnode.o qrc_res.o -L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/lib -L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/lib -lQtWebKit -lQtGui -L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/lib -L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/lib -lQtNetwork -lQtCore -lpthread make: Leaving directory `/home/msw/Arbeitsfläche/Experimentelles Programm' libhotp-tan.o: In function `hotpa(unsigned char const*, unsigned char const*, char*, unsigned int, unsigned char const*, unsigned int)': libhotp-tan.cpp:(.text+0x74): undefined reference to `EVP_sha1' libhotp-tan.cpp:(.text+0xb4): undefined reference to `HMAC' collect2: error: ld returned 1 exit status make: *** [csui] Error 1 13:46:01: Der Prozess "/usr/bin/make" wurde mit dem Rückgabewert 2 beendet. Fehler beim Erstellen/Deployment des Projekts csui(Ziel: Embedded Linux) Bei der Ausführung von Schritt 'Make'
THANKS!! 谢谢!!
Your linkage command is: 您的链接命令是:
arm-1136jfs-linux-gnueabihf-g++ \
-L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/lib \
-L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/lib \
-Wl,-rpath-link \
-Wl,/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/lib \
-Wl,-rpath-link \
-Wl,/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/lib \
-Wl,-O1 \
-o csui main.o mainwindow.o qcolpushbutton.o mifare.o list.o brp.o qrfid.o \
qscaledlabel.o statelogic.o qcsnp.o qchargepoint.o qi2cnode.o libhotp-tan.o \
moc_mainwindow.o moc_qcolpushbutton.o moc_qrfid.o moc_qscaledlabel.o moc_statelogic.o \
moc_qcsnp.o moc_qchargepoint.o moc_qi2cnode.o qrc_res.o \
-L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/lib \
-L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/lib \
-lQtWebKit \
-lQtGui \
-L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/lib \
-L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/lib \
-lQtNetwork \
-lQtCore \
-lpthread
(There's a lot of redundant repetition there) (那里有很多多余的重复)
The undefined symbols EVP_sha1
and HMAC
are defined in libcrypto
, for which you need also to link libssl
, but -lssl -lcrypto
are not among the library options you are passing to the linker. 未定义的符号
EVP_sha1
和HMAC
在libcrypto
中定义,您还需要链接libssl
,但是-lssl -lcrypto
不在传递给链接器的库选项中。 You need to add them. 您需要添加它们。
I'm not familiar with QMake but I believe library options should be defined in LIBS
If you generate a linker commandline with -lssl -lcrypto
following -lQtCore
you should be all right. 我不熟悉QMAKE但我相信库选项应被定义
LIBS
如果你生成一个链接器命令行与-lssl -lcrypto
以下-lQtCore
你应该没事。
I notice that -lssl -lcrypto
appears in the commented-out setting: 我注意到
-lssl -lcrypto
出现在注释掉的设置中:
#QMAKE_CFLAGS_RELEASE += -lssl -lcrypto
That wouldn't have worked, since it's setting options for the C Compiler in release mode, not the linker. 那是行不通的,因为它是在发布模式下设置C编译器的选项,而不是链接器。 Likewise
QMAKE_CXXFLAGS
, which you say you tinkered with, sets options for the C++ compiler, not the linker. 同样,您说过的
QMAKE_CXXFLAGS
设置了C ++编译器的选项,而不是链接器的选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.