Bug 214551

Summary: sysutils/cbsd: fails to build if databases/sqlite3 was built with ICU=on
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: Roman Bogorodskiy <novel>
Status: Closed FIXED    
Severity: Affects Only Me CC: novel, olevole, pavelivolkov, subbsd, w.schwarzenfeld
Priority: --- Keywords: needs-patch
Version: LatestFlags: jbeich: maintainer-feedback? (olevole)
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214538
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214552
Attachments:
Description Flags
Dynamic linking
none
patch for static linking with dependencies from ICU none

Description Jan Beich freebsd_committer freebsd_triage 2016-11-15 22:27:50 UTC
cc misc/src/sqlcli.c -static -pthread -lsqlite3 -L/usr/local/lib -I/usr/local/include -o misc/sqlcli && "/usr/bin/strip" misc/sqlcli
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuRegexpFunc':
(.text+0x1a0c5): undefined reference to `uregex_open'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuRegexpFunc':
(.text+0x1a112): undefined reference to `uregex_setText'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuRegexpFunc':
(.text+0x1a137): undefined reference to `uregex_matches'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuRegexpFunc':
(.text+0x1a174): undefined reference to `uregex_setText'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuCaseFunc16':
(.text+0x1a272): undefined reference to `u_strToUpper'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuCaseFunc16':
(.text+0x1a299): undefined reference to `u_strToLower'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuLikeFunc':
(.text+0x1a498): undefined reference to `utf8_nextCharSafeBody'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuLoadCollation':
(.text+0x1a572): undefined reference to `ucol_open'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuLoadCollation':
(.text+0x1a5c1): undefined reference to `ucol_close'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuFunctionError':
(.text+0x1a61d): undefined reference to `u_errorName'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuCollationColl':
(.text+0x1a6cd): undefined reference to `ucol_strcoll'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuCollationDel':
(.text+0x1a6e8): undefined reference to `ucol_close'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuLikeCompare':
(.text+0x1a7c5): undefined reference to `u_foldCase'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuLikeCompare':
(.text+0x1a7d8): undefined reference to `u_foldCase'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuRegexpDelete':
(.text+0x1a873): undefined reference to `uregex_close'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuOpen':
(.text+0x30f03): undefined reference to `utf8_nextCharSafeBody'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuOpen':
(.text+0x30f22): undefined reference to `u_foldCase'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuOpen':
(.text+0x31058): undefined reference to `utf8_nextCharSafeBody'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuOpen':
(.text+0x3108e): undefined reference to `ubrk_open'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuOpen':
(.text+0x310b1): undefined reference to `ubrk_first'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuClose':
(.text+0x310d3): undefined reference to `ubrk_close'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuNext':
(.text+0x3110c): undefined reference to `ubrk_current'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuNext':
(.text+0x31119): undefined reference to `ubrk_next'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuNext':
(.text+0x31179): undefined reference to `u_isspace'
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `icuNext':
(.text+0x311f2): undefined reference to `u_strToUTF8'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

http://package23.nyi.freebsd.org/data/103i386-default-PR214384/2016-11-14_20h14m36s/logs/errors/cbsd-11.0.4_1.log
Comment 1 Jan Beich freebsd_committer freebsd_triage 2016-11-16 06:38:11 UTC
One way to fix is via

  `pkg-config sqlite3 --libs --static`

as long as sqlite3.pc specifies dependencies

  Requires.private: icu-i18n

