简体   繁体   English

链接问题与libcrypto:未定义引用`__imp__CertFreeCertificateContext'

[英]Linking issue with libcrypto: undefined reference to `__imp__CertFreeCertificateContext'

I'm trying to cross-compile cachecoin binaries on a linux host using gitian and i686-w64-mingw for a windows target. 我正在尝试使用gitian和i686-w64-mingw在Linux主机上交叉编译cachecoin二进制文件以用于Windows目标。

The compilation works fine until the final step of static linking of the dependencies. 编译工作正常,直到依赖项的静态链接的最后一步。 This is what I get: 这就是我得到的:

/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x1ff): undefined reference to `__imp__CertFreeCertificateContext@4'

Google suggests it's a missing -lcrypto link or even -lcrypt32 . 谷歌认为它是一个缺失的-lcrypto链接,甚至是-lcrypt32 But in the last line before it fails you can see it's linking both. 但是在它失败之前的最后一行你可以看到它连接两者。 What's the issue here? 这是什么问题?

My gitian descriptor is available here . 我的gitian描述符可以在这里找到 And this is the qmake project file . 这是qmake项目文件 Full tail of the build log: 构建日志的完整尾部:

[...]
i686-w64-mingw32-g++ -c -frandom-seed=cachecoin -D_FORTIFY_SOURCE=2 -msse2 -O2 -frtti -fexceptions -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector -DBOOST_THREAD_USE_LIB -DQT_GUI -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DBOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN -D__NO_SYSTEM_INCLUDES -DSCRYPT_CHACHA -DSCRYPT_KECCAK512 -DUSE_QRCODE -DUSE_UPNP=1 -DSTATICLIB -DUSE_IPV6=1 -DCACHECOIN_NEED_QT_PLUGINS -DHAVE_BUILD_INFO -DWIN32 -D_MT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I'../../staging32/include/QtCore' -I'../../staging32/include/QtNetwork' -I'../../staging32/include/QtGui' -I'../../staging32/include' -I'../../staging32' -I'src' -I'src/json' -I'src/qt' -I'../../staging32' -I'../../staging32' -I'../../staging32' -I'../../staging32' -I'../../staging32' -I'../../staging32/include/ActiveQt' -I'build' -I'build' -I'../../staging32/mkspecs/unsupported/win32-g++-cross' -o build/moc_qrcodedialog.o build/moc_qrcodedialog.cpp
i686-w64-mingw32-g++ -c -frandom-seed=cachecoin -D_FORTIFY_SOURCE=2 -msse2 -O2 -frtti -fexceptions -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector -DBOOST_THREAD_USE_LIB -DQT_GUI -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DBOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN -D__NO_SYSTEM_INCLUDES -DSCRYPT_CHACHA -DSCRYPT_KECCAK512 -DUSE_QRCODE -DUSE_UPNP=1 -DSTATICLIB -DUSE_IPV6=1 -DCACHECOIN_NEED_QT_PLUGINS -DHAVE_BUILD_INFO -DWIN32 -D_MT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I'../../staging32/include/QtCore' -I'../../staging32/include/QtNetwork' -I'../../staging32/include/QtGui' -I'../../staging32/include' -I'../../staging32' -I'src' -I'src/json' -I'src/qt' -I'../../staging32' -I'../../staging32' -I'../../staging32' -I'../../staging32' -I'../../staging32' -I'../../staging32/include/ActiveQt' -I'build' -I'build' -I'../../staging32/mkspecs/unsupported/win32-g++-cross' -o build/qrc_cachecoin.o release/qrc_cachecoin.cpp
i686-w64-mingw32-g++ -Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware -static-libgcc -static-libstdc++ -Wl,-s -lmingwthrd -Wl,-subsystem,windows -o release/cachecoin-qt.exe object_script.cachecoin-qt.Release  -L'/home/ubuntu/staging32/lib' -lmingwthrd -lmingw32 -lqtmain build/cachecoin-qt_res.o -lqrencode -L/home/ubuntu/staging32 -lminiupnpc -liphlpapi -L/home/ubuntu/staging32 -L/home/ubuntu/staging32 -L/home/ubuntu/staging32 -L/home/ubuntu/staging32 -ldb_cxx -lshlwapi -lmswsock -lcrypt32 -lboost_system-mt-s -lboost_filesystem-mt-s -lboost_program_options-mt-s -lboost_thread_win32-mt-s -lboost_chrono-mt-s -L/home/ubuntu/staging32/plugins/codecs -lqcncodecs -lqjpcodecs -lqtwcodecs -lqkrcodecs -L/home/ubuntu/staging32/plugins/accessible -lqtaccessiblewidgets -lQtGui -lQtNetwork -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -L/home/ubuntu/deps32/lib -lssl -lcrypto -lgdi32 -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x1ff): undefined reference to `__imp__CertFreeCertificateContext@4'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x27f): undefined reference to `__imp__CertFreeCertificateContext@4'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0xbf8): undefined reference to `__imp__CertGetCertificateContextProperty@16'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x20f6): undefined reference to `__imp__CertOpenStore@20'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x212d): undefined reference to `__imp__CertEnumCertificatesInStore@8'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2208): undefined reference to `__imp__CertDuplicateCertificateContext@4'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2291): undefined reference to `__imp__CertCloseStore@8'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x23c6): undefined reference to `__imp__CertFreeCertificateContext@4'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2648): undefined reference to `__imp__CertGetCertificateContextProperty@16'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x27cc): undefined reference to `__imp__CertGetCertificateContextProperty@16'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2bc9): undefined reference to `__imp__CertOpenStore@20'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2ce2): undefined reference to `__imp__CertOpenStore@20'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2d4d): undefined reference to `__imp__CertFindCertificateInStore@24'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2d7d): undefined reference to `__imp__CertFreeCertificateContext@4'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2d94): undefined reference to `__imp__CertCloseStore@8'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2db3): undefined reference to `__imp__CertEnumCertificatesInStore@8'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x2e25): undefined reference to `__imp__CertEnumCertificatesInStore@8'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x3777): undefined reference to `__imp__CertOpenStore@20'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x37a8): undefined reference to `__imp__CertCloseStore@8'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x3829): undefined reference to `__imp__CertEnumCertificatesInStore@8'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x388d): undefined reference to `__imp__CertFreeCertificateContext@4'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x38c9): undefined reference to `__imp__CertFindCertificateInStore@24'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x39ef): undefined reference to `__imp__CertFreeCertificateContext@4'
/home/ubuntu/staging32/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x3a9b): undefined reference to `__imp__CertFreeCertificateContext@4'
collect2: ld returned 1 exit status
make[1]: *** [release/cachecoin-qt.exe] Error 1
make[1]: Leaving directory `/home/ubuntu/build32/distsrc'
make: *** [release] Error 2

