Bug 206966 - devel/libzvbi: spurious libiconv underlinking on 10+ systems breaking consumers (e.g. ffmpeg + ZVBI=on)
Summary: devel/libzvbi: spurious libiconv underlinking on 10+ systems breaking consume...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords: needs-qa, patch
Depends on:
Blocks:
 
Reported: 2016-02-06 09:10 UTC by Kubilay Kocak
Modified: 2016-02-23 13:46 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (multimedia)
jbeich: maintainer-feedback+
jbeich: merge-quarterly+


Attachments
ffmpeg build log (8.52 KB, text/x-log)
2016-02-06 09:12 UTC, Vladimir Druzenko
no flags Details
multimedia/ffmpeg/work/ffmpeg-2.8.6/config.log (430.17 KB, text/x-log)
2016-02-06 09:15 UTC, Vladimir Druzenko
no flags Details
Dirty fix (574 bytes, patch)
2016-02-06 09:19 UTC, Vladimir Druzenko
no flags Details | Diff
libzvbi: modernize, v1 (1.96 KB, patch)
2016-02-07 00:22 UTC, Jan Beich
jbeich: maintainer-approval? (oliver)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kubilay Kocak freebsd_committer freebsd_triage 2016-02-06 09:10:01 UTC
ffmpeg appears to fail to configure when the ZVBI option is enabled:

===>  Configuring for ffmpeg-2.8.6,1
ERROR: libzvbi not found

On initial investigation, it appears that ZVBI requires libiconv to function

It appears this could be conditionally added via CONFIGURE_ARGS using:

--extra-libs=-liconv

