Closed emmercm closed 3 years ago
the b2
build doesn't have the feature to install a pkg-cfg. I will look into adding that
could you test this patch? https://github.com/arvidn/libtorrent/pull/5874
Can do! I'll comment any findings over in the PR.
Real quick fix I didn't notice before @arvidn, in the new generated libtorrent-rasterbar.pc
there's a line similar to:
Libs: -L/usr/lib -llibtorrent-rasterbar.so.10 -lboost_system
It needs to have the "lib" prefix and ".so" suffix dropped, ld
adds it later, so like:
Libs: -L/usr/lib -ltorrent-rasterbar -lboost_system
Though that also requires:
ln -s /usr/lib/libtorrent-rasterbar.so.* /usr/lib/libtorrent-rasterbar.so
Which is easy enough for me to do, though the make
method does this automatically.
Hi guys! I have recently started compiling libtorrent with b2 and then I noticed it wasn't generating pkgconfig... Until i saw this :)
Well, now it is generating a libtorrent-rasterbar.pc but it is missing some CFLAGS (I was expecting to see, for instance, -DTORRENT_NO_DEPRECATE -DTORRENT_USEOPENSSL when building with crypto=openssl and deprecated-functions=off). In fact, I don't get any TORRENT* flags at all, is this expected?
I can also confirm the problem @emmercm mentioned above. In fact, b2 is producing me a libtorrent.a (instead of libtorrent-rasterbar.a), so the Libs part should be something like Libs: -L/usr/lib -ltorrent -lboost_system
Hi again,
Other thing which is missing (required for static linking) is the Libs.private
.
Ex: Libs.private: -lboost_system -lpthread -liphlpapi -lmswsock -lssl -lcrypto -lws2_32 -lgdi32 -lcrypt32
I am maintaining go bindings for libtorrent and this is somehow needed so cgo can link all libraries.
Thanks for all your work!
thanks for the reports! I'm working on fixing this, stay tuned
I think this fixes everything except the Libs.private
feature.
https://github.com/arvidn/libtorrent/pull/6000
I think it's correct to put the versioned library name in the .pc
file, since it depends on that specific library, if it's gone and there's a symlink to a different version, it's not OK to silently pick that up.
I've updated the PR, I believe it addresses all issue now. Please try it out.
One thing that might be a bit unintuirive is that you install a link=static
build, the pkg-config file will only support static linking. And if you install a link=shared
build, it will only support shared linking.
Hi, I've done some tests and it's getting better, but still there are a couple of issues.
My libtorrent-rasterbar.pc is:
Name: libtorrent-rasterbar
Description: libtorrent is an open source C++ library implementing the BitTorrent protocol
URL: https://libtorrent.org
Version: 1.2.13
Libs: -L/usr/x86_64-w64-mingw32/lib
Libs.private: -L/usr/x86_64-w64-mingw32/lib -llibtorrent-rasterbar.a
Cflags: -I/usr/x86_64-w64-mingw32/include -DTORRENT_USE_LIBCRYPTO -DTORRENT_USE_OPENSSL -DTORRENT_NO_DEPRECATE -DTORRENT_USE_I2P=1 -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_HAS_STD_CHRONO -DBOOST_MULTI_INDEX_DISA
BLE_SERIALIZATION -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1
Now we have the TORRENT_* defines and all seems fine. However, the lib is still wrong, namely -llibtorrent-rasterbar.a
. I believe it should be -ltorrent-rasterbar
. Also, the libs.private is missing lots of libraries (the libraries I've mentioned in a previous post were extracted from a static build with autotool && configure).
the problem with making the libs entry be -ltorrent-rasterbar
is that a client may pick up the wrong version, if there's been a new version installed over the previous one, you'd end up using that symlink. It's not necessarily a huge issue, since I try to make all the defines not affect ABI, but it adds some extra risk.
The reason you don't have anything in your Libs:
field is because you built the library as static, so you get the static library in Libs.private
instead. I'm surprised you don't get boost_system or any of the other of the static dependencies.
I understand your concern... I mentioned that because I got /usr/bin/x86_64-w64-mingw32-ld: cannot find -llibtorrent-rasterbar.a
in my test...
Regarding Libs.private
: let me be honest, I don't really know much about this, but as is, I simply get the following errors when I compile go-libtorrent with the windows cross-compiler (although libtorrent build succeeded):
/usr/x86_64-w64-mingw32/lib/libtorrent-rasterbar.a(session_impl.o):session_impl.cpp:(.text+0xb08b): undefined reference to `AcceptEx'
/usr/x86_64-w64-mingw32/lib/libtorrent-rasterbar.a(session_impl.o):session_impl.cpp:(.text+0x26c2a): undefined reference to `GetAcceptExSockaddrs'
/usr/x86_64-w64-mingw32/lib/libtorrent-rasterbar.a(session_impl.o):session_impl.cpp:(.text+0x2720b): undefined reference to `AcceptEx'
/usr/x86_64-w64-mingw32/lib/libtorrent-rasterbar.a(ip_notifier.o):ip_notifier.cpp:(.text+0x3fe): undefined reference to `CancelMibChangeNotify2'
/usr/x86_64-w64-mingw32/lib/libtorrent-rasterbar.a(ip_notifier.o):ip_notifier.cpp:(.text+0x48e): undefined reference to `CancelMibChangeNotify2'
/usr/x86_64-w64-mingw32/lib/libtorrent-rasterbar.a(ip_notifier.o):ip_notifier.cpp:(.text+0x61f): undefined reference to `NotifyUnicastIpAddressChange'
I tried to add -liphlpapi -lmswsock
to cgo's LDFLAGS and the error persisted.
However, if I add -liphlpapi -lmswsock
to Libs.private
, it works.
Note, I have not tested for other platforms yet.
yeah, I'll have to look into why these dependencies aren't propagated
@i96751414 I pushed another commit to that PR. Could you test it?
This is what I get on linux:
b2 install --prefix=./test-install-refix/; cat ./test-install-refix/share/pkgconfig/libtorrent-rasterbar.pc
Name: libtorrent-rasterbar
Description: libtorrent is an open source C++ library implementing the BitTorrent protocol
URL: https://libtorrent.org
Version: 1.2.13
Libs: -L./test-install-refix/lib -llibtorrent-rasterbar.so.10.0.0 -llibboost_system.so.1.73.0
Cflags: -I./test-install-refix/include -DTORRENT_USE_I2P=1 -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_HAS_STD_CHRONO -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED -DTORRENT_LINKING_SHARED
and when I enable OpenSSL:
b2 crypto=openssl install --prefix=./test-install-refix/; cat ./test-install-refix/share/pkgconfig/libtorrent-rasterbar.pc
(note -lcrypto -ldl -lssl
)
Name: libtorrent-rasterbar
Description: libtorrent is an open source C++ library implementing the BitTorrent protocol
URL: https://libtorrent.org
Version: 1.2.13
Libs: -L./test-install-refix/lib -llibtorrent-rasterbar.so.10.0.0 -llibboost_system.so.1.73.0 -lcrypto -ldl -lssl
Cflags: -I./test-install-refix/include -DTORRENT_USE_LIBCRYPTO -DTORRENT_USE_OPENSSL -DTORRENT_USE_I2P=1 -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_HAS_STD_CHRONO -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED -DTORRENT_LINKING_SHARED
Almost perfect :) This is the result of a static build with openssl:
Name: libtorrent-rasterbar
Description: libtorrent is an open source C++ library implementing the BitTorrent protocol
URL: https://libtorrent.org
Version: 1.2.13
Libs: -L/usr/x86_64-w64-mingw32/lib -llibtorrent-rasterbar.so.10.0.0 -ladvapi32 -luser32 -lshell32 -lgdi32 -lcrypt32 -llibcrypto -liphlpapi -llibssl -lws2_32 -lwsock32
Libs.private: -L/usr/x86_64-w64-mingw32/lib -llibtorrent-rasterbar.a.10.0.0 -ladvapi32 -luser32 -lshell32 -lgdi32 -lcrypt32 -llibcrypto -liphlpapi -llibssl -lws2_32 -lwsock32 -llibboost_system.a
Cflags: -I/usr/x86_64-w64-mingw32/include -DTORRENT_USE_LIBCRYPTO -DTORRENT_USE_OPENSSL -DTORRENT_NO_DEPRECATE -DTORRENT_USE_I2P=1 -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_HAS_STD_CHRONO -DBOOST_MULTI_INDEX_DISA
BLE_SERIALIZATION -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1
Now we have all the libs! However, then the compiler complains:
/usr/bin/x86_64-w64-mingw32-ld: cannot find -llibtorrent-rasterbar.so.10.0.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -llibcrypto
/usr/bin/x86_64-w64-mingw32-ld: cannot find -llibssl
/usr/bin/x86_64-w64-mingw32-ld: cannot find -llibtorrent-rasterbar.a.10.0.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -llibcrypto
/usr/bin/x86_64-w64-mingw32-ld: cannot find -llibssl
/usr/bin/x86_64-w64-mingw32-ld: cannot find -llibboost_system.a
collect2: error: ld returned 1 exit status
Basically, the -lib
prefix (and in some cases the .so*
/.a*
suffix as well) is messing things up. We should be seeing things like -lssl
, -lcrypto
, etc.
Lastly, as I said before, I understand your concern about libtorrent versioning, however the pkg-config file is not consistent with the installed library (libtorrent-rasterbar.a
, with no versioning).
The link option to add libraries is -llibrary/-l library, where for static libraries liblibrary.a is the library name, and for shared libraries liblibrary.so is the library name.
Nevertheless, doing a magic sed sed -i -E 's/-llib([^ .]+)(\.(a|so)[.0-9]*)?/-l\1/g' "${CROSS_ROOT}/share/pkgconfig/libtorrent-rasterbar.pc"
solves all my problems.
Lastly, as I said before, I understand your concern about libtorrent versioning, however the pkg-config file is not consistent with the installed library (libtorrent-rasterbar.a, with no versioning).
This patch was supposed to fix that. Does it not work? https://github.com/arvidn/libtorrent/pull/6000/commits/d8cb0dd9585ea229d7cac1ea574a4250f2a8909a
Well, before the lib name was only libtorrent.a. Now it's libtorrent-rasterbar.a.
right. I did not add the version number to the actual target, but I added it when generating the .pc file. Fixing.
I'm testing this on windows now:
b2 install --prefix=./test-install-prefix/
Give me this .pc
file:
Name: libtorrent-rasterbar
Description: libtorrent is an open source C++ library implementing the BitTorrent protocol
URL: https://libtorrent.org
Version: 1.2.13
Libs: -L./test-install-prefix/lib -llibtorrent-rasterbar.so.10.0.0 -lboost_system-vc142-mt-gd-x32-1_72.dll -ladvapi32 -liphlpapi -lws2_32 -lwsock32
Cflags: -I./test-install-prefix/include -DTORRENT_USE_I2P=1 -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_HAS_STD_CHRONO -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED -DTORRENT_LINKING_SHARED
Which has the wrong library name. Once fixed, I get this:
b2 link=static install --prefix=./test-install-prefix/
Name: libtorrent-rasterbar
Description: libtorrent is an open source C++ library implementing the BitTorrent protocol
URL: https://libtorrent.org
Version: 1.2.13
Libs: -L./test-install-prefix/lib -llibtorrent-rasterbar.so -ladvapi32 -liphlpapi -lws2_32 -lwsock32
Libs.private: -L./test-install-prefix/lib -llibtorrent-rasterbar.a -ladvapi32 -liphlpapi -lws2_32 -lwsock32 -llibboost_system-vc142-mt-gd-x32-1_72.lib
Cflags: -I./test-install-prefix/include -DTORRENT_USE_I2P=1 -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_HAS_STD_CHRONO -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1
which looks right. I've updated the PR.
I think the reason libssl
and libcrypto
have the lib
-prefix but not the .dll
suffix is that visual studio just adds the extension when looking for libraries. Perhaps this is a compatibility issue between msvc and mingw. the Jamfile
makes this distinction based on <target-os>windows
, but maybe it should be <toolset>msvc
hm. the shared library name is still wrong for windows. it should be .dll
, not .so
https://github.com/arvidn/libtorrent/pull/6000/commits/873087da9f97b79c7df43666925cb3bbd9cabecf for me produced the /usr/share/pkgconfig/libtorrent-rasterbar.pc
contents:
Name: libtorrent-rasterbar
Description: libtorrent is an open source C++ library implementing the BitTorrent protocol
URL: https://libtorrent.org
Version: 1.2.13
Libs: -L/usr/lib -llibtorrent-rasterbar.so.10.0.0 -lboost_system -lcrypto -ldl -lssl
Cflags: -I/usr/include -DTORRENT_USE_LIBCRYPTO -DTORRENT_USE_OPENSSL -DTORRENT_USE_I2P=1 -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_HAS_STD_CHRONO -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_SYSTEM_NO_DEPRECATED -DTORRENT_LINKING_SHARED
See my previous comment about Libs: -ltorrent-rasterbar
, qBittorrent build is giving the error:
linking qbittorrent-nox
/usr/lib/gcc/x86_64-alpine-linux-musl/10.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -llibtorrent-rasterbar.so.10.0.0
collect2: error: ld returned 1 exit status
I very well could have misunderstood the previous comments, maybe that naming issue was already understood.
cannot find -llibtorrent-rasterbar.so.10.0.0
This is because libtorrent wasn't installed from the current head of RC_1_2
. But I suppose this ought to be backwards compatible. Making a change like this would probably be more appropriate for master
ok, I feel pretty confident about the most recent commit now
My libtorrent-rasterbar.pc
:
Name: libtorrent-rasterbar
Description: libtorrent is an open source C++ library implementing the BitTorrent protocol
URL: https://libtorrent.org
Version: 1.2.13
Libs: -L/usr/x86_64-w64-mingw32/lib -ltorrent-rasterbar -ladvapi32 -luser32 -lshell32 -lgdi32 -lcrypt32 -llibcrypto -liphlpapi -llibssl -lws2_32 -lwsock32
Libs.private: -L/usr/x86_64-w64-mingw32/lib -llibboost_system.a
Cflags: -I/usr/x86_64-w64-mingw32/include -DTORRENT_USE_LIBCRYPTO -DTORRENT_USE_OPENSSL -DTORRENT_NO_DEPRECATE -DTORRENT_USE_I2P=1 -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_HAS_STD_CHRONO -DBOOST_MULTI_INDEX_DISA
BLE_SERIALIZATION -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1
The problems:
/usr/bin/x86_64-w64-mingw32-ld: cannot find -llibcrypto
/usr/bin/x86_64-w64-mingw32-ld: cannot find -llibssl
/usr/bin/x86_64-w64-mingw32-ld: cannot find -llibboost_system.a
Later on I can try building with other cross-compilers.
what are your names for those libraries?
What would they have to be called in the .pc
file in order to work?
I have a feeling there may be some conflicting issue between msvc and gcc on windows.
The names are:
libcrypto.a
libssl.a
libboost_system.a
The problem here is the lib
prefix and .a
suffix. ld adds the suffix/prefix automatically.
normally, ld
looks for the name specified in addition to adding prefix + suffix. So, libboost_system.a
should have been found, no?
When installing OpenSSL for windows (for msvc) the library files are called libssl.lib
and libcrypto.lib
.
The names are special cases for windows, specifically for this reason. See this (it's the <name>
attribute that determines the library name to look for).
when just building libtorrent with b2
, does it find those libraries ok?
perhaps these special cases would be more precise if they would just be in effect for msvc
and not all of windows (which includes mingw)
normally, ld looks for the name specified in addition to adding prefix + suffix.
Hmm, I didn't know that. Well, I assumed it didn't work that way, I thought it would always add the prefix and suffix.
Building libtorrent with b2
produces the following libtorrent-rasterbar.pc
:
Name: libtorrent-rasterbar
Description: libtorrent is an open source C++ library implementing the BitTorrent protocol
URL: https://libtorrent.org
Version: 1.2.13
Libs: -L/usr/local/lib -ltorrent-rasterbar -llibboost_system.dll -ladvapi32 -liphlpapi -lws2_32 -lwsock32
Libs.private: -L/usr/local/lib
Cflags: -I/usr/local/include -DTORRENT_USE_I2P=1 -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_HAS_STD_CHRONO -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED -DTORRENT
_LINKING_SHARED
Then when building the other app with libtorrent, ld complains: /usr/bin/x86_64-w64-mingw32-ld: cannot find -llibboost_system.dll
I assume you don't have libboost_system.dll
installed anywhere. Is that right? would you expect that file to be found?
If you build libtorrent against a source distribution of boost, that file was built, but not installed. It would, presumably, be located somewhere in the boost directory. I could make that directory be added as a -L
argument to Libs
if you think that would make sense. Something like this:
Name: libtorrent-rasterbar
Description: libtorrent is an open source C++ library implementing the BitTorrent protocol
URL: https://libtorrent.org
Version: 1.2.13
Libs: -L"./test-install-prefix/lib" -ltorrent-rasterbar -L"/home/arvid/dev/boost_1_73_0/bin.v2/libs/system/build/gcc-9.2/debug/crypto-openssl/threading-multi/visibility-hidden" -llibboost_system.so.1.73.0 -lcrypto -ldl -lssl
Libs.private: -L./test-install-prefix/lib
Cflags: -I"./test-install-prefix/include" -DTORRENT_USE_LIBCRYPTO -DTORRENT_USE_OPENSSL -DTORRENT_USE_I2P=1 -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_HAS_STD_CHRONO -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED -DTORRENT_LINKING_SHARED
Alternatively, if you intend to build against a system-installed version of boost, you should make sure BOOST_ROOT
is empty when you invoke b2
.
BOOST_ROOT="" b2 install --prefix=...
No, in fact it is installed on my /usr/local/lib/libtorrent-rasterbar.dll
. It can be found If I modify the .pc file to remove both the suffix and prefix.
https://github.com/arvidn/libtorrent/pull/6000/commits/16ff37116f288bbfc83276df76ac22ab5c94b69d appears to have fixed my problem compiling qBittorrent under Alpine. Thank you @arvidn !
@i96751414
No, in fact it is installed on my
/usr/local/lib/libtorrent-rasterbar.dll
. It can be found If I modify the .pc file to remove both the suffix and prefix.
did you mean to say libboost_system.dll
? the libtorrent name has been fixed already, to not include the prefix and suffix.
I'm curious to know whether building libtorrent works for you, and if so, how come it can find libboost_system.a
?
You can find out by running b2 -an
. It will print all the commands it would have run, instead of running them. It should reveal the command line options it uses with the exact argument for linking against libboost_system.a
.
For example, I get this:
gcc.link.dll bin/gcc-9.2/debug/threading-multi/libtorrent-rasterbar.so.10.0.0
"ccache" "g++" -o "bin/gcc-9.2/debug/threading-multi/libtorrent-rasterbar.so.10.0.0" -Wl,-h -Wl,libtorrent-rasterbar.so.10.0.0 -shared -Wl,--start-group "bin/gcc-9.2/debug/threading-multi/src/alert.o"
... lots of object files ...
"bin/gcc-9.2/debug/threading-multi/src/sha512.o" "/home/arvid/dev/boost_1_73_0/bin.v2/libs/system/build/gcc-9.2/debug/threading-multi/visibility-hidden/libboost_system.so.1.73.0" -Wl,-Bstatic -Wl,-Bdynamic -lrt -Wl,--end-group -fPIC -pthread -g -Wl,-Bsymbolic
But If I build against the system boost, by running BOOST_ROOT="" b2 -an
, I get:
"ccache" "g++" -L"/usr/local/opt/boost/lib" -o "bin/gcc-9.2/debug/threading-multi/libtorrent-rasterbar.so.10.0.0" -Wl,-h -Wl,libtorrent-rasterbar.so.10.0.0 -shared -Wl,--start-group "bin/gcc-9.2/debug/threading-multi/src/alert.o"
... lots of object files...
"bin/gcc-9.2/debug/threading-multi/src/sha512.o" -Wl,-Bstatic -Wl,-Bdynamic -lrt -lboost_system -Wl,--end-group -fPIC -pthread -g -Wl,-Bsymbolic
I'm sorry @arvidn, I copied the wrong name. But yes, I meant libboost_system.dll
. These are the files under my /usr/local/lib
with b2 build (shared):
libboost_system.dll
libboost_system.dll.a
libtorrent-rasterbar.dll
libtorrent.dll.a
I'll do your suggestion
Sorry, now that I've re-read your message, I must say I don't install boost on my images, I simply build libtorrent against the source distribution of boost. So, probably it's not so helpful, but this is what I get wiht b2 -an
:
gcc.link.dll /build/boost/bin.v2/libs/system/build/gcc-mingw64/debug/target-os-windows/visibility-hidden/libboost_system.dll.a
"x86_64-w64-mingw32-c++" "-Wl,--out-implib,/build/boost/bin.v2/libs/system/build/gcc-mingw64/debug/target-os-windows/visibility-hidden/libboost_system.dll.a" -o "/build/boost/bin.v2/libs/system/build/gcc-mingw64/debug/target-o
s-windows/visibility-hidden/libboost_system.dll" -Wl,-h -Wl,libboost_system.dll -shared -Wl,--start-group "/build/boost/bin.v2/libs/system/build/gcc-mingw64/debug/target-os-windows/visibility-hidden/error_code.o" -Wl,-Bstatic -Wl,
-Bdynamic -Wl,--end-group -m64 -g -fvisibility=hidden -fvisibility-inlines-hidden
...
gcc.link.dll /build/boost/bin.v2/libs/system/build/gcc-mingw64/debug/target-os-windows/threading-multi/visibility-hidden/libboost_system.dll.a
x86_64-w64-mingw32-c++" "-Wl,--out-implib,/build/boost/bin.v2/libs/system/build/gcc-mingw64/debug/target-os-windows/threading-multi/visibility-hidden/libboost_system.dll.a" -o "/build/boost/bin.v2/libs/system/build/gcc-mingw6
4/debug/target-os-windows/threading-multi/visibility-hidden/libboost_system.dll" -Wl,-h -Wl,libboost_system.dll -shared -Wl,--start-group "/build/boost/bin.v2/libs/system/build/gcc-mingw64/debug/target-os-windows/threading-multi/vis
ibility-hidden/error_code.o" -Wl,-Bstatic -Wl,-Bdynamic -Wl,--end-group -m64 -mthreads -g -fvisibility=hidden -fvisibility-inlines-hidden
...
gcc.link.dll bin/gcc-mingw64/debug/target-os-windows/threading-multi/libtorrent.dll.a
... lots of objects files ...
"bin/gcc-mingw64/debug/target-os-windows/threading-multi/src/sha512.o" "/build/boost/bin.v2/libs/system/build/gcc-mingw64/debug/target-os-windows/threadin
g-multi/visibility-hidden/libboost_system.dll.a" -Wl,-Bstatic -Wl,-Bdynamic -ladvapi32 -lwsock32 -lws2_32 -liphlpapi -Wl,--end-group -mthreads -g -Wl,-Bsymbolic
with BOOST_ROOT="" b2 -an
:
...
gcc.link.dll bin/gcc-mingw64/debug/target-os-windows/threading-multi/libtorrent.dll.a
...lots of object files...
"bin/gcc-mingw64/debug/target-os-windows/threading-multi/src/sha512.o" -Wl,-Bstatic -Wl,-Bdynamic -lboost_system -ladvapi32
-lwsock32 -lws2_32 -liphlpapi -Wl,--end-group -mthreads -g -Wl,-Bsymbolic
it's still a mystery to me that the linker wouldn't pick up the exact filename, but require it to be specified without the prefix and suffix. However, If you install with BOOST_ROOT="" b2 install --prefix=...
, I would expect that the .pc
file you get would have -lboost_system
in it.
@arvidn, I can assure you I am not doing anything special... just a simple compile command... I can do more tests tomorrow.. I can also share with you the images I am using for this, if you want.
does that mean that BOOST_ROOT="" b2 install --prefix=...
still doesn't produce a correct .pc
file?
(Ah, I see, I'll await you testing it)
Strangely, doing a BOOST_ROOT="" b2 install --prefix=...
gave me:
...failed gcc.link.dll bin/gcc-mingw64/debug/target-os-windows/threading-multi/libtorrent.dll.a bin/gcc-mingw64/debug/target-os-windows/threading-multi/libtorrent-rasterbar.dll...
...skipped <p/usr/x86_64-w64-mingw32/lib>libtorrent-rasterbar.dll for lack of <pbin/gcc-mingw64/debug/target-os-windows/threading-multi>libtorrent-rasterbar.dll...
...skipped <p/usr/x86_64-w64-mingw32/lib>libtorrent.dll.a for lack of <pbin/gcc-mingw64/debug/target-os-windows/threading-multi>libtorrent.dll.a..
I think you truncated off the actual error message there. I would expect the output from the linker to appear above those lines
You're correct, it was some lines above:
gcc.link.dll bin/gcc-mingw64/debug/target-os-windows/threading-multi/libtorrent.dll.a
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lboost_system
collect2: error: ld returned 1 exit status
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Please provide the following information
libtorrent version (or branch):
Git tags
v1.2.12
andv2.0.1
specifically, but likely more.platform/architecture:
Docker
alpine:3.12.3@sha256:074d3636ebda6dd446d0d00304c4454f468237fdacf08fb0eeac90bdbfa1bac7
compiler and compiler version:
b2/boost v1.72.0-r6
please describe what symptom you see, what you would expect to see instead and how to reproduce it.
After building libtorrent with
b2
my qBittorrent build fails because the CMakePKG_CHECK_MODULES
can't find libtorrent-rasterbar.This is likely because the output of
pkg-config --list-all
doesn't containlibtorrent-rasterbar
because/usr/lib/pkgconfig/libtorrent-rasterbar.pc
doesn't exist.I very well may be overlooking something in the instructions though, as I didn't have this problem with
make
previously.In general my build steps are:
Where
5026.patch
is coming from https://github.com/arvidn/libtorrent/pull/5026.Thank you as always, I appreciate all the support I get in this project!