Discussion:
[libtorrent] Visual Studio 2015 building 64 bit
Michael Mckeown
2016-04-18 11:27:58 UTC
Permalink
What are the proper steps to build for 64 bit?

I build boosts with:

toolset=msvc-14.0 address-model=64 --stagedir=stage64 variant=release
link=static runtime-link=static

then Libtorrent with:

toolset=msvc-14.0 boost-link=static runtime-link=static
deprecated-functions=off encryption=on link=static dht=on logging=off
i2p=on variant=release

and Libtorrent duly builds and comes out at 72.9mb whereas the build for
32 bit comes out as 81mb.

Compiling my project with the 64 lib throws "libtorrent.lib(session.obj)
: fatal error LNK1112: module machine type 'X86' conflicts with target
machine type 'x64'"

So I'm assuming I'm missing some flags on the Libtorrent arguments?

Thanks.
Arvid Norberg
2016-04-18 23:25:12 UTC
Permalink
If you have the BOOST_ROOT environment variable set, libtorrent will build
and link against boost by source (which is the most reliable, since compile
time options are propagated properly).

It sounds like, since you build boost as a separate step, presumably
"install" it and then make libtorrent pick up the binary dependency
(regardless of whether they are ABI compatible or not). If you want a 64
bit build, you need to build libtorrent as 64 bit also. Try to build
libtorrent with the address-model=64 too.
Post by Michael Mckeown
What are the proper steps to build for 64 bit?
toolset=msvc-14.0 address-model=64 --stagedir=stage64 variant=release
link=static runtime-link=static
toolset=msvc-14.0 boost-link=static runtime-link=static
deprecated-functions=off encryption=on link=static dht=on logging=off
i2p=on variant=release
and Libtorrent duly builds and comes out at 72.9mb whereas the build for
32 bit comes out as 81mb.
Compiling my project with the 64 lib throws "libtorrent.lib(session.obj)
: fatal error LNK1112: module machine type 'X86' conflicts with target
machine type 'x64'"
So I'm assuming I'm missing some flags on the Libtorrent arguments?
Thanks.
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications
Manager
Applications Manager provides deep performance insights into multiple
tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
--
Arvid Norberg
Michael Mckeown
2016-04-19 09:18:39 UTC
Permalink
Thanks, it looks like I now have a 64 bit lib however I get one build error:

libtorrent.lib(broadcast_socket.obj) : error LNK2001: unresolved
external symbol if_nametoindex

any idea where to start looking?

Thanks.
Post by Arvid Norberg
If you have the BOOST_ROOT environment variable set, libtorrent will build
and link against boost by source (which is the most reliable, since compile
time options are propagated properly).
It sounds like, since you build boost as a separate step, presumably
"install" it and then make libtorrent pick up the binary dependency
(regardless of whether they are ABI compatible or not). If you want a 64
bit build, you need to build libtorrent as 64 bit also. Try to build
libtorrent with the address-model=64 too.
Post by Michael Mckeown
What are the proper steps to build for 64 bit?
toolset=msvc-14.0 address-model=64 --stagedir=stage64 variant=release
link=static runtime-link=static
toolset=msvc-14.0 boost-link=static runtime-link=static
deprecated-functions=off encryption=on link=static dht=on logging=off
i2p=on variant=release
and Libtorrent duly builds and comes out at 72.9mb whereas the build for
32 bit comes out as 81mb.
Compiling my project with the 64 lib throws "libtorrent.lib(session.obj)
: fatal error LNK1112: module machine type 'X86' conflicts with target
machine type 'x64'"
So I'm assuming I'm missing some flags on the Libtorrent arguments?
Thanks.
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications
Manager
Applications Manager provides deep performance insights into multiple
tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
dave madden
2016-04-19 15:59:06 UTC
Permalink
Post by Michael Mckeown
libtorrent.lib(broadcast_socket.obj) : error LNK2001: unresolved
external symbol if_nametoindex
any idea where to start looking?
Apologies if this is too simple an answer, but perhaps the toolsets on
Windows don't lend themselves to finding things out this way...

$ find . -type f -print0 | xargs -0 grep 'if_nametoindex'
Binary file ./src/.libs/libtorrent-rasterbar.so.8.0.0 matches
Binary file ./src/.libs/libtorrent-rasterbar.a matches
Binary file ./src/.libs/asio.o matches
Binary file ./src/.libs/broadcast_socket.o matches
./src/broadcast_socket.cpp:#include <iphlpapi.h> // for if_nametoindex
./src/broadcast_socket.cpp: // if_nametoindex was introduced in vista
./src/broadcast_socket.cpp: addr6.scope_id(if_nametoindex(i->name));
Binary file ./src/asio.o matches
Binary file ./src/broadcast_socket.o matches
./ChangeLog: * fix if_nametoindex build error on windows

So...I'd guess it's a Windows function, introduced in Vista, and you can
see the call in ...src/broadcast_socket.cpp. I'm not familiar with DLLs
on Windows, but perhaps you just need to tell your linker to scan the
network library again, or scan it _after_ libtorrent?

Regards,
dhm.
Arvid Norberg
2016-04-20 00:09:16 UTC
Permalink
you may have to link against iphlpapi.dll on windows
Post by dave madden
Post by Michael Mckeown
libtorrent.lib(broadcast_socket.obj) : error LNK2001: unresolved
external symbol if_nametoindex
any idea where to start looking?
Apologies if this is too simple an answer, but perhaps the toolsets on
Windows don't lend themselves to finding things out this way...
$ find . -type f -print0 | xargs -0 grep 'if_nametoindex'
Binary file ./src/.libs/libtorrent-rasterbar.so.8.0.0 matches
Binary file ./src/.libs/libtorrent-rasterbar.a matches
Binary file ./src/.libs/asio.o matches
Binary file ./src/.libs/broadcast_socket.o matches
./src/broadcast_socket.cpp:#include <iphlpapi.h> // for if_nametoindex
./src/broadcast_socket.cpp: // if_nametoindex was
introduced in vista
addr6.scope_id(if_nametoindex(i->name));
Binary file ./src/asio.o matches
Binary file ./src/broadcast_socket.o matches
./ChangeLog: * fix if_nametoindex build error on windows
So...I'd guess it's a Windows function, introduced in Vista, and you can
see the call in ...src/broadcast_socket.cpp. I'm not familiar with DLLs
on Windows, but perhaps you just need to tell your linker to scan the
network library again, or scan it _after_ libtorrent?
Regards,
dhm.
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications
Manager
Applications Manager provides deep performance insights into multiple
tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
--
Arvid Norberg
Continue reading on narkive:
Loading...