[Libtorrent-devel] libtorrent compilation broken under GCC 4.3.1

Brian Stentzel brianstentzel at gmail.com
Mon Jul 14 08:41:05 UTC 2008


Ever since the first betas (and probably alphas, but I didn't test
those) of OpenSuSE 11.0 started including GCC 4.3.1 (as opposed to the
old 4.2.0 as shipped with OpenSuSE 10.3, which worked fine), I've been
unable to compile libtorrent.  In the earliest days, there were
problems with libsigc++ not being compatible with GCC 4.3, but those
have been resolved, and the errors now are in the libtorrent code.

To be as clear and helpful as possible, I've checked libtorrent out
from SVN as I've typed this, and I'll include the errors I get as I
go.

I start with ./autogen.sh of course, which works fine, then I run
./configure with no arguments, which also works fine and issues no
complaints or warnings.

Then I run make and get this error on the 5th file:

---- snip ----
In file included from file_list_iterator.cc:42:
file_list_iterator.h: In member function 'uint32_t
torrent::FileListIterator::depth() const':
file_list_iterator.h:64: error: 'abs' is not a member of 'std'
---- snip ----

So I edit src/torrent/data/file_list_iterator.h, line 64, and replace
the reference to std::abs, which looks like this:

---- snip: src/torrent/data/file_list_iterator.h:64 ----
  uint32_t            depth() const       { return std::abs(m_depth); }
---- snip ----

to look like this:

---- snip: src/torrent/data/file_list_iterator.h:64 ----
  uint32_t            depth() const       { if (m_depth < 0) return (0
- m_depth); else return m_depth; }
---- snip ----

Bunching everything onto one line like that isn't my style, and more
importantly, I'm sure an abs()-like function would best be implemented
with the ?: operator.  But I'm lazy, and haven't ever used it myself.
And this works, so...

With that duct-tape workaround implemented, the compile moves along
smoothly until it gets to this:

---- snip ----
In file included from chunk_manager.cc:43:
./../data/chunk_list.h:62: error: ISO C++ forbids declaration of 'type
name' with no type
./../data/chunk_list.h:62: error: template argument 3 is invalid
---- snip ----

I haven't yet discovered a way around this, and have determined that
it must be an issue with the way GCC 4.3.xx handles ISO C++ standards
compliance.  Would some sort of switch disabling
ISO-conformance-enforcement work here?  What needs to be done to the
actual code itself to get around this?

I posted a message to the "contact me" link on the website, but have
received no response in weeks, so thought I should try here.  Sorry if
this issue has been mentioned previously.  In any case, it seems like
it affects any system running GCC 4.3.1, and probably 4.3.0 (though I
don't know that for certain, or even which systems run 4.3.0).

Any suggestions are greatly appreciated.  I've absolutely hated having
to use Azureus/Vuze since I upgraded to OpenSuSE 11.0, and am quite
anxious to get back to using trusty rtorrent.

Thanks.


More information about the Libtorrent-devel mailing list