我遇到上述错误的问题。 在m Code是HMAC实现的。 我尝试使用此链接解决问题:Here
但它不起作用,所以我希望你能帮助我。我真的坚持这个并玩QMAKE_CXXFLAGS,但没有得到积极的解决方案。
这是.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
和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'
谢谢!
答案 0 :(得分:2)
您的链接命令是:
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
(那里有很多冗余重复)
未定义的符号EVP_sha1
和HMAC
在libcrypto
中定义,为此
您还需要关联libssl
,但-lssl -lcrypto
不属于您传递给链接器的库选项。你需要添加它们。
我不熟悉QMake,但我相信应该定义库选项
LIBS
如果生成链接器
<{1}} -lssl -lcrypto
之后的-lQtCore
命令行你应该没问题。
我注意到-lssl -lcrypto
出现在已注释掉的设置中:
#QMAKE_CFLAGS_RELEASE += -lssl -lcrypto
这不会起作用,因为它为C编译器设置了选项
发布模式,而不是链接器。同样QMAKE_CXXFLAGS
,你说你
修补,设置C ++编译器的选项,而不是链接器。