我正在使用QT和ed25519-donna库来验证我的签名。
Linux我正在使用这个lib => libssl-dev
MacO,我正在使用此lib => openssl
因此,当我尝试通过Linux进行编译时,但在MacO中尝试时,donna库却给出了错误:
openssl/rand.h is not found
我的Makefile中有这一行:
LIBS = $(SUBLIBS) -L/home/laion/Desktop/lethean-gui/lethean/lib -lwallet_merged -lepee -lunbound -leasylogging -lboost_serialization -lboost_thread -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_chrono -lboost_program_options -lssl -lcrypto -Wl,-Bdynamic -Wl,-Bdynamic -lunwind -ldl -lQt5Quick -lQt5Widgets -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGL -lpthread
当您浏览Donna库时,您会看到一个ed25519.c文件,该文件的内部名为ed25519-randombytes.h,该文件内部具有openssl / rand.h包含。
在.pro文件中,我使用以下代码:
macx {
# mixing static and shared libs are not supported on mac
# CONFIG(static) {
# message("using static libraries")
# LIBS+= -Wl,-Bstatic
# }
LIBS+= \
-L/usr/local/lib \
-L/usr/local/opt/openssl/lib \
-L/usr/local/opt/boost/lib \
-lboost_serialization \
-lboost_thread-mt \
-lboost_system \
-lboost_system-mt \
-lboost_date_time \
-lboost_filesystem \
-lboost_regex \
-lboost_chrono \
-lboost_chrono-mt \
-lboost_program_options \
-lssl \
-lcrypto \
-ldl
INCLUDEPATH += /usr/local/opt/boost/include/
}
因此,如果我在INCLUDEPATH中添加此路径:
/usr/local/opt/openssl/include \
/usr/local/opt/openssl/lib
我遇到了另一个错误:
The program has unexpectedly finished.
// every donna file get this message
was built for newer osx version (10.13) than being linked (10.12)
目前,我获得了此参考文献C++, Mac OS X, Xcode 8 : Compile Boost : Set deployment target to OS X 10.11,然后再次告诉您是否可行
已修复<<问题是Mac版本。要与donna和openssl配合使用,必须有10.12+才能编译