Bug 214538

Summary: sysutils/lnav: fails to build if databases/sqlite3 was built with ICU=on
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: Jan Beich <jbeich>
Status: Closed FIXED    
Severity: Affects Only Me CC: pavelivolkov, tom
Priority: --- Keywords: needs-patch
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214551
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214552
Attachments:
Description Flags
Path to add ICU.
none
Path to add ICU.
none
Dynamic linking
none
Dynamic linking none

Description Jan Beich freebsd_committer freebsd_triage 2016-11-15 16:39:09 UTC
c++  -O2 -pipe -fstack-protector -fno-strict-aliasing  -Lsrc/static-libs    -pthread -fstack-protector -L/usr/local/lib -L/usr/lib -L//lib -o lnav lnav.o dump-pid-sh.o help.o init-sql.o default-log-formats-json.o default-config-json.o dhclient-summary.opartition-by-boot.o libdiag.a -lreadline -lncursesw -lsqlite3  -lpcrecpp -lpcrecpp -lpcre -ltinfo -lexecinfo -lbz2 -lz -lutil
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuRegexpFunc':
(.text+0x1a2eb): undefined reference to `uregex_open'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuRegexpFunc':
(.text+0x1a338): undefined reference to `uregex_setText'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuRegexpFunc':
(.text+0x1a35d): undefined reference to `uregex_matches'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuRegexpFunc':
(.text+0x1a39a): undefined reference to `uregex_setText'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuCaseFunc16':
(.text+0x1a498): undefined reference to `u_strToUpper'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuCaseFunc16':
(.text+0x1a4bf): undefined reference to `u_strToLower'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuLikeFunc':
(.text+0x1a6be): undefined reference to `utf8_nextCharSafeBody'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuLoadCollation':
(.text+0x1a798): undefined reference to `ucol_open'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuLoadCollation':
(.text+0x1a7e7): undefined reference to `ucol_close'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuFunctionError':
(.text+0x1a843): undefined reference to `u_errorName'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuCollationColl':
(.text+0x1a8f3): undefined reference to `ucol_strcoll'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuCollationDel':
(.text+0x1a90e): undefined reference to `ucol_close'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuLikeCompare':
(.text+0x1a9eb): undefined reference to `u_foldCase'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuLikeCompare':
(.text+0x1a9fe): undefined reference to `u_foldCase'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuRegexpDelete':
(.text+0x1aa99): undefined reference to `uregex_close'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuOpen':
(.text+0x3112f): undefined reference to `utf8_nextCharSafeBody'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuOpen':
(.text+0x3114e): undefined reference to `u_foldCase'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuOpen':
(.text+0x31284): undefined reference to `utf8_nextCharSafeBody'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuOpen':
(.text+0x312ba): undefined reference to `ubrk_open'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuOpen':
(.text+0x312dd): undefined reference to `ubrk_first'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuClose':
(.text+0x312ff): undefined reference to `ubrk_close'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuNext':
(.text+0x31338): undefined reference to `ubrk_current'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuNext':
(.text+0x31345): undefined reference to `ubrk_next'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuNext':
(.text+0x313a5): undefined reference to `u_isspace'
src/static-libs/libsqlite3.a(sqlite3.o): In function `icuNext':
(.text+0x3141e): undefined reference to `u_strToUTF8'
c++: error: linker command failed with exit code 1 (use -v to see invocation)


http://package22.nyi.freebsd.org/data/103i386-default-PR214384/2016-11-14_20h14m36s/logs/errors/lnav-0.8.1.log
Comment 1 Pavel Volkov 2016-11-16 04:28:14 UTC
Created attachment 177050 [details]
Path to add ICU.

Hello.
ICU Library is not part of the SQLite library.
Although SQLite may depend on the ICU.
In this case, you simply need to add the ICU as depend to your port.
Comment 2 Pavel Volkov 2016-11-16 04:34:24 UTC
Created attachment 177051 [details]
Path to add ICU.

I'm sorry. Change space char to tab. (portlint)
Comment 3 Jan Beich freebsd_committer freebsd_triage 2016-11-16 06:13:31 UTC
Comment on attachment 177051 [details]
Path to add ICU.

> +ICU_BUILD_DEPENDS=	${LOCALBASE}/bin/icu-config:devel/icu
> +ICU_LIB_DEPENDS=	libicudata.so:devel/icu

If the port depends on sqlite3 which is built against ICU then the latter is always available.

> +ICU_CPPFLAGS=	`${LOCALBASE}/bin/icu-config --cppflags`

Would only be needed if sqlite3 leaks ICU API.

> +ICU_LDFLAGS=	`${LOCALBASE}/bin/icu-config --ldflags`

It would link against ICU dynamically. Maybe pass CONFIGURE_ARGS=--disable-static instead. Static linking (or bundling) by default is discouraged, anyway.
Comment 4 Pavel Volkov 2016-11-16 07:37:57 UTC
Created attachment 177057 [details]
Dynamic linking

I agree. Dynamic linking is a good idea, if applicable to this port.
Comment 5 Pavel Volkov 2016-11-16 08:10:14 UTC
Created attachment 177058 [details]
Dynamic linking

PORTREVISION++
I'm sorry.
Comment 6 commit-hook freebsd_committer freebsd_triage 2016-12-11 17:02:27 UTC
A commit references this bug:

Author: jbeich
Date: Sun Dec 11 17:01:34 UTC 2016
New revision: 428364
URL: https://svnweb.freebsd.org/changeset/ports/428364

Log:
  sysutils/lnav: more dynamic linking

  Some libraries were still linked dynamically and it broke if
  databases/sqlite3 was built with ICU=on. To avoid missing out
  on stability and security fixes link all dependencies dynamically.

  PR:		214538
  Submitted by:	Pavel Volkov <pavelivolkov@gmail.com>
  Approved by:	maintainer timeout (3 weeks)

Changes:
  head/sysutils/lnav/Makefile