#c #cmake #linker #mingw #zeromq
#c #cmake #компоновщик #mingw #zeromq
Вопрос:
Вот мой проект:
структура проекта:
test/
CmakeList.txt
main.cpp
external/
cppzmq/...
cppzmq из https://github.com/zeromq/cppzmq
Cmake:
cmake_minimum_required(VERSION 3.17)
project(test)
set(CMAKE_CXX_STANDARD 17)
add_definitions(-DZMQ_STATIC)
link_libraries(wsock32 ws2_32 sodium)
option(CPPZMQ_BUILD_TESTS "" OFF)
add_subdirectory(external/cppzmq/)
add_executable(test main.cpp)
#note cppzmq-static should be an interface target
target_link_libraries(test PUBLIC cppzmq-static)
#if(MINGW)
target_link_libraries(test PUBLIC wsock32 ws2_32 libsodium.a)
#endif()
target_compile_definitions(test PRIVATE -DZMQ_STATIC)
Вот мой основной файл (я не ожидаю, что он что-нибудь сделает, я просто пытаюсь заставить его не работать при связывании):
#include <iostream>
#include <zmq.hpp>
int main() {
zmq::context_t context(1);
zmq::socket_t req_socket(context, ZMQ_PAIR);
req_socket.bind("tcp://foo");
zmq::socket_t threads_sub(context, ZMQ_SUB);
threads_sub.bind("tcp://bar");
threads_sub.set(zmq::sockopt::subscribe, "a");
threads_sub.set(zmq::sockopt::subscribe, "b");
std::cout << "Hello, World!" << std::endl;
return 0;
}
Вот мой вывод Cmake:
"pathcmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" pathtest
-- Detected CPPZMQ Version - 4.8.0
-- CMake libzmq package not found, trying again with pkg-config (normal install of zeromq)
-- Found PkgConfig: path/pkg-config.exe (found version "1.7.3")
-- Checking for module 'libzmq'
-- Found libzmq, version 4.3.3
-- cppzmq v4.8.0
-- Configuring done
-- Generating done
-- Build files have been written to: path/test/cmake-build-debug
[Finished]
Вот мой результат сборки (обратите внимание, что весь результат сборки превышает лимит символов, для сокращения символов использовались многоточия)
"pathcmake.exe" --build pathtestcmake-build-debug --target test -- -j 12
Scanning dependencies of target test
[ 50%] Building CXX object CMakeFiles/test.dir/main.cpp.obj
[100%] Linking CXX executable test.exe
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-zmq.o):(.text 0x1a49): undefined reference to `__imp_select'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-zmq.o):(.text 0x1cdd): undefined reference to `__WSAFDIsSet'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-zmq.o):(.text 0x1cf7): undefined reference to `__WSAFDIsSet'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-zmq.o):(.text 0x1d11): undefined reference to `__WSAFDIsSet'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-zmq.o):(.text 0x2031): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-socket_poller.o):(.text 0x3a0): undefined reference to `__WSAFDIsSet'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-socket_poller.o):(.text 0x3bb): undefined reference to `__WSAFDIsSet'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-socket_poller.o):(.text 0x3d3): undefined reference to `__WSAFDIsSet'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-socket_poller.o):(.text 0x43d): undefined reference to `__WSAFDIsSet'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-socket_poller.o):(.text 0x128d): undefined reference to `__imp_select'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-socket_poller.o):(.text 0x12bb): undefined reference to `__WSAFDIsSet'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-socket_poller.o):(.text 0x142b): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-err.o):(.text 0x4b6): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-err.o):(.text 0x603): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x2f): undefined reference to `__imp_setsockopt'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x5f): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x14e): undefined reference to `__imp_WSASocketA'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x182): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x1dc): undefined reference to `__imp_ioctlsocket'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x1ff): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x28a): undefined reference to `__imp_setsockopt'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x2af): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x36f): undefined reference to `__imp_getnameinfo'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x3c3): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x473): undefined reference to `__imp_setsockopt'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x497): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x534): undefined reference to `__imp_WSAStartup'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x62a): undefined reference to `__imp_WSACleanup'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x64f): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x7ad): undefined reference to `__imp_setsockopt'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x7e5): undefined reference to `__imp_htonl'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x7f1): undefined reference to `__imp_htons'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x82d): undefined reference to `__imp_bind'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x845): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x84e): undefined reference to `__imp_closesocket'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x8b5): undefined reference to `__imp_getsockname'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x8cc): undefined reference to `__imp_listen'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x8e8): undefined reference to `__imp_connect'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x908): undefined reference to `__imp_accept'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x95f): undefined reference to `__imp_recv'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x990): undefined reference to `__imp_send'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0x9d1): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0xa5d): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0xae3): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0xb53): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0xbc3): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0xc33): more undefined references to `__imp_WSAGetLastError' follow
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0xe3c): undefined reference to `__imp_getsockopt'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-ip.o):(.text 0xe69): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-random.o):(.text 0xa5): undefined reference to `sodium_init'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-random.o):(.text 0xd1): undefined reference to `randombytes_close'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x70d): undefined reference to `__WSAFDIsSet'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x75e): undefined reference to `__WSAFDIsSet'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x7a6): undefined reference to `__WSAFDIsSet'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0xd2d): undefined reference to `__imp_select'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0xd7f): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0xf11): undefined reference to `__imp_getsockopt'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0xf33): undefined reference to `__imp_getsockname'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x118d): undefined reference to `__imp_WSACreateEvent'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x11ef): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x1263): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x12d3): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x1343): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x13bd): undefined reference to `__imp_WSACloseEvent'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x1417): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x1483): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x14f3): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x1563): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x1698): undefined reference to `__imp_WSAEventSelect'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x16ba): undefined reference to `__WSAFDIsSet'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x16ce): undefined reference to `__WSAFDIsSet'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x16e1): undefined reference to `__WSAFDIsSet'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x16f5): undefined reference to `__WSAFDIsSet'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x170d): undefined reference to `__imp_WSAEventSelect'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x1733): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x17d5): undefined reference to `__imp_WSAWaitForMultipleEvents'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x18a8): undefined reference to `__imp_WSAEventSelect'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x190a): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x1e13): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x1fb3): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x2153): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x22f3): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-select.o):(.text 0x2493): more undefined references to `__imp_WSAGetLastError' follow
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-signaler.o):(.text 0x8a): undefined reference to `__imp_setsockopt'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-signaler.o):(.text 0x9e): undefined reference to `__imp_closesocket'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-signaler.o):(.text 0xcd): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-signaler.o):(.text 0x133): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-signaler.o):(.text 0x1cb): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-signaler.o):(.text 0x24f): undefined reference to `__imp_send'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-signaler.o):(.text 0x29f): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-signaler.o):(.text 0x3d2): undefined reference to `__imp_select'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-signaler.o):(.text 0x42b): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-signaler.o):(.text 0x53c): undefined reference to `__imp_recv'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-signaler.o):(.text 0x57b): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-signaler.o):(.text 0x6ac): undefined reference to `__imp_recv'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-signaler.o):(.text 0x6e3): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-stream_listener_base.o):(.text 0x113): undefined reference to `__imp_closesocket'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-stream_listener_base.o):(.text 0x1ff): undefined reference to `__imp_closesocket'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-stream_listener_base.o):(.text 0x223): undefined reference to `__imp_WSAGetLastError'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-tcp.o):(.text 0x2d): undefined reference to `__imp_setsockopt'
…
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-udp_address.o):(.text 0x549): undefined reference to `if_nametoindex'
…
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-curve_client.o):(.text 0x44f): undefined reference to `crypto_box_keypair'
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-
…
path/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: path/msys2/mingw64/lib/libzmq.a(libzmq_la-curve_client.o):(.text 0xfd8): undefined reference to `sodium_free'
…
collect2.exe: error: ld returned 1 exit status
mingw32-make[3]: *** [CMakeFilestest.dirbuild.make:107: test.exe] Error 1
mingw32-make[2]: *** [CMakeFilesMakefile2:115: CMakeFiles/test.dir/all] Error 2
mingw32-make[1]: *** [CMakeFilesMakefile2:122: CMakeFiles/test.dir/rule] Error 2
mingw32-make: *** [Makefile:183: test] Error 2
Я не знаю, в чем дело, похоже, он не может ссылаться на lib sodium, но я явно добавляю его в библиотеки ссылок (дважды!).). Также, похоже, отсутствуют некоторые вещи wsock32 ws2_32, и снова я указываю их в библиотеках ссылок (и снова, дважды!).). Что здесь происходит? Как мне заставить его правильно ссылаться на то, на что я напрямую указываю ему ссылку?
Комментарии:
1. Вы можете использовать подробную сборку (например, выполнив соответствующую
make
утилиту сVERBOSE=1
опцией), чтобы увидеть, какие фактические параметры передаются компоновщику.2. Почему бы вам не выполнить сборку без тестирования (флаги cmake
-DBUILD_TESTING:BOOL=OFF -DCPPZMQ_BUILD_TESTS:BOOL=OFF
)? Symbolsodium_free
является частью libsodium. У вас это установлено?