Bug 199112 - chinese/fcitx: Error while trying to update to 4.2.8.6
Summary: chinese/fcitx: Error while trying to update to 4.2.8.6
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Xin LI
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-02 11:37 UTC by Justin Yang
Modified: 2015-04-03 20:57 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (lichray)


Attachments
proposed patch (421 bytes, patch)
2015-04-02 22:03 UTC, lichray
no flags Details | Diff
proposed patch (602 bytes, patch)
2015-04-02 22:05 UTC, lichray
no flags Details | Diff
new patch (1.25 KB, patch)
2015-04-03 02:54 UTC, lichray
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Yang 2015-04-02 11:37:45 UTC
I try to update the chinese/fcitx port to the latest version, say, 4.2.8.6 from 4.2.6.1_5 with the help of portmaster. However, it failed to update with the following errors:

...skip...
Linking C executable readPYMB
[ 39%] Built target readPYMB
[ 40%] Building CXX object src/lib/fcitx-qt/CMakeFiles/fcitx-qt.dir/fcitx-qt_automoc.cpp.o
Scanning dependencies of target txt2mb
[ 41%] Building C object tools/cli/CMakeFiles/txt2mb.dir/txt2mb.c.o
Linking C executable txt2mb
[ 41%] Built target txt2mb
Scanning dependencies of target gobject_introspection_compile_target_1
[ 41%] Generating Fcitx-1.0.gir
Linking CXX shared library libfcitx-qt.so
[ 41%] Built target fcitx-qt
fcitxinputmethod.c:160: Warning: Fcitx: GObject-Introspection specific GTK-Doc tag "Rename to" has been deprecated, please use annotations on the identifier instead:
 * Rename to: fcitx_input_method_get_imlist
   ^
fcitxkbd.c:147: Warning: Fcitx: GObject-Introspection specific GTK-Doc tag "Rename to" has been deprecated, please use annotations on the identifier instead:
 * Rename to: fcitx_kbd_get_layouts
   ^
Scanning dependencies of target testgclient
[ 41%] Building C object src/lib/fcitx-gclient/test/CMakeFiles/testgclient.dir/testgclient.c.o
Linking C executable testgclient
[ 41%] Built target testgclient
/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src/lib/fcitx-gclient/tmp-introspectSttSyo/Fcitx-1.0.o:(.data+0x20): undefined reference to `fcitx_layout_item_get_type'
/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src/lib/fcitx-gclient/tmp-introspectSttSyo/Fcitx-1.0.o:(.data+0x28): undefined reference to `fcitx_connection_get_type'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
linking of temporary binary failed: Command '['cc', '-o', '/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src/lib/fcitx-gclient/tmp-introspectSttSyo/Fcitx-1.0', '-DLIBICONV_PLUG', '-O2', '-pipe', '-DLIBICONV_PLUG', '-fstack-protector', '-fno-strict-aliasing', '-L/usr/local/lib', '-fstack-protector', '/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src/lib/fcitx-gclient/tmp-introspectSttSyo/Fcitx-1.0.o', '-L.', '-Wl,-rpath=.', '-Wl,--no-as-needed', '-lfcitx-gclient', '-L/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src/lib/fcitx-gclient', '-Wl,-rpath=/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src/lib/fcitx-gclient', '-lgio-2.0', '-lgobject-2.0', '-Wl,--export-dynamic', '-lgmodule-2.0', '-pthread', '-L/usr/local/lib', '-lglib-2.0', '-lintl']' returned non-zero exit status 1
--- src/lib/fcitx-gclient/Fcitx-1.0.gir ---
*** [src/lib/fcitx-gclient/Fcitx-1.0.gir] Error code 1

make[5]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
1 error

make[5]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
--- src/lib/fcitx-gclient/CMakeFiles/gobject_introspection_compile_target_1.dir/all ---
*** [src/lib/fcitx-gclient/CMakeFiles/gobject_introspection_compile_target_1.dir/all] Error code 2

make[4]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
Scanning dependencies of target im-fcitx
A failure has been detected in another branch of the parallel make

make[5]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
--- src/frontend/gtk2/CMakeFiles/im-fcitx.dir/all ---
*** [src/frontend/gtk2/CMakeFiles/im-fcitx.dir/all] Error code 2

make[4]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
2 errors

make[4]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
*** [all] Error code 2

