On 8/17/2020 9:51 PM, Nam Nguyen wrote:
Nam Nguyen writes:

This is a diff for an update to net/libtorrent-rasterbar 1.2.8, released
on August 4, 2020.
This new diff applies cleanly now that rsadsowski@ updated devel/boost
to 1.67.0. It also uses -mt variants of boost_system-mt and
boost_python38-mt.

Reasons:
- cmake build uses -mt variants for both
- I was getting undefined symbols with 1.2.8 + system-mt + python38
(non-mt). 1.2.3 + system-mt + python38 (non-mt), as it is currently in
the ports tree, works, however.

$ python3
Python 3.8.5 (default, Aug 13 2020, 13:09:39)
[Clang 10.0.1 ] on openbsd6
Type "help", "copyright", "credits" or "license" for more information.
import libtorrent
python3:/usr/local/lib/python3.8/site-packages/libtorrent.so: undefined symbol 
'_ZTIN10libtorrent12socks5_alertE'
python3:/usr/local/lib/python3.8/site-packages/libtorrent.so: undefined symbol 
'_ZN10libtorrent9peer_infoC1ERKS0_'
python3:/usr/local/lib/python3.8/site-packages/libtorrent.so: undefined symbol 
'_ZN10libtorrent9peer_infoD1Ev'
python3:/usr/local/lib/python3.8/site-packages/libtorrent.so: undefined symbol 
'_ZN10libtorrent9peer_infoC1Ev'
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
ImportError: Cannot load specified object

changelog:
https://github.com/arvidn/libtorrent/blob/libtorrent-1.2.8/ChangeLog

base-clang 10.0.1 unbreaks libtorrent-rasterbar. This diff is based on
rsadowski@'s devel/boost 1.67.0 update.

https://marc.info/?l=openbsd-ports&m=159566156026888&w=2

This diff:
- is based on rsadowski@'s devel/boost 1.67.0 update, which moves from
boost_python3 to boost_python38. rsadowski@ uses MODPY_VERSION here in
naming WANTLIB and CONFIGURE_ARGS
- updates to 1.2.8
- bumps library major due to symbol deletion
- adds a license marker for ConvertUTF.cpp, slated to be removed in
upcoming 1.2.9
- changes MASTER_SITES to properly download the new release
- specifies devel/boost>=1.67.0
- uses non-mt variants of both boost_system and boost_python38
uses mt variants of libboost_system-mt and libboost_python38-mt

- links to -liconv (libiconv.so.7.0) instead of libiconv.a
- regens WANTLIB with boost_python38, boost_system (non-mt) and iconv

python bindings
===============

lboost_python38 and lboost_system = works
lboost_python38-mt and lboost_system-mt = works
nonmatching -mt = broken

When they were nonmatching -mt as in rsadowski@'s boost update, I had two
outcomes:
  - more recently, SIGILL on deluge startup
  - update-plist in deluge:
  Warning: libtorrent (libtorrent-rasterbar) not found: Cannot load specified 
object
  ===>  Faking installation for deluge-2.0.3p1

I can no longer reproduce the latter since moving from ports-clang back to
base-clang. I now always get the SIGILL with nonmatching -mt.

To resolve make sure that _system and _python are matching -mt or
non-mt.

I have an experimental cmake build where cmake uses -lboost_python38-mt
and -lboost_system-mt in building python bindings
(bindings/python/libtorrent.so). See the first half of the log file. It
works.

The second half of the log file shows the autohell Makefile using
-lboost_system-mt and -lboost_python38, which was broken.

log file: https://www.namtsui.com/public/pythonbindings.txt

upstream states that boost build (b2) > cmake > autohell for reliably
building libtorrent python bindings (libtorrent.so). autohell is removed
altogether in the libtorrent 2 branch, unrelated to 1.2.8. Moving to
cmake is an option but not necessary.

iconv
=====

libiconv.a is always preferred by autohell over libiconv.so.7.0. I
replace all generated Makefiles using iconv.a (second half of log file)
with -liconv (first half of log file).

Specifically, I deleted /usr/local/lib/libiconv.a so that it could only
find libiconv.so.7.0. The result is printed in the first half of log
file.

log file: https://www.namtsui.com/public/iconv.txt

make port-lib-depends-check is happy and iconv is now added to
WANTLIB. This is hacky. Other options:
- move to cmake, which finds -liconv
- use libiconv.a and remove this

Licensing
=========

debian removed libtorrent-rasterbar because ConvertUTF8.cpp has a
special Unicode, Inc., license.

Is it fine to leave PERMIT_PACKAGE as is, since upstream will remove it
in the upcoming 1.2.9?

https://github.com/arvidn/libtorrent/pull/4966
https://github.com/arvidn/libtorrent/issues/4951

Major bump
==========

1. I referenced "CMakeLists.txt: set (SOVERSION "10")" to keep # 10.0.0 as
kn@ had done with a previous update.

2. has_udp_outgoing-sockets() (see 1.2.3's
include/libtorrent/aux_/session_impl.hpp:731) has been removed in
1.2.8. This symbol deletion is enough for bumping major.

3. Changelog also says, "deprecate broadcast_lsd setting. Just use
multicast"

- include/libtorrent/settings_pack.hpp
settings_pack struct in 1.2.3 used to have broadcast_lsd:

// if ``broadcast_lsd`` is set to true, the local peer discovery (or
// Local Service Discovery) will not only use IP multicast, but also
// broadcast its messages. This can be useful when running on networks
// that don't support multicast. Since broadcast messages might be
// expensive and disruptive on networks, only every 8th announce uses
// broadcast.
broadcast_lsd,

- in 1.2.8:

#if TORRENT_ABI_VERSION == 1
   // if ``broadcast_lsd`` is set to true, the local peer discovery (or
   // Local Service Discovery) will not only use IP multicast, but also
   // broadcast its messages. This can be useful when running on networks
   // that don't support multicast. Since broadcast messages might be
   // expensive and disruptive on networks, only every 8th announce uses
   // broadcast.
   broadcast_lsd TORRENT_DEPRECATED_ENUM,
#else
   deprecated_broadcast_lsd,
#endif

- TORRENT_DEPRECATED_ENUM is defined as:

include/libtorrent/aux_/deprecated.hpp:43:
#  define TORRENT_DEPRECATED_ENUM __attribute__ ((deprecated))

The deprecated attribute means that its use is discourged with a warning
if used but still supported. This could also arguably warrant a major
bump, but the removal in #2 is enough.

Testing
=======

To test:
1. update to boost 1.67
https://marc.info/?l=openbsd-ports&m=159566156026888&w=2
2. use this diff instead for net/libtorrent-rasterbar

I tested torrenting a linux ISO with net/deluge and
net/qbitorrent. Tests are in the same state as before: 47/50 pass.

Feedback and tests are welcome.

You should be able to remove the PYTHON_CXXFLAGS and CXXFLAGS lines.

The iconv issue is regarding a bug that was fixed like 8 - 10 years ago but
the autoconf macros included with libtorrent-rasterbar are ancient. I filed
a bug report upstream.

Reply via email to