libtorrent icon indicating copy to clipboard operation
libtorrent copied to clipboard

libtorrent 1.2.6 + python310 + boost > 1.70 build error gcc 4.9.x

Open th0ma7 opened this issue 3 years ago • 4 comments

Please provide the following information

libtorrent version (or branch): 1.2.6

platform/architecture: any (currently testing on x64, but also fails on arm5-7-8/i686/ppc)

compiler and compiler version: gcc-4.9.3

Linux version: Synology toolchain for DSM-6 Linux uses gcc-4.9.x.

It is possible to have a successful build with boost 1.70 using gcc-4.9. libtorrent fails to build with any version of boost after that using that gcc version. Note that this is only seen with gcc-4.9 as it does build properly using gcc-7.5 on the newer Synology DSM-7.

See attached log.

boost-1.76_build-x64-6.1.log

th0ma7 avatar Jun 18 '22 14:06 th0ma7

The problem is that the entry class uses a C++14 feature in its std::map (transparent comparators). Since 1.2.x doesn't require C++11, use of this feature is detected based on whether the compiler supports it or not.

If the library is built with a compiler that supports C++14, the resulting library may not be able to be used by a client building in C++11 mode.

arvidn avatar Jun 18 '22 18:06 arvidn

Trying to make mileage on that, could that be because boost ended-up detecting c++1y compatibility of gcc-4.9.x and used it, leading to inhability for libtorrent to build properly afterwards even if I pass it --b2-args=cxxstd=1y.

The solution could then be to enforce c++11 when building boost so it works out properly with libtorrent afterwards using --b2-args=cxxstd=11?

th0ma7 avatar Jun 18 '22 19:06 th0ma7

it's possible my conclusion above is incorrect. I don't think the version of boost would affect this.

You're saying that the exact same setup, but with a different boost version will built?

arvidn avatar Jun 19 '22 04:06 arvidn

i saw this if it helps.

/home/spksrc/deluge-strangelovian-4/spksrc/spk/include/boost/multiprec/deluge/work-x64-6.1/install//var/packages/deluge/targetision/detail/number_base.hpp:36:2: error: #error "This library now requires a C++11 or later compiler - this message was generated as a result of BOOST_NO_CXX11_HDR_TYPE_TRAITS being set"
#error "This library now requires a C++11 or later compiler - this message was generated as a result of BOOST_NO_CXX11_HDR_TYPE_TRAITS being set"

I'll add the whole bit

gcc.compile.c++ ../../bin/gcc-4.9.3/release/address-model-64/crypto-openssl/cxxstd-1y-iso/libtorrent-python-pic-on/link-static/lt-visibility-hidden/threading-multi/src/peer_connection.o
In file included from /home/spksrc/deluge-strangelovian-4/spksrc/spk/deluge/work-x64-6.1/install//var/packages/deluge/target/include/boost/multiprecision/traits/is_variable_precision.hpp:9:0,
			   from /home/spksrc/deluge-strangelovian-4/spksrc/spk/deluge/work-x64-6.1/install//var/packages/deluge/target/include/boost/multiprecision/detail/precision.hpp:9,
			   from /home/spksrc/deluge-strangelovian-4/spksrc/spk/deluge/work-x64-6.1/install//var/packages/deluge/target/include/boost/multiprecision/number.hpp:13,
			   from /home/spksrc/deluge-strangelovian-4/spksrc/spk/deluge/work-x64-6.1/install//var/packages/deluge/target/include/boost/multiprecision/cpp_int.hpp:12,
			   from ../../include/libtorrent/pe_crypto.hpp:41,
			   from ../../include/libtorrent/bt_peer_connection.hpp:55,
			   from ../../src/peer_connection.cpp:53:
/home/spksrc/deluge-strangelovian-4/spksrc/spk/deluge/work-x64-6.1/install//var/packages/deluge/target/include/boost/multiprecision/detail/number_base.hpp:36:2: error: #error "This library now requires a C++11 or later compiler - this message was generated as a result of BOOST_NO_CXX11_HDR_TYPE_TRAITS being set"
#error "This library now requires a C++11 or later compiler - this message was generated as a result of BOOST_NO_CXX11_HDR_TYPE_TRAITS being set"

userdocs avatar Jun 19 '22 17:06 userdocs

I was able to solve this issue. My PR related to deluge package can be found here: https://github.com/SynoCommunity/spksrc/pull/5398

Basically what I ended-up doing is:

  1. Use boost_1.78 with a patch https://github.com/SynoCommunity/spksrc/pull/5398/files#diff-df540bb06007666bf7ab3b5b7647ce5de3938ce9e7ece35a7fc0fb890cfdd9fe
  2. Enforce using -std=c++11 when building boost
  3. Enforce using -std=c++11 when building libtorrent (e.g. ensure both uses exactly the same options, period) through --b2-args=cxxstd=11 option
  4. Used --b2-args=address-model=32 --no-autoconf=address-model build option for 32-bit archs
  5. Always use --b2-args=libtorrent-python-pic=on

Thnx for you help.

th0ma7 avatar Aug 28 '22 11:08 th0ma7