Reported by: VVD (via #bsdports IRC)

Pending

* Full build log (as attachment)
* config.log (as attachment)
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2016-02-06 09:12:41 UTC
Created attachment 166643 [details]
ffmpeg build log
Comment 2 Vladimir Druzenko freebsd_committer freebsd_triage 2016-02-06 09:15:34 UTC
Created attachment 166644 [details]
multimedia/ffmpeg/work/ffmpeg-2.8.6/config.log

# grep libzvbi.so config.log 
/usr/local/lib/libzvbi.so: undefined reference to `libiconv'
/usr/local/lib/libzvbi.so: undefined reference to `libiconv_open'
/usr/local/lib/libzvbi.so: undefined reference to `libiconv_close'
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2016-02-06 09:19:50 UTC
Created attachment 166645 [details]
Dirty fix
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2016-02-06 10:17:10 UTC
This change needs to be made:

* Conditional on the ZVBI option
* Using framework variables (ICONV_LIB et al)
* Using the correct arguments via the port frameworks CONFIGURE_* variables
Comment 5 Thomas Zander freebsd_committer freebsd_triage 2016-02-06 10:31:32 UTC
(In reply to Kubilay Kocak from comment #4)

Before any changes are made, I would like to understand the problem, because I am not able to reproduce this here.
Just tried multiple builds on stable/10 and 9.3 with various OPTIONs combinations and this problem has not surfaced. Can you provide a full poudriere log for this?
Comment 6 Kubilay Kocak freebsd_committer freebsd_triage 2016-02-06 17:41:02 UTC
@Thomas they've been attached

Thanks for picking this up
Comment 7 Thomas Zander freebsd_committer freebsd_triage 2016-02-06 20:40:38 UTC
(In reply to Kubilay Kocak from comment #6)

Nope, they aren't :-)

Background why I asked for poudriere logs: The logs currently attached to the bug report show that this build failure happened during a portmaster run. That means all kinds of local specific issues could be the cause of the failure. Also it does not contain information w.r.t. ARCH, OSVERSION, etc., so I am having a hard time reproducing the issue here.

My crystal ball guess is that the libzvbi.so on the reporter's machine looks different from what pops out of poudriere. A full poudriere log from libzvbi and ffmpeg would help me a lot to find the differences.
Comment 8 Jan Beich freebsd_committer freebsd_triage 2016-02-07 00:22:09 UTC
Created attachment 166678 [details]
libzvbi: modernize, v1

Changes in the patch:
- Pass -DLIBICONV_PLUG
- Make NLS optional
- Convert to USES=localbase
- Don't try to detect Doxygen
- Strip binaries
- Drop unused USES=pkgconfig

(In reply to vvd from comment #2)
> _OSRELEASE=10.2-RELEASE-p2
> OSVERSION=1002000
> ARCH=i386
> CPPFLAGS=-DLIBICONV_PLUG
[...]
> /usr/local/lib/libzvbi.so: undefined reference to `libiconv'
> /usr/local/lib/libzvbi.so: undefined reference to `libiconv_open'
> /usr/local/lib/libzvbi.so: undefined reference to `libiconv_close'

With converters/libiconv installed before devel/libzvbi the configure uses wrong <iconv.h> thanks to CPPFLAGS+=-I${LOCALBASE}/include. On 10+ systems USES=iconv passes -DLIBICONV_PLUG to allow co-existence with iconv in libc.

  $ readelf -d /usr/local/lib/libzvbi.so | fgrep NEEDED
   0x0000000000000001 (NEEDED)             Shared library: [libunicode.so.0]
   0x0000000000000001 (NEEDED)             Shared library: [libintl.so.8]
   0x0000000000000001 (NEEDED)             Shared library: [libthr.so.3]
   0x0000000000000001 (NEEDED)             Shared library: [libm.so.5]
   0x0000000000000001 (NEEDED)             Shared library: [libpng16.so.16]
   0x0000000000000001 (NEEDED)             Shared library: [libz.so.6]
   0x0000000000000001 (NEEDED)             Shared library: [libc.so.7]

  # clean build
  $ nm -D /usr/local/lib/libzvbi.so | grep 'U .*iconv'
		   U __bsd_iconv
		   U __bsd_iconv_close
		   U __bsd_iconv_open

  # after converters/libiconv installed
  $ nm -D /usr/local/lib/libzvbi.so | grep 'U .*iconv'
		   U libiconv
		   U libiconv_close
		   U libiconv_open
Comment 9 Oliver Lehmann freebsd_committer freebsd_triage 2016-02-07 12:08:27 UTC
@Jan Beich
The patch "libzvbi: modernize, v1" looks good for me. If this fixes the problem - just go ahead and commit it. Thank you for taking the time!
Comment 10 commit-hook freebsd_committer freebsd_triage 2016-02-07 16:26:50 UTC
A commit references this bug:

Author: jbeich
Date: Sun Feb  7 16:26:02 UTC 2016
New revision: 408422
URL: https://svnweb.freebsd.org/changeset/ports/408422

Log:
  devel/libzvbi: modernize

  - Pass -DLIBICONV_PLUG [1]
  - Make NLS optional [2]
  - Convert to USES=localbase
  - Don't try to detect Doxygen
  - Strip binaries
  - Drop unused USES=pkgconfig
  - Define LICENSE

  PR:		206966
  Reported by:	vvd@unislabs.com (via koobs) [1]
  Approved by:	oliver (maintainer) [1][2], portmgr blanket

Changes:
  head/devel/libzvbi/Makefile
  head/devel/libzvbi/pkg-plist
Comment 11 Jan Beich freebsd_committer freebsd_triage 2016-02-07 16:44:31 UTC
VVD, can you rebuild devel/libzvbi and try again? If ffmpeg + ZVBI builds fine now close the bug.
Comment 12 Thomas Zander freebsd_committer freebsd_triage 2016-02-07 17:30:22 UTC
Assign to Jan since he is driving the livzvbi fix which is presumably the fix for the whole issue.

Jan, if there is something left to do in ffmpeg, feel free to assign it back to me. Thanks!
Comment 13 Vladimir Druzenko freebsd_committer freebsd_triage 2016-02-07 18:49:17 UTC
# pkg delete -yf libzvbi-0.2.35_2
…
# portmaster devel/libzvbi
…
===>   libzvbi-0.2.35_3 depends on package: libiconv>=1.14_9 - found
…
Making all in examples
if cc -DHAVE_CONFIG_H -I. -I. -I.. -I../src   -DLIBICONV_PLUG -isystem /usr/local/include -I/usr/local/include  -O2 -pipe -march=core2  -DLIBICONV_PLUG -isystem /usr/local/include -fstack-protector -fno-strict-aliasing -MT network.o -MD -MP -MF ".deps/network.Tpo" -c -o network.o network.c;  then mv -f ".deps/network.Tpo" ".deps/network.Po"; else rm -f ".deps/network.Tpo"; exit 1; fi
/bin/sh ../libtool --tag=CC --mode=link cc  -O2 -pipe -march=core2  -DLIBICONV_PLUG -isystem /usr/local/include -fstack-protector -fno-strict-aliasing   -L/usr/local/lib -fstack-protector -o network  network.o ../src/libzvbi.la   -lm  -L/usr/local/lib -lintl -R/usr/local/lib -lpthread  -lm  -lpng -lz
libtool: link: cc -O2 -pipe -march=core2 -DLIBICONV_PLUG -isystem /usr/local/include -fstack-protector -fno-strict-aliasing -fstack-protector -o .libs/network network.o  -L/usr/local/lib ../src/.libs/libzvbi.so -lintl -lpthread -lm -lpng -lz -Wl,-rpath -Wl,/usr/local/lib
/usr/local/lib/libunicode.so.0: undefined reference to `libiconv'
/usr/local/lib/libunicode.so.0: undefined reference to `libiconv_close'
/usr/local/lib/libunicode.so.0: undefined reference to `libiconv_open'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
make[4]: stopped in /usr/obj/usr/ports/devel/libzvbi/work/zvbi-0.2.35/examples
*** Error code 1

Stop.
make[3]: stopped in /usr/obj/usr/ports/devel/libzvbi/work/zvbi-0.2.35
*** Error code 1

Stop.
make[2]: stopped in /usr/obj/usr/ports/devel/libzvbi/work/zvbi-0.2.35
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/devel/libzvbi
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/libzvbi

===>>> make build failed for devel/libzvbi
===>>> Aborting update


===>>> You can restart from the point of failure with this command line:
       portmaster <flags> devel/libzvbi
Comment 14 Vladimir Druzenko freebsd_committer freebsd_triage 2016-02-17 16:42:12 UTC
Need too patch /usr/ports/devel/libunicode/Makefile to fix error from last log:
- USES=           gmake libtool
+ USES=           iconv gmake libtool
Comment 15 commit-hook freebsd_committer freebsd_triage 2016-02-22 17:05:10 UTC
A commit references this bug:

Author: jbeich
Date: Mon Feb 22 17:04:15 UTC 2016
New revision: 409360
URL: https://svnweb.freebsd.org/changeset/ports/409360

Log:
  devel/libunicode: properly register iconv dependency

  Avoid accidentally using converters/libiconv symbols when libc is
  desired by passing -DLIBICONV_PLUG during build. This fixes the
  following error in consumers:

  /usr/local/lib/libunicode.so.0: undefined reference to `libiconv'
  /usr/local/lib/libunicode.so.0: undefined reference to `libiconv_close'
  /usr/local/lib/libunicode.so.0: undefined reference to `libiconv_open'

  PR:		206966
  Submitted by:	vvd@unislabs.com
  Approved by:	portmgr blanket
  MFH:		2016Q1

Changes:
  head/devel/libunicode/Makefile
Comment 16 commit-hook freebsd_committer freebsd_triage 2016-02-23 09:59:39 UTC
A commit references this bug:

Author: jbeich
Date: Tue Feb 23 09:59:10 UTC 2016
New revision: 409393
URL: https://svnweb.freebsd.org/changeset/ports/409393

Log:
  MFH: r408422

  devel/libzvbi: modernize

  - Pass -DLIBICONV_PLUG [1]
  - Make NLS optional [2]
  - Convert to USES=localbase
  - Don't try to detect Doxygen
  - Strip binaries
  - Drop unused USES=pkgconfig
  - Define LICENSE

  PR:		206966
  Reported by:	vvd@unislabs.com (via koobs) [1]
  Approved by:	oliver (maintainer) [1][2], portmgr blanket
  Approved by:	ports-secteam (feld)

Changes:
_U  branches/2016Q1/
  branches/2016Q1/devel/libzvbi/Makefile
  branches/2016Q1/devel/libzvbi/pkg-plist
Comment 17 commit-hook freebsd_committer freebsd_triage 2016-02-23 10:01:42 UTC
A commit references this bug:

Author: jbeich
Date: Tue Feb 23 10:01:08 UTC 2016
New revision: 409400
URL: https://svnweb.freebsd.org/changeset/ports/409400

Log:
  MFH: r409360

  devel/libunicode: properly register iconv dependency

  Avoid accidentally using converters/libiconv symbols when libc is
  desired by passing -DLIBICONV_PLUG during build. This fixes the
  following error in consumers:

  /usr/local/lib/libunicode.so.0: undefined reference to `libiconv'
  /usr/local/lib/libunicode.so.0: undefined reference to `libiconv_close'
  /usr/local/lib/libunicode.so.0: undefined reference to `libiconv_open'

  PR:		206966
  Submitted by:	vvd@unislabs.com
  Approved by:	portmgr blanket
  Approved by:	ports-secteam (feld)

Changes:
_U  branches/2016Q1/
  branches/2016Q1/devel/libunicode/Makefile
Comment 18 Vladimir Druzenko freebsd_committer freebsd_triage 2016-02-23 13:38:10 UTC
All compiled fine.
Thanks!