Discussion:
[libtorrent] Problems linking RC_1_1 static and mingw
sledgehammer999
2017-05-09 20:35:02 UTC
Permalink
Hey guys, I am building RC_1_1 as static lib with static runtime under
mingw(gcc 6.2.0). (see commandline below).
undefined reference to `libtorrent::dht::item::assign(libtorrent::entry
const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator
, unsigned long long, char const*, char const*)'
Any idea what to do? I successfully build it under msvc2015 with the same
compile options.
./b2 -q --without-python --toolset=gcc variant=release link=static
runtime-link=static encryption=on crypto=openssl logging=off
resolve-countries=off dht=on windows-version=xp character-set=unicode
boost-link=static -sBOOST_ROOT="G:\qBittorrent\boost_1_63_0"
cflags="-std=gnu++11 -Os -s -ffunction-sections -fdata-sections
-fno-omit-frame-pointer -fpredictive-commoning" cxxflags="-std=gnu++11 -Os
-s -ffunction-sections -fdata-sections -fno-omit-frame-pointer
-fpredictive-commoning" linkflags="-Wl,--gc-sections -Wl,--relax
-Wl,--sort-common -Wl,-s -Wl,--as-needed -static-libgcc -static-libstdc++"
include="/g/QBITTORRENT/install_mingw/base/include"
library-path="/g/QBITTORRENT/install_mingw/base/lib"
--prefix="/g/QBITTORRENT/install_mingw/base"
define=BOOST_ASIO_DISABLE_CONNECTEX define=BOOST_USE_WINAPI_VERSION=0x0501
--hash -j 12
libtorrent::aux::(anonymous
namespace)::put_mutable_callback(libtorrent::dht::item&,
boost::function<void (libtorrent::entry&, boost::array<char, 64u>&,
unsigned long long&, std::__cxx11::basic_string<char, std::char_traits,
std::allocator > const&)>) 0x1a6
Arvid Norberg
2017-05-09 22:07:41 UTC
Permalink
On Tue, May 9, 2017 at 4:35 PM, sledgehammer999 <
Post by sledgehammer999
Hey guys, I am building RC_1_1 as static lib with static runtime under
mingw(gcc 6.2.0). (see commandline below).
libtorrent.a(session_impl.o):session_impl.cpp:(.text$_
ZN10libtorrent3aux12_GLOBAL__N_120put_mutable_callbackERNS_
3dht4itemEN5boost8functionIFvRNS_5entryERNS5_5arrayIcLj64EEERyRKNSt7__
undefined reference to `libtorrent::dht::item::assign(libtorrent::entry
const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator
, unsigned long long, char const*, char const*)'
Any idea what to do? I successfully build it under msvc2015 with the same
compile options.
Is that the only missing symbol?

Can you dump the symbols available in the static library, and see if
there's a similar one to the one that's missing?

My suspicion is that perhaps libtorrent was built with libstdc++ configured
to use the previous ABI (pre C++11)

You may want to make sure qBT and libtorrent agrees on this macro:

_GLIBCXX_USE_CXX11_ABI
--
Arvid Norberg
Arvid Norberg
2017-05-09 22:10:28 UTC
Permalink
actually, I believe that's an internal symbol. Since you're specifying a
lot of arguments as cxxflags, perhaps you have partial previous builds with
different flags (since boost build only tracks proper build features).