Any ideas? 有任何想法吗?

(I'd rather post ask in the comments first, but I don't have enough reputation yet.) (我宁愿先在评论中发帖,但我还没有足够的声誉。)

Judging purely from your post (I haven't tried compiling the program myself), it could be one of these three issues: 纯粹从你的帖子判断(我没有尝试自己编译程序),它可能是以下三个问题之一:

  • wrong order of libraries in the command line (try appending one more -lcrypt32 to it) 命令行中库的顺序错误(尝试-lcrypt32添加一个-lcrypt32
  • the import libraries provided by your mingw-w64 packages are incomplete (you can use nm libcrypt32.a | grep ' T ' to check) 你的mingw-w64软件包提供的导入库是不完整的(你可以使用nm libcrypt32.a | grep ' T '来检查)
  • the functions are imported incorrectly ( dllimport vs. dllexport vs. undecorated, calling conventions, ...) 函数导入错误( dllimport vs. dllexport与undecorated,调用约定,......)

After examining the error log once more, I'm inclined to believe it's the first option, as libcrypto seems to be importing functions from libcrypt32, but -lcrypto is almost at the end of the command line and it's not followed by any -lcrypt32 . 在再次检查错误日志之后,我倾向于认为它是第一个选项,因为libcrypto似乎是从libcrypt32导入函数,但是-lcrypto几乎在命令行的末尾,并且它后面没有任何-lcrypt32

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM