rakshasa / libtorrent

libTorrent BitTorrent library
http://rtorrent.net/downloads/
GNU General Public License v2.0
883 stars 210 forks source link

LibTorrentTest fails to build on 13.8 due to multiple definitions. #210

Open matzeri opened 4 years ago

matzeri commented 4 years ago

Cygwin 64bit with gcc 9.2

On test\Makefile.am there are an excess of libraries causing link to fail as multiple definitions are not permitted

LibTorrentTest_LDADD = \
        ../src/libtorrent.la \
        ../src/torrent/libsub_torrent.la \
        ../src/torrent/data/libsub_torrentdata.la \
        ../src/torrent/download/libsub_torrentdownload.la \
        ../src/torrent/peer/libsub_torrentpeer.la \
        ../src/data/libsub_data.la \
        ../src/dht/libsub_dht.la \
        ../src/net/libsub_net.la \
        ../src/protocol/libsub_protocol.la \
        ../src/download/libsub_download.la \
        ../src/tracker/libsub_tracker.la \
        ../src/utils/libsub_utils.la \
        ../src/torrent/utils/libsub_torrentutils.la

the correct form should be just

LibTorrentTest_LDADD = \
        ../src/libtorrent.la

as the shared library includes already all the other block of codes.

ghost commented 2 years ago

I can't for the life of me get libtorrent to link (in Cygwin) on master. It complains about a multiple definition.

This one IIRC, in src/torrent/net/socket_address.h: inline bool sap_is_broadcast(const sa_unique_ptr& sap) { return sa_is_broadcast(sap.get()); }

Hm, looking at it now, that's a pretty recent addition.

rakshasa commented 2 years ago

I fixed an issue with linking the tests a couple months ago, the OP's issue should be fixed.