which it doesn't currently. Otherwise, the build can fail early similar to devel/subversion-static.
Comment 2 subbsd 2016-11-16 08:58:28 UTC
Ok, got it. I need a time for investigation now
Comment 3 Pavel Volkov 2016-11-16 12:46:29 UTC
(In reply to Jan Beich (mail not working) from comment #1)
Good point.
Fixed, see: (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214569)
Comment 4 Pavel Volkov 2016-11-16 13:11:35 UTC
Created attachment 177075 [details]
Dynamic linking

Maybe build sqlcli dynamically?
(sysutils/cbsd/files/patch-Makefile)
Comment 5 Walter Schwarzenfeld freebsd_triage 2018-01-12 12:26:35 UTC
Any advance here. Problem exists still.
Comment 6 Oleg Ginzburg 2018-01-12 12:37:53 UTC
(In reply to Pavel Volkov from comment #4)

Unfortunately, this is a bad idea for me - in this place a static key is used for stability reasons - if the sqlite3 is upgraded unsuccessfully, it can break the management of virtual environments. 

I tried to find solutions to fix this problem, but it's still unfortunate.

The only option is not to use the ICU option upon databases/sqlite3 build.

As far as I can see, devel/subversion is also affected to this problem
Comment 7 Walter Schwarzenfeld freebsd_triage 2018-01-12 12:40:41 UTC
Only a warning like  "sqlite3 have to compiled without ICU option" for sysutils/cbsd for the moment?
Comment 8 Oleg Ginzburg 2018-01-12 13:36:21 UTC
(In reply to w.schwarzenfeld from comment #7)

Yes, most likely I will do the same as devel/subversion:

--
.if ${PORT_OPTIONS:MSTATIC}
        @if ${GREP} -q ucol_close ${LOCALBASE}/lib/libsqlite3.a ; then \
                ${ECHO_MSG} "" ; \
                ${ECHO_MSG} "You can not build static subversion if your SQLite3 is built with ICU enabled."; \
                ${ECHO_MSG} "Please, reinstall 'devel/sqlite3' port with disabled ICU support."; \
                ${ECHO_MSG} "" ; \
                ${FALSE} ; \
        fi
.endif
--


On the other hand, I think it would be a good compromise to add an dialog option for CBSD port ( or FLAVOR ):

[x] Static

(by default). But those users who have an ICU can choose dynamic linking
Comment 9 Pavel Volkov 2018-01-13 11:30:38 UTC
Created attachment 189682 [details]
patch for static linking with dependencies from ICU

Hello.
Or you may used command pkg-config for check libraries required for libsqlite3.a.
When compiling sqlite with ICU support, the correct sqlite3.pc file is also created.
You must use the command
`pkg-config sqlite3 --libs --static`
to get dependent libraries.
This patch do it.
Thanks.
Comment 10 Oleg Ginzburg 2018-01-19 13:50:40 UTC
(In reply to Pavel Volkov from comment #9)

This patch works fine for me. I added it to the next CBSD release. Thanks for the help!
Comment 11 commit-hook freebsd_committer freebsd_triage 2018-01-19 16:33:27 UTC
A commit references this bug:

Author: novel
Date: Fri Jan 19 16:32:25 UTC 2018
New revision: 459436
URL: https://svnweb.freebsd.org/changeset/ports/459436

Log:
  sysutils/cbsd: update to 11.1.12

   - Update to 11.1.12 [1];
   - Add 'pkgconfig' to USES as it's now uses it to check sqlite libs. This
     release also fixes build when databases/sqlite3 was built with ICU=on [2].

  PR:		225319 [1], 214551 [2]
  Submitted by:	maintainer [1], Pavel Volkov [2]
  Reported by:	jbeich [2]

Changes:
  head/sysutils/cbsd/Makefile
  head/sysutils/cbsd/distinfo
Comment 12 Roman Bogorodskiy freebsd_committer freebsd_triage 2018-01-19 16:37:05 UTC
This bug should be fixed now as sysutils/cbsd was updated to 11.1.12. Please let me know if you still have problems with that.
Comment 13 Oleg Ginzburg 2018-01-19 18:06:23 UTC
I think this PR can be closed. If the problem persists, than reopen.
Thanks!
Comment 14 Walter Schwarzenfeld freebsd_triage 2018-01-19 18:22:45 UTC
Thanks, builds without problems. So I close here.