-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libtorrent] Fix linkage issues for dynamic builds #7345
[libtorrent] Fix linkage issues for dynamic builds #7345
Conversation
CI failure on Linux: #7344 |
@ras0219-msft do I have to make these changes in my local C:\workspace\vcpkg\ports\libtorrent and then do I have to rerun |
So I updated the port files and then uninstalled all the libtorrent triplet packages and installed again; To be double sure ran
|
Somehow I got rid off all the linking issues. Not sure which one worked.
On other hand if I run This is in 64 bit debug. Note : for 32 bit I get error
|
The following worked for me (checked out to this PR branch): >git clone https://github.com/arvidn/libtorrent -b libtorrent-1_2_1 then rewrite the examples cmake slightly: # examples/CMakeLists.txt
cmake_minimum_required(VERSION 3.11)
project(libtorrent-examples)
set(single_file_examples
simple_client
custom_storage
stats_counters
dump_torrent
make_torrent
connection_tester
upnp_test)
find_package(LibtorrentRasterbar CONFIG REQUIRED)
foreach(example ${single_file_examples})
add_executable(${example} "${example}.cpp")
target_link_libraries(${example} PRIVATE LibtorrentRasterbar::torrent-rasterbar)
endforeach(example)
add_executable(client_test
client_test.cpp
print.cpp
torrent_view.cpp
session_view.cpp)
target_link_libraries(client_test PRIVATE LibtorrentRasterbar::torrent-rasterbar) Then a simple: >vcpkg install libtorrent:x86-windows
>cmake ..\.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=D:\src\vcpkg\scripts\buildsystems\vcpkg.cmake -G Ninja
>ninja
>.\client_test.exe worked. I'll note that there were some warnings during the build process about dll-linkage. Also note that |
Fixes arvidn/libtorrent#3878.
Due to supporting consuming buildsystems other than CMake, we patch the installed headers to set required linkage macros. This fix causes us to patch in the correct usage macro, instead of the internal build macro.
Without this fix, the example on https://www.libtorrent.org/examples.html fails to link in x86-windows. With this fix, it successfully links.