You may want to try deleting the bin directories to force a rebuild, or
pass in -a
Post by Arvid Norberg
On Tue, May 9, 2017 at 4:35 PM, sledgehammer999 <
Post by sledgehammer999
Hey guys, I am building RC_1_1 as static lib with static runtime under
mingw(gcc 6.2.0). (see commandline below).
libtorrent.a(session_impl.o):session_impl.cpp:(.text$_ZN10l
ibtorrent3aux12_GLOBAL__N_120put_mutable_callbackERNS_3d
ht4itemEN5boost8functionIFvRNS_5entryERNS5_5arrayIcLj64EEERy
undefined reference to `libtorrent::dht::item::assign(libtorrent::entry
const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator
, unsigned long long, char const*, char const*)'
Any idea what to do? I successfully build it under msvc2015 with the same
compile options.
Is that the only missing symbol?
Can you dump the symbols available in the static library, and see if
there's a similar one to the one that's missing?
My suspicion is that perhaps libtorrent was built with libstdc++
configured to use the previous ABI (pre C++11)
_GLIBCXX_USE_CXX11_ABI
--
Arvid Norberg
--
Arvid Norberg
sledgehammer999
2017-05-09 23:22:20 UTC
Permalink
Post by Arvid Norberg
actually, I believe that's an internal symbol. Since you're specifying a
lot of arguments as cxxflags, perhaps you have partial previous builds with
different flags (since boost build only tracks proper build features).
You may want to try deleting the bin directories to force a rebuild, or
pass in -a
Actually, here's the full story. I always delete the bin folder for every
build.
BUT for RC_1_1 b2 dies towards the end, when it calls ar and link all the
.o files into the .a
It dies with a cryptic message about a WINAPI call. I think it does this
because the command is way too long.
Nevertheless, I obtain the commands by appending "-d +2 > redirect.txt" in
my above mentioned cmd and running again without deleting bin folder.
I then copy the 2 commands as shown in the txt into the terminal and
finally run again b2 for any possibly remaining actions.
Can all this result in half-build library?

PS: b2 doesn't die with RC_1_0
PS2: How do I check if qbt+libtorrent agree on _GLIBCXX_USE_CXX11_ABI ?
Post by Arvid Norberg
Post by Arvid Norberg
On Tue, May 9, 2017 at 4:35 PM, sledgehammer999 <
Post by sledgehammer999
Hey guys, I am building RC_1_1 as static lib with static runtime under
mingw(gcc 6.2.0). (see commandline below).
libtorrent.a(session_impl.o):session_impl.cpp:(.text$_ZN10l
ibtorrent3aux12_GLOBAL__N_120put_mutable_callbackERNS_3d
ht4itemEN5boost8functionIFvRNS_5entryERNS5_5arrayIcLj64EEERy
undefined reference to `libtorrent::dht::item::assign(libtorrent::entry
const&, std::__cxx11::basic_string<char, std::char_traits,
std::allocator
Post by Arvid Norberg
Post by sledgehammer999
, unsigned long long, char const*, char const*)'
Any idea what to do? I successfully build it under msvc2015 with the
same
Post by Arvid Norberg
Post by sledgehammer999
compile options.
Is that the only missing symbol?
Can you dump the symbols available in the static library, and see if
there's a similar one to the one that's missing?
My suspicion is that perhaps libtorrent was built with libstdc++
configured to use the previous ABI (pre C++11)
_GLIBCXX_USE_CXX11_ABI
--
Arvid Norberg
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Arvid Norberg
2017-05-09 23:32:50 UTC
Permalink
On Tue, May 9, 2017 at 7:22 PM, sledgehammer999 <
Post by sledgehammer999
Post by Arvid Norberg
actually, I believe that's an internal symbol. Since you're specifying a
lot of arguments as cxxflags, perhaps you have partial previous builds
with
Post by Arvid Norberg
different flags (since boost build only tracks proper build features).
You may want to try deleting the bin directories to force a rebuild, or
pass in -a
Actually, here's the full story. I always delete the bin folder for every
build.
BUT for RC_1_1 b2 dies towards the end, when it calls ar and link all the
.o files into the .a
It dies with a cryptic message about a WINAPI call. I think it does this
because the command is way too long.
Nevertheless, I obtain the commands by appending "-d +2 > redirect.txt" in
my above mentioned cmd and running again without deleting bin folder.
I then copy the 2 commands as shown in the txt into the terminal and
finally run again b2 for any possibly remaining actions.
Can all this result in half-build library?
I'm not sure. But maybe you could try to pass in "--hash" to the b2 command
line. It will make the build paths shorter by using the hash instead.
--
Arvid Norberg
sledgehammer999
2017-05-09 23:36:58 UTC
Permalink
I already pass the --hash switch. See initial post.
Post by Arvid Norberg
On Tue, May 9, 2017 at 7:22 PM, sledgehammer999 <
Post by sledgehammer999
Post by Arvid Norberg
actually, I believe that's an internal symbol. Since you're specifying
a
Post by sledgehammer999
Post by Arvid Norberg
lot of arguments as cxxflags, perhaps you have partial previous builds
with
Post by Arvid Norberg
different flags (since boost build only tracks proper build features).
You may want to try deleting the bin directories to force a rebuild, or
pass in -a
Actually, here's the full story. I always delete the bin folder for
every
Post by sledgehammer999
build.
BUT for RC_1_1 b2 dies towards the end, when it calls ar and link all the
.o files into the .a
It dies with a cryptic message about a WINAPI call. I think it does this
because the command is way too long.
Nevertheless, I obtain the commands by appending "-d +2 > redirect.txt"
in
Post by sledgehammer999
my above mentioned cmd and running again without deleting bin folder.
I then copy the 2 commands as shown in the txt into the terminal and
finally run again b2 for any possibly remaining actions.
Can all this result in half-build library?
I'm not sure. But maybe you could try to pass in "--hash" to the b2 command
line. It will make the build paths shorter by using the hash instead.
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
sledgehammer999
2017-05-14 20:56:55 UTC
Permalink
I finally found the problem. Even though I pass "-d +2" it prints out to
file the command for ar stripped. It turns out it missed about 16 .o files.
After I manually added them, qbittorrent links successfully.

arvidn, I suppose you don't hardcode/list the .o names, right? You let b2
figure them out, right?
Post by sledgehammer999
I already pass the --hash switch. See initial post.
Post by Arvid Norberg
On Tue, May 9, 2017 at 7:22 PM, sledgehammer999 <
Post by sledgehammer999
Post by Arvid Norberg
actually, I believe that's an internal symbol. Since you're
specifying a
Post by sledgehammer999
Post by Arvid Norberg
lot of arguments as cxxflags, perhaps you have partial previous builds
with
Post by Arvid Norberg
different flags (since boost build only tracks proper build features).
You may want to try deleting the bin directories to force a rebuild,
or
Post by sledgehammer999
Post by Arvid Norberg
pass in -a
Actually, here's the full story. I always delete the bin folder for
every
Post by sledgehammer999
build.
BUT for RC_1_1 b2 dies towards the end, when it calls ar and link all
the
Post by sledgehammer999
.o files into the .a
It dies with a cryptic message about a WINAPI call. I think it does this
because the command is way too long.
Nevertheless, I obtain the commands by appending "-d +2 > redirect.txt"
in
Post by sledgehammer999
my above mentioned cmd and running again without deleting bin folder.
I then copy the 2 commands as shown in the txt into the terminal and
finally run again b2 for any possibly remaining actions.
Can all this result in half-build library?
I'm not sure. But maybe you could try to pass in "--hash" to the b2 command
line. It will make the build paths shorter by using the hash instead.
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
sledgehammer999
2017-05-14 21:31:19 UTC
Permalink
Actually something else is amiss here. I don't think it fails because the
cmd line is too long.
The actual error reads as:

CreateProcessA() Windows API failed: 2 - The system cannot find the file
specified.

So I think something gets passed to it that doesn't exist. Or the cmd line
is badly constructed.
Post by sledgehammer999
I finally found the problem. Even though I pass "-d +2" it prints out to
file the command for ar stripped. It turns out it missed about 16 .o files.
After I manually added them, qbittorrent links successfully.
arvidn, I suppose you don't hardcode/list the .o names, right? You let b2
figure them out, right?
Post by sledgehammer999
I already pass the --hash switch. See initial post.
Post by Arvid Norberg
On Tue, May 9, 2017 at 7:22 PM, sledgehammer999 <
Post by sledgehammer999
Post by Arvid Norberg
actually, I believe that's an internal symbol. Since you're
specifying a
Post by sledgehammer999
Post by Arvid Norberg
lot of arguments as cxxflags, perhaps you have partial previous
builds
Post by sledgehammer999
with
Post by Arvid Norberg
different flags (since boost build only tracks proper build
features).
Post by sledgehammer999
Post by Arvid Norberg
You may want to try deleting the bin directories to force a rebuild,
or
Post by sledgehammer999
Post by Arvid Norberg
pass in -a
Actually, here's the full story. I always delete the bin folder for
every
Post by sledgehammer999
build.
BUT for RC_1_1 b2 dies towards the end, when it calls ar and link all
the
Post by sledgehammer999
.o files into the .a
It dies with a cryptic message about a WINAPI call. I think it does
this
Post by sledgehammer999
because the command is way too long.
Nevertheless, I obtain the commands by appending "-d +2 >
redirect.txt" in
Post by sledgehammer999
my above mentioned cmd and running again without deleting bin folder.
I then copy the 2 commands as shown in the txt into the terminal and
finally run again b2 for any possibly remaining actions.
Can all this result in half-build library?
I'm not sure. But maybe you could try to pass in "--hash" to the b2 command
line. It will make the build paths shorter by using the hash instead.
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
sledgehammer999
2017-05-14 21:56:17 UTC
Permalink
I think I am closing in. I upped the debug level and rebuilt from scratch.

For the command that fails 2 of the debug lines reads:

Executing using a command file and the shell:
bin\4ae5b0c62f9353f193dd5e1b8bb565a7\libtorrent.a
Command string for CreateProcessA():
'bin\4ae5b0c62f9353f193dd5e1b8bb565a7\libtorrent.a
C:\msys64\tmp\jam3752-00-00.bat'

Notice that there isn't an exe defined here. Previous commands seem to have
it. eg:

Executing using a command file and the shell: cmd.exe /Q/C
Command string for CreateProcessA(): 'cmd.exe /Q/C
C:\msys64\tmp\jam3752-00-00.bat'

Finally do you notice the .bat file mentioned? Presumably it has inside it
commands for that particular step.
The failing step seems to be the last one where it ar.exe and ranlib.exe
get called.
I opened the .bat file and what do I see? I see that the ar.exe step really
misses the ~16 .o files.

In conclusion there seem to be 2 problems:
1. b2 doesn't include "'cmd.exe /Q/C" at the start of the command string,
that why CreateProcessA() fails.
2. If it included them it would create a corrupt lib because it misses
about 16 .o files.

Any idea how to proceed? Entirely boost's problem or could libtorrent's
jamfile be wrong too?
Post by sledgehammer999
Actually something else is amiss here. I don't think it fails because the
cmd line is too long.
CreateProcessA() Windows API failed: 2 - The system cannot find the file
specified.
So I think something gets passed to it that doesn't exist. Or the cmd line
is badly constructed.
Post by sledgehammer999
I finally found the problem. Even though I pass "-d +2" it prints out to
file the command for ar stripped. It turns out it missed about 16 .o files.
After I manually added them, qbittorrent links successfully.
arvidn, I suppose you don't hardcode/list the .o names, right? You let b2
figure them out, right?
Post by sledgehammer999
I already pass the --hash switch. See initial post.
Post by Arvid Norberg
On Tue, May 9, 2017 at 7:22 PM, sledgehammer999 <
Post by sledgehammer999
Post by Arvid Norberg
actually, I believe that's an internal symbol. Since you're
specifying a
Post by sledgehammer999
Post by Arvid Norberg
lot of arguments as cxxflags, perhaps you have partial previous
builds
Post by sledgehammer999
with
Post by Arvid Norberg
different flags (since boost build only tracks proper build
features).
Post by sledgehammer999
Post by Arvid Norberg
You may want to try deleting the bin directories to force a
rebuild, or
Post by sledgehammer999
Post by Arvid Norberg
pass in -a
Actually, here's the full story. I always delete the bin folder for
every
Post by sledgehammer999
build.
BUT for RC_1_1 b2 dies towards the end, when it calls ar and link all
the
Post by sledgehammer999
.o files into the .a
It dies with a cryptic message about a WINAPI call. I think it does
this
Post by sledgehammer999
because the command is way too long.
Nevertheless, I obtain the commands by appending "-d +2 >
redirect.txt" in
Post by sledgehammer999
my above mentioned cmd and running again without deleting bin folder.
I then copy the 2 commands as shown in the txt into the terminal and
finally run again b2 for any possibly remaining actions.
Can all this result in half-build library?
I'm not sure. But maybe you could try to pass in "--hash" to the b2 command
line. It will make the build paths shorter by using the hash instead.
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Arvid Norberg
2017-05-14 23:20:35 UTC
Permalink
On Sun, May 14, 2017 at 5:31 PM, sledgehammer999 <
Post by sledgehammer999
Actually something else is amiss here. I don't think it fails because the
cmd line is too long.
CreateProcessA() Windows API failed: 2 - The system cannot find the file
specified.
So I think something gets passed to it that doesn't exist. Or the cmd line
is badly constructed.
I remember getting this error on appveyor when I first set up mingw as
well. I can't recall the fix, but I have a feeling it may have been to
upgrade mingw and perhaps build a 64 bit version.
It could also be the command line length, since (iiuc) cmd.exe's command
line length limitation still applies.
--
Arvid Norberg
sledgehammer999
2017-05-15 00:27:34 UTC
Permalink
arvid I hope you saw the rest of my messages. I had posted 3 in a series.
Post by Arvid Norberg
On Sun, May 14, 2017 at 5:31 PM, sledgehammer999 <
Post by sledgehammer999
Actually something else is amiss here. I don't think it fails because the
cmd line is too long.
CreateProcessA() Windows API failed: 2 - The system cannot find the file
specified.
So I think something gets passed to it that doesn't exist. Or the cmd
line
Post by sledgehammer999
is badly constructed.
I remember getting this error on appveyor when I first set up mingw as
well. I can't recall the fix, but I have a feeling it may have been to
upgrade mingw and perhaps build a 64 bit version.
It could also be the command line length, since (iiuc) cmd.exe's command
line length limitation still applies.
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Loading...