Discussion:
[libtorrent] Libtorrent 1.1.1 with Boost 1.62 and GCC 4.9.2 does not compile
Arvid Norberg
2016-10-25 00:53:18 UTC
Permalink
it looks like mingw may be missing some Win32 declarations. You could try
disabling the use of GetAddressAdapters. looking at the enum_net.cpp and
thread.cpp (for CreateSemaphoreEx), it should be obvious what to define.
Configuration macros are defined in include/libtorrent/config.hpp. It looks
suspicious that mingw would be missing those functions though. do you have
win32 headers installed?

On Mon, Oct 24, 2016 at 12:32 PM, Jacque Lafitte <***@hotmail.com
> wrote:

> Hello,
>
>
> Thank you very much for your prompt reply. I have tried your suggestion of
> building from the pre-built version of boost, but it again did not compile.
> As suggested I have used:
>
>
> bjam --toolset=gcc release link=shared include="d:\CppLibraries\boost_1_62_0"
> linkflags="D:\CppLibraries\boost_1_62_0\stage\lib").
>
>
> Some of the error I got you can see below (the complete output is
> attached as build.log):
>
>
> **************
>
> gcc.compile.c++ bin\gcc-mingw-4.9.2\release\threading-multi\src\enum_net.o
> src\enum_net.cpp: In function 'std::vector<libtorrent::ip_route>
> libtorrent::enum_routes(libtorrent::io_service&,
> boost::system::error_code&)':
> src\enum_net.cpp:981:4: warning: '__stdcall__' attribute only applies to
> function types [-Wattributes]
> ADDRESS_FAMILY, PMIB_IPFORWARD_TABLE2*);
> ^
> src\enum_net.cpp:981:4: error: typedef 'GetIpForwardTable2_t' is
> initialized (use decltype instead)
> src\enum_net.cpp:981:4: error: 'ADDRESS_FAMILY' was not declared in this
> scope
> src\enum_net.cpp:981:20: error: 'PMIB_IPFORWARD_TABLE2' was not declared
> in this scope
> ADDRESS_FAMILY, PMIB_IPFORWARD_TABLE2*);
> ^
> src\enum_net.cpp:981:42: error: expected primary-expression before ')'
> token
> ADDRESS_FAMILY, PMIB_IPFORWARD_TABLE2*);
> ^
> src\enum_net.cpp:984:3: error: 'GetIpForwardTable2_t' was not declared in
> this scope
> GetIpForwardTable2_t GetIpForwardTable2 = (GetIpForwardTable2_t)
> GetProcAddress(
> ^
> src\enum_net.cpp:988:7: error: 'GetIpForwardTable2' was not declared in
> this scope
> if (GetIpForwardTable2 && FreeMibTable)
> ^
> src\enum_net.cpp:990:4: error: 'MIB_IPFORWARD_TABLE2' was not declared in
> this scope
> MIB_IPFORWARD_TABLE2* routes = NULL;
> ^
> src\enum_net.cpp:990:26: error: 'routes' was not declared in this scope
> MIB_IPFORWARD_TABLE2* routes = NULL;
> ^
>
> "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall
> -mthreads -Wc++11-compat -fvisibility-inlines-hidden -Wall -Wextra
> -Wno-format-zero-length -Wno-long-long -Wno-sign-compare
> -Wno-unused-variable -Wparentheses -Wpedantic -Wvla -fvisibility=hidden
> -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO
> -DBOOST_ASIO_HASH_MAP_BUCKETS=1021 -DBOOST_EXCEPTION_DISABLE
> -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_NO_DEPRECATED
> -DBOOST_SYSTEM_SOURCE -DNDEBUG -DTORRENT_BUILDING_LIBRARY
> -DTORRENT_BUILDING_SHARED -DTORRENT_USE_I2P=1 -DUNICODE -DWIN32
> -DWIN32_LEAN_AND_MEAN -D_FILE_OFFSET_BITS=64 -D_UNICODE -D_WIN32
> -D_WIN32_WINNT=0x0600 -D__USE_W32_SOCKETS -I"\opt\local\include"
> -I"\usr\local\include" -I"\usr\sfw\include" -I"D:\CppLibraries\boost_1_62_0"
> -I"ed25519\src" -I"include" -I"include\libtorrent" -c -o
> "bin\gcc-mingw-4.9.2\release\threading-multi\src\enum_net.o"
> "src\enum_net.cpp"
>
> ...failed gcc.compile.c++ bin\gcc-mingw-4.9.2\release\
> threading-multi\src\enum_net.o...
>
>
> gcc.compile.c++ bin\gcc-mingw-4.9.2\release\threading-multi\src\thread.o
> src\thread.cpp: In constructor 'libtorrent::condition_
> variable::condition_variable()':
> src\thread.cpp:111:70: error: 'CreateSemaphoreEx' was not declared in this
> scope
> m_sem = CreateSemaphoreEx(0, 0, INT_MAX, 0, 0, SEMAPHORE_ALL_ACCESS);
> ^
>
> "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall
> -mthreads -Wc++11-compat -fvisibility-inlines-hidden -Wall -Wextra
> -Wno-format-zero-length -Wno-long-long -Wno-sign-compare
> -Wno-unused-variable -Wparentheses -Wpedantic -Wvla -fvisibility=hidden
> -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO
> -DBOOST_ASIO_HASH_MAP_BUCKETS=1021 -DBOOST_EXCEPTION_DISABLE
> -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_NO_DEPRECATED
> -DBOOST_SYSTEM_SOURCE -DNDEBUG -DTORRENT_BUILDING_LIBRARY
> -DTORRENT_BUILDING_SHARED -DTORRENT_USE_I2P=1 -DUNICODE -DWIN32
> -DWIN32_LEAN_AND_MEAN -D_FILE_OFFSET_BITS=64 -D_UNICODE -D_WIN32
> -D_WIN32_WINNT=0x0600 -D__USE_W32_SOCKETS -I"\opt\local\include"
> -I"\usr\local\include" -I"\usr\sfw\include" -I"D:\CppLibraries\boost_1_62_0"
> -I"ed25519\src" -I"include" -I"include\libtorrent" -c -o
> "bin\gcc-mingw-4.9.2\release\threading-multi\src\thread.o"
> "src\thread.cpp"
>
> ...failed gcc.compile.c++ bin\gcc-mingw-4.9.2\release\
> threading-multi\src\thread.o...
>
> **************
>
>
> In relation to your question and my original error when building boost
> from source (using: bjam --toolset=gcc release link=shared >build.log 2>&1
> )
>
> "I imagine this is some issue with boost.chrono. I'm not sure why it
> wouldn't find this. Are these the first errors or are there errors
> preceding them indicating some headers can't be found?"
>
>
> Below you can see the output from the start to the first error and it does
> not seem to be any problem related to finding the headers. The complete
> output of the compile you can find attached (build01.log).
>
>
> Besides chrono.o, thread_clock.o and random_device.o I believe there are
> other boost files that could not be compiled.
>
>
> *************************
>
> CXXFLAGS =
> LDFLAGS =
> OS = NT
> building boost from source directory: D:\CppLibraries\boost_1_62_0\
> Performing configuration checks
>
> - 32-bit : yes
> - arm : no
> - mips1 : no
> - power : no
> - sparc : no
> - x86 : yes
> - symlinks supported : no
> - junctions supported : no
> - hardlinks supported : no
> ...patience...
> ...patience...
> ...found 2927 targets...
> ...updating 166 targets...
> gcc.compile.c++ D:\CppLibraries\boost_1_62_0\bin.v2\libs\chrono\build\gcc-
> mingw-4.9.2\release\chrono.o
> In file included from D:\CppLibraries\boost_1_62_0/
> boost/chrono/detail/inlined/win/chrono.hpp:15:0,
> from D:\CppLibraries\boost_1_62_0/
> boost/chrono/detail/inlined/chrono.hpp:30,
> from D:\CppLibraries\boost_1_62_0\
> libs\chrono\src\chrono.cpp:14:
> D:\CppLibraries\boost_1_62_0/boost/detail/winapi/time.hpp:90:9: error:
> '::GetTickCount64' has not been declared
> using ::GetTickCount64;
> ^
>
> "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall
> -pedantic -march=i686 -m32 -Wextra -Wno-long-long -DBOOST_ALL_DYN_LINK=1
> -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED
> -DNDEBUG -DTORRENT_USE_I2P=1 -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0600
> -I"D:\CppLibraries\boost_1_62_0" -c -o "D:\CppLibraries\boost_1_62_0\
> bin.v2\libs\chrono\build\gcc-mingw-4.9.2\release\chrono.o"
> "D:\CppLibraries\boost_1_62_0\libs\chrono\src\chrono.cpp"
>
> ...failed gcc.compile.c++ D:\CppLibraries\boost_1_62_0\
> bin.v2\libs\chrono\build\gcc-mingw-4.9.2\release\chrono.o...
> gcc.compile.c++ D:\CppLibraries\boost_1_62_0\bin.v2\libs\chrono\build\gcc-
> mingw-4.9.2\release\thread_clock.o
> In file included from D:\CppLibraries\boost_1_62_0/
> boost/detail/winapi/get_thread_times.hpp:14:0,
> from D:\CppLibraries\boost_1_62_0/
> boost/chrono/detail/inlined/win/thread_clock.hpp:21,
> from D:\CppLibraries\boost_1_62_0/
> boost/chrono/detail/inlined/thread_clock.hpp:29,
> from D:\CppLibraries\boost_1_62_0\
> libs\chrono\src\thread_clock.cpp:18:
> D:\CppLibraries\boost_1_62_0/boost/detail/winapi/time.hpp:90:9: error:
> '::GetTickCount64' has not been declared
> using ::GetTickCount64;
> ^
>
> "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall
> -pedantic -march=i686 -m32 -Wextra -Wno-long-long -DBOOST_ALL_DYN_LINK=1
> -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED
> -DNDEBUG -DTORRENT_USE_I2P=1 -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0600
> -I"D:\CppLibraries\boost_1_62_0" -c -o "D:\CppLibraries\boost_1_62_0\
> bin.v2\libs\chrono\build\gcc-mingw-4.9.2\release\thread_clock.o"
> "D:\CppLibraries\boost_1_62_0\libs\chrono\src\thread_clock.cpp"
>
> ...failed gcc.compile.c++ D:\CppLibraries\boost_1_62_0\
> bin.v2\libs\chrono\build\gcc-mingw-4.9.2\release\thread_clock.o...
> *******************
>
>
> Best regards,
>
> Jacque
>
> ------------------------------
> *From:* Arvid Norberg <***@gmail.com>
> *Sent:* Monday, October 24, 2016 2:18 AM
> *To:* Jacque Lafitte
> *Cc:* ***@libtorrent.org
> *Subject:* Re: Libtorrent 1.1.1 with Boost 1.62 and GCC 4.9.2 does not
> compile
>
> On Sun, Oct 23, 2016 at 6:05 PM, Jacque Lafitte <
> ***@hotmail.com> wrote:
>
>> Hello,
>>
>>
>> Sorry for writing to you directly, but I really do not know where to ask
>> for help.
>>
> There's a mailing list here: https://lists.sourceforge.net/lists/
> listinfo/libtorrent-discuss
>
>> I am knew both to c++, bjam and Libtorrent. I am following the
>> instructions described in http://www.libtorrent.org/building.html. So
>> far I have managed to install gcc through CodeBlocks and I have also
>> successfully installed Boost. However, when I try to compile libtorrent
>> using bjam, I get several compiling errors. You can see a couple of
>> examples below (see the attached build.log for my complete output):
>>
>>
>> D:\CppLibraries\boost_1_62_0/boost/detail/winapi/time.hpp:90:9: error:
>> '::GetTickCount64' has not been declared
>>
> I imagine this is some issue with boost.chrono. I'm not sure why it
> wouldn't find this. Are these the first errors or are there errors
> preceding them indicating some headers can't be found?
>
>> D:\CppLibraries\boost_1_62_0\libs\random\src\random_device.cpp:69:5:
>> error: conflicting declaration of C function 'BOOL
>> CryptEnumProvidersA(DWORD, DWORD*, DWORD, DWORD*, LPSTR, DWORD*)'
>>
> I've seen this one before, I was under the impression that this was an
> issue in boost.random. But since it builds when building boost stand-alone,
> maybe there's some other config that I'm getting wrong. I was under the
> impression that older versions of mingw did not include this declaration in
> their headers, so boost.random had to add one itself, which now causes a
> clash as mingw has that declaration. (I believe you can just remove it from
> the boost header).
>
>> My bjam call is as follows:
>>
>> bjam --toolset=gcc release link=shared >build.log 2>&1
>>
>>
>> My environmental variables are as follows:
>>
>> BOOST_ROOT=D:\CppLibraries\boost_1_62_0\
>>
>> BOOST_BUILD_PATH=D:\CppLibraries\boost_1_62_0\tools\build\
>>
>>
>> Note as well that when I compiled Boost everything compiled properly (all
>> my compiled boost files are located in "D:\CppLibraries\boost_1_62_0\
>> stage\lib"). What am I doing wrong?
>>
>
> Given that boost builds when built by itself, you could try building
> libtorrent with pre-built version of boost too.
>
> I take it you're building libtorrent 1.1.x, if you unset the BOOST_ROOT
> environment variable, the libtorrent Jamfile will expect boost to be
> "installed" (which mostly makes sense on linux/osx). However, on windows
> you can add those paths manually, like this:
>
> bjam gcc release link=shared include="d:\CppLibraries\boost_1_62_0"
> linkflags="D:\CppLibraries\boost_1_62_0\stage\lib"
>
> (This assumes the boost headers are available directly under
> d:\CppLibraries\boost_1_62_0\boost).
>
> In master (which is the current development version) I'm building with
> mingw on appveyor, but master uses C++11 standard library instead of
> boost.chrono and boost.random.
>
> https://github.com/arvidn/libtorrent/blob/master/appveyor.yml#L26
>
>> In before hand thank you very much.
>>
> --
> Arvid Norberg
>



--
Arvid Norberg
Jacque Lafitte
2016-10-26 12:34:15 UTC
Permalink
Hello,


The win32 headers are properly installed, but I have discovered that the win32 headers that MinGW is installing are incomplete as they are lacking some declarations. The declaration of CreateSemaphoreEx is for instance lacking in WinBase.h. To simplify matters, I have decided to switch to MS Visual C++ 2015 using the following command:


bjam --toolset=msvc release link=shared include="D:\CppLibraries\boost_1_62_0" linkflags="D:\CppLibraries\boost_1_62_0\stage\lib" >build.log 2>&1


However, when I try to compile with it I get the following error:

********

msvc.link.dll bin\msvc-14.0\release\threading-multi\torrent.dll

LINK : fatal error LNK1181: cannot open input file 'D:/CppLibraries/boost_1_62_0/stage/lib.obj'

********

By the way, the file "lib.obj" is not present. Am I missing some parameters so that this file can be created?


Everything else seems to be correct. I get a lot of warnings though as for instance:

********

warning C4275: non dll-interface class 'std::exception' used as base for dll-interface struct 'libtorrent::libtorrent_exception'
********

Should this warning be of concern?


Best regards,

Eric

________________________________
From: Arvid Norberg <***@gmail.com>
Sent: Tuesday, October 25, 2016 2:53 AM
To: Jacque Lafitte
Cc: libtorrent-***@lists.sourceforge.net
Subject: Re: Libtorrent 1.1.1 with Boost 1.62 and GCC 4.9.2 does not compile

it looks like mingw may be missing some Win32 declarations. You could try disabling the use of GetAddressAdapters. looking at the enum_net.cpp and thread.cpp (for CreateSemaphoreEx), it should be obvious what to define. Configuration macros are defined in include/libtorrent/config.hpp. It looks suspicious that mingw would be missing those functions though. do you have win32 headers installed?

On Mon, Oct 24, 2016 at 12:32 PM, Jacque Lafitte <***@hotmail.com<mailto:***@hotmail.com>> wrote:

Hello,


Thank you very much for your prompt reply. I have tried your suggestion of building from the pre-built version of boost, but it again did not compile. As suggested I have used:


bjam --toolset=gcc release link=shared include="d:\CppLibraries\boost_1_62_0" linkflags="D:\CppLibraries\boost_1_62_0\stage\lib").