make[3]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
1 error

make[3]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/chinese/fcitx
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/chinese/fcitx
*** Error code 1

Stop.
make: stopped in /usr/ports/chinese/fcitx

Not sure how to deal with it. Thanks.
Comment 1 lichray 2015-04-02 15:48:39 UTC
(In reply to Justin Yang from comment #0)

uname -a, ld --version, cc --version, pkg which /usr/local/bin/g-ir-scanner
Comment 2 Justin Yang 2015-04-02 16:15:27 UTC
(In reply to lichray from comment #1)
> uname -a
FreeBSD darkgeek 10.1-RELEASE FreeBSD 10.1-RELEASE #0: Sun Nov 16 19:23:55 CST 2014     root@darkgeek:/usr/obj/usr/src/sys/GENERIC  amd64

> ld --version
GNU ld 2.17.50 [FreeBSD] 2007-07-03
Copyright 2007 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.

> cc --version
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: x86_64-unknown-freebsd10.1
Thread model: posix

> pkg which /usr/local/bin/g-ir-scanner
/usr/local/bin/g-ir-scanner was installed by package gobject-introspection-1.42.0
Comment 3 lichray 2015-04-02 19:09:35 UTC
The following command,

cd /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src/lib/fcitx-gclient && env LD_LIBRARY_PATH=/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src/lib/fcitx-gclient /usr/local/bin/g-ir-scanner --warn-all --add-include-path=/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src/lib/fcitx-gclient --namespace=Fcitx --nsversion=1.0 -I/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6 -I/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src -I/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src -I/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src/lib -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/include -I/usr/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include -I/usr/local/include/dbus-1.0 -I/usr/local/include/dbus-1.0/include -I/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src/lib/fcitx-gclient --library=fcitx-gclient --quiet --symbol-prefix=fcitx --include=Gio-2.0 --include=GObject-2.0 --include=GLib-2.0 --no-libtool -L/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src/lib/fcitx-gclient --output=/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src/lib/fcitx-gclient/Fcitx-1.0.gir fcitx-gclient fcitxclient.c fcitxinputmethod.c fcitxkbd.c fcitxconnection.c fcitxclient.h fcitxinputmethod.h fcitxkbd.h fcitxconnection.h

Does not work in staging environment, but works outside staging, also works by invoking `make` in the source directory as long as the `make` is not invoke by ports.  I don't know why.
Comment 4 lichray 2015-04-02 20:35:08 UTC
(In reply to Justin Yang from comment #2)

Lock down the cause: g-ir-scanner is trying to link to the old version of libfcitx-gclient installed on your system.

Workaround: uninstall old version before compiling the new version.

Keep looking at how to fix it.
Comment 5 lichray 2015-04-02 22:03:02 UTC
Created attachment 155133 [details]
proposed patch

fcitx's cmake script currently always finds iconv(3) in ports, and it indeed needs wchar_t conversion.  It links to ports iconv without the LDFLAGS hack.

Drop the LDFLAGS hack to prevent g-ir-scanner to link to old fcitx libraries installed on the build system.nm
Comment 6 lichray 2015-04-02 22:05:10 UTC
Created attachment 155134 [details]
proposed patch

fcitx's cmake script currently always finds iconv(3) in ports, and it indeed needs wchar_t conversion.  It links to ports iconv without the LDFLAGS hack.

Drop the LDFLAGS hack to prevent g-ir-scanner to link to old fcitx libraries installed on the build system.
Comment 7 Justin Yang 2015-04-03 01:15:38 UTC
(In reply to lichray from comment #6)
Hi,
I applied your patch (attachment 155134 [details]) to Makefile and tried to update the port using portmaster, however, it failed with the following messages:

...Skip...
[  5%] Built target fcitx-addon-fcitx-keyboard--addon--desc-1
CMakeFiles/fcitx-utils.dir/log.c.o: In function `FcitxLogFuncV':
/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src/lib/fcitx-utils/log.c:(.text+0x191): undefined reference to `libiconv_open'
/usr/ports/chinese/fcitx/work/fcitx-4.2.8.6/src/lib/fcitx-utils/log.c:(.text+0x1ef): undefined reference to `libiconv'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
--- src/lib/fcitx-utils/libfcitx-utils.so.0.1 ---
*** [src/lib/fcitx-utils/libfcitx-utils.so.0.1] Error code 1

make[5]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
1 error

make[5]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
--- src/lib/fcitx-utils/CMakeFiles/fcitx-utils.dir/all ---
*** [src/lib/fcitx-utils/CMakeFiles/fcitx-utils.dir/all] Error code 2

make[4]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
Scanning dependencies of target fcitx-addon-fcitx-table--headers-1
A failure has been detected in another branch of the parallel make

make[5]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
--- src/im/table/CMakeFiles/fcitx-addon-fcitx-table--headers-1.dir/all ---
*** [src/im/table/CMakeFiles/fcitx-addon-fcitx-table--headers-1.dir/all] Error code 2

make[4]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
Scanning dependencies of target fcitx-addon-fcitx-table--addon--desc-1
A failure has been detected in another branch of the parallel make

make[5]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
--- src/im/table/CMakeFiles/fcitx-addon-fcitx-table--addon--desc-1.dir/all ---
*** [src/im/table/CMakeFiles/fcitx-addon-fcitx-table--addon--desc-1.dir/all] Error code 2

make[4]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
A failure has been detected in another branch of the parallel make

make[5]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
  - src/im/pinyin/data/CMakeFiles/py-data-download.dir/all ---
*** [src/im/pinyin/data/CMakeFiles/py-data-download.dir/all] Error code 2

make[4]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
4 errors

make[4]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
*** [all] Error code 2

make[3]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6
1 error

make[3]: stopped in /usr/ports/chinese/fcitx/work/fcitx-4.2.8.6

I will uninstall the port before updating later, to see whether it'll be OK to compile the latest version.
Comment 8 Justin Yang 2015-04-03 01:24:19 UTC
(In reply to lichray from comment #4)
Hi,
I can confirm it builds and installs chinese/fcitx 4.2.8.6 successfully after my uninstalling the port and rebuilding it again. Thanks.
Comment 9 lichray 2015-04-03 01:32:31 UTC
(In reply to Justin Yang from comment #7)

After the port stops building, can you send me your `work/fcitx-4.2.8.6/CMakeCache.txt'?  You can paste it in pastebin, or gist.  Thanks.
Comment 10 Justin Yang 2015-04-03 01:47:16 UTC
(In reply to lichray from comment #9)
Hi,
I paste the CMakeCache.txt file to gist (https://gist.github.com/darkgeek/cf6926a04a763cbd9e8d) and hope it'll be useful. Don't hesitate to let me know if you need more information. Thanks.

P.S.: As my comment #8 points out, I have updated to 4.2.8.6 successfully, so this CMakeCache.txt is generated in a system where chinese/fcitx is the latest and Makefile is patched.
Comment 11 lichray 2015-04-03 02:54:43 UTC
Created attachment 155145 [details]
new patch

FreeBSD >= 10 has a real `iconv_open` symbol in libc (9 doesn't), and that is why fcitx's cmake script can find it.

Hack the script to let it not to use base iconv(3), so that it knows how to link to ports libiconv.
Comment 12 lichray 2015-04-03 02:58:17 UTC
(In reply to Justin Yang from comment #10)

This time I also reproduced the iconv issue caused by my old patch, and I created a new patch.

You can try uninstall the new fcitx and use `pkg install zh-fcitx` to go back to the new one then recompile the patched, latest fcitx... Well, that's how I reproduced and tested it.
Comment 13 Justin Yang 2015-04-03 03:26:14 UTC
(In reply to lichray from comment #12)
Nice. I uninstalled chinese/fcitx (new) and installed the 4.2.6.1_5 version (old) via pkg, then applied your new patches, it updated the port successfully to the new one. Thanks.
Comment 14 Xin LI freebsd_committer freebsd_triage 2015-04-03 20:57:13 UTC
Committed, thanks!
Comment 15 commit-hook freebsd_committer freebsd_triage 2015-04-03 20:57:49 UTC
A commit references this bug:

Author: delphij
Date: Fri Apr  3 20:56:53 UTC 2015
New revision: 383178
URL: https://svnweb.freebsd.org/changeset/ports/383178

Log:
  Fix build when building in an environment with old version of fcitx
  present.

  PR:		ports/199112
  Submitted by:	maintainer

Changes:
  head/chinese/fcitx/Makefile
  head/chinese/fcitx/files/patch-cmake__FindLibiconv.cmake