Bug 198072 - net-p2p/libtorrent-rasterbar - Needs linking with converters/libiconv
Summary: net-p2p/libtorrent-rasterbar - Needs linking with converters/libiconv
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Kurt Jaeger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-27 14:19 UTC by bro.development
Modified: 2015-09-04 16:52 UTC (History)
2 users (show)

See Also:


Attachments
Patch for iconv:wchar_t and building without STRIP (1011 bytes, patch)
2015-02-27 17:18 UTC, bro.development
no flags Details | Diff
Replace iconv with iconv:wchar_t to force linking with converters/libiconv (410 bytes, patch)
2015-09-04 15:56 UTC, bro.development
bro.development: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description bro.development 2015-02-27 14:19:43 UTC
I have experienced problems with libtorrent-rasterbar every since upgrading to FreeBSD 9, due to the separation of base iconv vs libiconv.

When libtorrent-rasterbar is not linked with converters/libiconv, it fails to properly handle downloaded files containing some non-ascii characters in the filename, where they are replaced with '?'. When linking with converters/libiconv, the downloaded files are named correctly. 

Presumably, this is caused by the base iconv lacking some features, as discussed here: http://freebsd.1045724.n5.nabble.com/Base-iconv-sort-of-replaces-libiconv-in-FreeBSD-10-td5886786.html

This issue can be fixed by removing 'iconv' from the USES line in the Makefile, which prevents Mk/Uses/iconv.mk from messing with the iconv linking.

Alternatively, replacing 'iconv' with 'iconv:wchar_t' also works, which also 
adds 'libiconv.so:${PORTSDIR}/converters/libiconv' to LIB_DEPENDS.

After compiling, verify that it's linked to libiconv:

$ ldd work/libtorrent-rasterbar-0.16.19/src/.libs/libtorrent-rasterbar.so.7.0.0 
work/libtorrent-rasterbar-0.16.19/src/.libs/libtorrent-rasterbar.so.7.0.0:
        libboost_system.so.1.55.0 => /usr/local/lib/libboost_system.so.1.55.0 (0x80195b000)
        libssl.so.8 => /usr/local/lib/libssl.so.8 (0x801b5e000)
        libcrypto.so.8 => /usr/local/lib/libcrypto.so.8 (0x801dc7000)
        libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x8021cd000)
        libGeoIP.so.1 => /usr/local/lib/libGeoIP.so.1 (0x8024c7000)
        libthr.so.3 => /lib/libthr.so.3 (0x80270b000)
        libc++.so.1 => /usr/lib/libc++.so.1 (0x802930000)
        libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x802bf0000)
        libm.so.5 => /lib/libm.so.5 (0x802e0c000)
        libc.so.7 => /lib/libc.so.7 (0x80081f000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x803034000)
Comment 1 bro.development 2015-02-27 17:18:36 UTC
Created attachment 153587 [details]
Patch for iconv:wchar_t and building without STRIP

As a sidenote, configuring with the STRIP option off fails because it tries to strip the python bindings file in the post-install target. The logic in post-install doesn't make sense, as it will strip libtorrent-rasterbar.so if STRIP is enabled, else it will strip the python binding site-packages/libtorrent.so.

It's a bit of a headache to fix, as it will need to test if STRIP is enabled when executed from the libtorrent-rasterbar-python. However, as STRIP is not an option in the libtorrent-rasterbar-python Makefile it cannot test for this. Unless it's possible to test if STRIP is enabled in the master port config, a separate STRIP is needed in libtorrent-rasterbar-python.

The attached patch requires the STRIP option to be removed from the EXCLUDE line in net-p2p/libtorrent-rasterbar-python/Makefile:
-OPTIONS_EXCLUDE=       DOCS EXAMPLES STRIP
+OPTIONS_EXCLUDE=       DOCS EXAMPLES
Comment 2 bro.development 2015-08-26 15:42:00 UTC
The Makefile in ports (libtorrent-rasterbar 1.0.6) can be fixed
by replacing iconv with iconv:wchar_t.

-USES+=          compiler:c++11-lang iconv libtool pathfix pkgconfig
+USES+=          compiler:c++11-lang iconv:wchar_t libtool pathfix pkgconfig
Comment 3 bro.development 2015-09-04 15:56:57 UTC
Created attachment 160721 [details]
Replace iconv with iconv:wchar_t to force linking with converters/libiconv

Patches net-p2p/libtorrent-rasterbar/Makefile to force linking with with converters/libiconv. Tested with libtorrent-rasterbar v1.0.6.
Comment 4 Kurt Jaeger freebsd_committer 2015-09-04 16:36:22 UTC
build-test @work
Comment 5 commit-hook freebsd_committer 2015-09-04 16:51:14 UTC
A commit references this bug:

Author: pi
Date: Fri Sep  4 16:50:37 UTC 2015
New revision: 396112
URL: https://svnweb.freebsd.org/changeset/ports/396112

Log:
  net-p2p/libtorrent-rasterbar: fix use of libiconv for non-ascii file download

  PR:		198072
  Submitted by:	bro.development@gmail.com

Changes:
  head/net-p2p/libtorrent-rasterbar/Makefile
Comment 6 Kurt Jaeger freebsd_committer 2015-09-04 16:52:40 UTC
Committed, thanks.