Some of the error I got you can see below (the complete output is attached as build.log):


**************

gcc.compile.c++ bin\gcc-mingw-4.9.2\release\threading-multi\src\enum_net.o
src\enum_net.cpp: In function 'std::vector<libtorrent::ip_route> libtorrent::enum_routes(libtorrent::io_service&, boost::system::error_code&)':
src\enum_net.cpp:981:4: warning: '__stdcall__' attribute only applies to function types [-Wattributes]
ADDRESS_FAMILY, PMIB_IPFORWARD_TABLE2*);
^
src\enum_net.cpp:981:4: error: typedef 'GetIpForwardTable2_t' is initialized (use decltype instead)
src\enum_net.cpp:981:4: error: 'ADDRESS_FAMILY' was not declared in this scope
src\enum_net.cpp:981:20: error: 'PMIB_IPFORWARD_TABLE2' was not declared in this scope
ADDRESS_FAMILY, PMIB_IPFORWARD_TABLE2*);
^
src\enum_net.cpp:981:42: error: expected primary-expression before ')' token
ADDRESS_FAMILY, PMIB_IPFORWARD_TABLE2*);
^
src\enum_net.cpp:984:3: error: 'GetIpForwardTable2_t' was not declared in this scope
GetIpForwardTable2_t GetIpForwardTable2 = (GetIpForwardTable2_t)GetProcAddress(
^
src\enum_net.cpp:988:7: error: 'GetIpForwardTable2' was not declared in this scope
if (GetIpForwardTable2 && FreeMibTable)
^
src\enum_net.cpp:990:4: error: 'MIB_IPFORWARD_TABLE2' was not declared in this scope
MIB_IPFORWARD_TABLE2* routes = NULL;
^
src\enum_net.cpp:990:26: error: 'routes' was not declared in this scope
MIB_IPFORWARD_TABLE2* routes = NULL;
^

"g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -mthreads -Wc++11-compat -fvisibility-inlines-hidden -Wall -Wextra -Wno-format-zero-length -Wno-long-long -Wno-sign-compare -Wno-unused-variable -Wparentheses -Wpedantic -Wvla -fvisibility=hidden -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_HASH_MAP_BUCKETS=1021 -DBOOST_EXCEPTION_DISABLE -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_NO_DEPRECATED -DBOOST_SYSTEM_SOURCE -DNDEBUG -DTORRENT_BUILDING_LIBRARY -DTORRENT_BUILDING_SHARED -DTORRENT_USE_I2P=1 -DUNICODE -DWIN32 -DWIN32_LEAN_AND_MEAN -D_FILE_OFFSET_BITS=64 -D_UNICODE -D_WIN32 -D_WIN32_WINNT=0x0600 -D__USE_W32_SOCKETS -I"\opt\local\include" -I"\usr\local\include" -I"\usr\sfw\include" -I"D:\CppLibraries\boost_1_62_0" -I"ed25519\src" -I"include" -I"include\libtorrent" -c -o "bin\gcc-mingw-4.9.2\release\threading-multi\src\enum_net.o" "src\enum_net.cpp"

...failed gcc.compile.c++ bin\gcc-mingw-4.9.2\release\threading-multi\src\enum_net.o...


gcc.compile.c++ bin\gcc-mingw-4.9.2\release\threading-multi\src\thread.o
src\thread.cpp: In constructor 'libtorrent::condition_variable::condition_variable()':
src\thread.cpp:111:70: error: 'CreateSemaphoreEx' was not declared in this scope
m_sem = CreateSemaphoreEx(0, 0, INT_MAX, 0, 0, SEMAPHORE_ALL_ACCESS);
^

"g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -mthreads -Wc++11-compat -fvisibility-inlines-hidden -Wall -Wextra -Wno-format-zero-length -Wno-long-long -Wno-sign-compare -Wno-unused-variable -Wparentheses -Wpedantic -Wvla -fvisibility=hidden -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_HASH_MAP_BUCKETS=1021 -DBOOST_EXCEPTION_DISABLE -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_NO_DEPRECATED -DBOOST_SYSTEM_SOURCE -DNDEBUG -DTORRENT_BUILDING_LIBRARY -DTORRENT_BUILDING_SHARED -DTORRENT_USE_I2P=1 -DUNICODE -DWIN32 -DWIN32_LEAN_AND_MEAN -D_FILE_OFFSET_BITS=64 -D_UNICODE -D_WIN32 -D_WIN32_WINNT=0x0600 -D__USE_W32_SOCKETS -I"\opt\local\include" -I"\usr\local\include" -I"\usr\sfw\include" -I"D:\CppLibraries\boost_1_62_0" -I"ed25519\src" -I"include" -I"include\libtorrent" -c -o "bin\gcc-mingw-4.9.2\release\threading-multi\src\thread.o" "src\thread.cpp"

...failed gcc.compile.c++ bin\gcc-mingw-4.9.2\release\threading-multi\src\thread.o...


**************


In relation to your question and my original error when building boost from source (using: bjam --toolset=gcc release link=shared >build.log 2>&1)

"I imagine this is some issue with boost.chrono. I'm not sure why it wouldn't find this. Are these the first errors or are there errors preceding them indicating some headers can't be found?"


Below you can see the output from the start to the first error and it does not seem to be any problem related to finding the headers. The complete output of the compile you can find attached (build01.log).


Besides chrono.o, thread_clock.o and random_device.o I believe there are other boost files that could not be compiled.


*************************

CXXFLAGS =
LDFLAGS =
OS = NT
building boost from source directory: D:\CppLibraries\boost_1_62_0\
Performing configuration checks

- 32-bit : yes
- arm : no
- mips1 : no
- power : no
- sparc : no
- x86 : yes
- symlinks supported : no
- junctions supported : no
- hardlinks supported : no
...patience...
...patience...
...found 2927 targets...
...updating 166 targets...
gcc.compile.c++ D:\CppLibraries\boost_1_62_0\bin.v2\libs\chrono\build\gcc-mingw-4.9.2\release\chrono.o
In file included from D:\CppLibraries\boost_1_62_0/boost/chrono/detail/inlined/win/chrono.hpp:15:0,
from D:\CppLibraries\boost_1_62_0/boost/chrono/detail/inlined/chrono.hpp:30,
from D:\CppLibraries\boost_1_62_0\libs\chrono\src\chrono.cpp:14:
D:\CppLibraries\boost_1_62_0/boost/detail/winapi/time.hpp:90:9: error: '::GetTickCount64' has not been declared
using ::GetTickCount64;
^

"g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pedantic -march=i686 -m32 -Wextra -Wno-long-long -DBOOST_ALL_DYN_LINK=1 -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED -DNDEBUG -DTORRENT_USE_I2P=1 -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0600 -I"D:\CppLibraries\boost_1_62_0" -c -o "D:\CppLibraries\boost_1_62_0\bin.v2\libs\chrono\build\gcc-mingw-4.9.2\release\chrono.o" "D:\CppLibraries\boost_1_62_0\libs\chrono\src\chrono.cpp"

...failed gcc.compile.c++ D:\CppLibraries\boost_1_62_0\bin.v2\libs\chrono\build\gcc-mingw-4.9.2\release\chrono.o...
gcc.compile.c++ D:\CppLibraries\boost_1_62_0\bin.v2\libs\chrono\build\gcc-mingw-4.9.2\release\thread_clock.o
In file included from D:\CppLibraries\boost_1_62_0/boost/detail/winapi/get_thread_times.hpp:14:0,
from D:\CppLibraries\boost_1_62_0/boost/chrono/detail/inlined/win/thread_clock.hpp:21,
from D:\CppLibraries\boost_1_62_0/boost/chrono/detail/inlined/thread_clock.hpp:29,
from D:\CppLibraries\boost_1_62_0\libs\chrono\src\thread_clock.cpp:18:
D:\CppLibraries\boost_1_62_0/boost/detail/winapi/time.hpp:90:9: error: '::GetTickCount64' has not been declared
using ::GetTickCount64;
^

"g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pedantic -march=i686 -m32 -Wextra -Wno-long-long -DBOOST_ALL_DYN_LINK=1 -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED -DNDEBUG -DTORRENT_USE_I2P=1 -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0600 -I"D:\CppLibraries\boost_1_62_0" -c -o "D:\CppLibraries\boost_1_62_0\bin.v2\libs\chrono\build\gcc-mingw-4.9.2\release\thread_clock.o" "D:\CppLibraries\boost_1_62_0\libs\chrono\src\thread_clock.cpp"

...failed gcc.compile.c++ D:\CppLibraries\boost_1_62_0\bin.v2\libs\chrono\build\gcc-mingw-4.9.2\release\thread_clock.o...
*******************


Best regards,

Jacque

________________________________
From: Arvid Norberg <***@gmail.com<mailto:***@gmail.com>>
Sent: Monday, October 24, 2016 2:18 AM
To: Jacque Lafitte
Cc: ***@libtorrent.org<mailto:***@libtorrent.org>
Subject: Re: Libtorrent 1.1.1 with Boost 1.62 and GCC 4.9.2 does not compile

On Sun, Oct 23, 2016 at 6:05 PM, Jacque Lafitte <***@hotmail.com<mailto:***@hotmail.com>> wrote:

Hello,


Sorry for writing to you directly, but I really do not know where to ask for help.

There's a mailing list here: https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss

I am knew both to c++, bjam and Libtorrent. I am following the instructions described in http://www.libtorrent.org/building.html. So far I have managed to install gcc through CodeBlocks and I have also successfully installed Boost. However, when I try to compile libtorrent using bjam, I get several compiling errors. You can see a couple of examples below (see the attached build.log for my complete output):


D:\CppLibraries\boost_1_62_0/boost/detail/winapi/time.hpp:90:9: error: '::GetTickCount64' has not been declared

I imagine this is some issue with boost.chrono. I'm not sure why it wouldn't find this. Are these the first errors or are there errors preceding them indicating some headers can't be found?

D:\CppLibraries\boost_1_62_0\libs\random\src\random_device.cpp:69:5: error: conflicting declaration of C function 'BOOL CryptEnumProvidersA(DWORD, DWORD*, DWORD, DWORD*, LPSTR, DWORD*)'

I've seen this one before, I was under the impression that this was an issue in boost.random. But since it builds when building boost stand-alone, maybe there's some other config that I'm getting wrong. I was under the impression that older versions of mingw did not include this declaration in their headers, so boost.random had to add one itself, which now causes a clash as mingw has that declaration. (I believe you can just remove it from the boost header).

My bjam call is as follows:

bjam --toolset=gcc release link=shared >build.log 2>&1


My environmental variables are as follows:

BOOST_ROOT=D:\CppLibraries\boost_1_62_0\

BOOST_BUILD_PATH=D:\CppLibraries\boost_1_62_0\tools\build\


Note as well that when I compiled Boost everything compiled properly (all my compiled boost files are located in "D:\CppLibraries\boost_1_62_0\stage\lib"). What am I doing wrong?

Given that boost builds when built by itself, you could try building libtorrent with pre-built version of boost too.

I take it you're building libtorrent 1.1.x, if you unset the BOOST_ROOT environment variable, the libtorrent Jamfile will expect boost to be "installed" (which mostly makes sense on linux/osx). However, on windows you can add those paths manually, like this:

bjam gcc release link=shared include="d:\CppLibraries\boost_1_62_0" linkflags="D:\CppLibraries\boost_1_62_0\stage\lib"

(This assumes the boost headers are available directly under d:\CppLibraries\boost_1_62_0\boost).

In master (which is the current development version) I'm building with mingw on appveyor, but master uses C++11 standard library instead of boost.chrono and boost.random.

https://github.com/arvidn/libtorrent/blob/master/appveyor.yml#L26

In before hand thank you very much.

--
Arvid Norberg



--
Arvid Norberg
Loading...