Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RDY] fcitx: fix keyboard not found #29558

Merged
merged 5 commits into from
Jan 28, 2018
Merged

Conversation

teto
Copy link
Member

@teto teto commented Sep 19, 2017

Motivation for this change

NixOs defeats the fcitx discovery function responsible for finding evdev.xml & co. See https://groups.google.com/forum/#!topic/nix-devel/-_yLnqkMVj0 and
fcitx/fcitx#357
Fcitx author kindly patched his project to make the discovery more reliable.

Things done

xkeyboard_config is now a mandatory nativeBuildInput so I enabled that. There is no new release yet so I changed the version to master (I should pin it to a specific revision else the sha is going to be outdated).

I opened the PR so that people can get a fix for fcitx but right now I am puzzled because while
nix-shell -A fcitx '<nixpkgs>' followed by a genericBuild compiles just fine, when it is done via
sudo LANG=C nixos-rebuild switch then I have this error:

:71:5: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
     write(ofd, &wcount, sizeof(uint32_t));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 64%] Linking C executable comp-spell-dict
[ 64%] Built target comp-spell-dict
Scanning dependencies of target spell-en-download
CMake Error at /dev/stdin:1 (le):
  Unknown CMake command "le".

I am not sure how to debug that.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@teto teto changed the title fcitx: fix keyboard not found [WIP] fcitx: fix keyboard not found Sep 19, 2017
@teto
Copy link
Member Author

teto commented Sep 19, 2017

The message changed to sthg else after a nixos-rebuild:

[ 65%] Linking C executable comp-spell-dict
[ 65%] Built target comp-spell-dict
Scanning dependencies of target spell-en-download
CMake Error in /dev/stdin:
  Error while reading Byte-Order-Mark.  File not seekable?

@teto
Copy link
Member Author

teto commented Oct 5, 2017

the problem is that when compiling from source rather than an archive, fcitx tries to download some files which it can't when curl is not available fcitx/fcitx#367 (comment).
Adding curl to nativeBuildInputs fixes it in nix-shell. When using nix-build, curl fails to find the certificates though #13744

@GrahamcOfBorg GrahamcOfBorg added 10.rebuild-linux: 11-100 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin labels Nov 2, 2017
@teto
Copy link
Member Author

teto commented Nov 3, 2017

I have no problem compiling this in nix-shell -A + genericBuild
but once I try with nix-env it fails:

Perhaps you should add the directory containing `libpcre.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libpcre', required by 'glib-2.0', not found
Package libpcre was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpcre.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libpcre', required by 'glib-2.0', not found
-- Checking for module 'dbus-1>=1.1.0'
--   Found dbus-1, version 1.10.24
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory

the file does seem to exist at some point though

ll /tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh                                                        /tmp/nix-build-fcitx-4.2.9.4.drv-5
-rwxr-xr-x 1 nixbld1 nixbld 6236 09-27 18:42 /tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh

its path is set via set(FCITX_CMAKE_HELPER_SCRIPT "${FCITX_MACRO_CMAKE_DIR}/fcitx-cmake-helper.sh" and FCITX_MACRO_CMAKE_DIR is defined via https://cmake.org/cmake/help/v3.0/variable/CMAKE_CURRENT_LIST_FILE.html
https://cmake.org/cmake/help/v3.0/variable/CMAKE_CURRENT_LIST_FILE.html

@teto
Copy link
Member Author

teto commented Nov 3, 2017

Also I strange thing is that the error always refer to /tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh (drv-0) but the build happens in another directory note: keeping build directory ‘/tmp/nix-build-fcitx-4.2.9.4.drv-6’ so I wonder if this isn't some cmake deficiency somewhere .

|   |   waiting for children
|   |   building of ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’: read 111 bytes
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory
|   |   waiting for children
|   |   building of ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’: read 111 bytes
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory
|   |   waiting for children
|   |   building of ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’: read 26 bytes
-- Adding Fcitx Addon x11
|   |   waiting for children
|   |   building of ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’: read 111 bytes
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory
|   |   waiting for children
|   |   building of ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’: read 111 bytes
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory
|   |   waiting for children
|   |   building of ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’: read 111 bytes
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory
|   |   waiting for children
|   |   building of ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’: read 111 bytes
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory
|   |   waiting for children
|   |   building of ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’: read 111 bytes
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory
|   |   waiting for children
|   |   building of ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’: read 111 bytes
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory
|   |   waiting for children
|   |   building of ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’: read 111 bytes
env: '/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/cmake/fcitx-cmake-helper.sh': No such file or directory
|   |   waiting for children
|   |   building of ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’: read 479 bytes
CMake Error at cmake/FcitxMacro.cmake:637 (message):
  Cannot find a rule to convert
  /tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/src/module/x11/fcitx-x11.conf.in
  to
  /tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/build/src/module/x11/fcitx-x11.conf
Call Stack (most recent call first):
  cmake/FcitxMacro.cmake:474 (fcitx_translate_add_apply_source)
  cmake/FcitxMacro.cmake:368 (__fcitx_addon_config_file)
  src/module/x11/CMakeLists.txt:21 (fcitx_add_addon_full)


|   |   waiting for children
|   |   building of ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’: read 231 bytes
-- Configuring incomplete, errors occurred!
See also "/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/build/CMakeFiles/CMakeOutput.log".
See also "/tmp/nix-build-fcitx-4.2.9.4.drv-0/fcitx-4.2.9.4/build/CMakeFiles/CMakeError.log".
|   |   waiting for children
|   |   building of ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’: got EOF
|   |   building of ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’: woken up
|   |   building of ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’: build done
|   |   builder process for ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’ finished
|   |   killing all processes running under uid ‘30001’
|   |   note: keeping build directory ‘/tmp/nix-build-fcitx-4.2.9.4.drv-6’
|   |   builder for ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’ failed with exit code 1
|   |   lock released on ‘/nix/store/imb11jac62qyd72dpknfa65crz4widh1-fcitx-4.2.9.4.lock’
|   |   building of ‘/nix/store/7ja62in99ygisg4db32xas3ibmivllv9-fcitx-4.2.9.4.drv’: done

@GrahamcOfBorg GrahamcOfBorg added the 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux label Nov 6, 2017
@teto
Copy link
Member Author

teto commented Dec 25, 2017

I managed to fix the essential but I still have one problem, aka I can 't remove input methods (I can add them though). I believe this is due to this dbus problem:
** (fcitx-config-gtk3:7035): WARNING **: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.fcitx.Fcitx-0 was not provided by any .service files

There seems to be a dbus file in fcitx source that is unused in nixos:

cat src/module/dbus/org.fcitx.Fcitx.service.in
[D-BUS Service]
Name=org.fcitx.Fcitx
Exec=@bindir@/fcitx

How can I add this dbus service to the fcitx module ? hopefully it will solve the problem.

@GrahamcOfBorg GrahamcOfBorg removed the 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux label Dec 25, 2017
@teto
Copy link
Member Author

teto commented Dec 26, 2017

I didn't see that modules were packaged separately so I ended up reverting some of my previous work but there are still improvements.

My current trouble here is that cmake doesn't seem to find qt5, looking at past issues, it seems a bit complicated, any idea ?


 -- Found Fcitx: 4.2.9.5 (Required is at least version "4.2.8") 
-- Checking for module 'iso-codes'
--   Found iso-codes, version 3.74
-- Checking for module 'fcitx'
--   Found fcitx, version 4.2.9.5
-- Checking for module 'fcitx-config'
-- Found GLIB2: /nix/store/7flnldfwi608ymfzicz7mr5hijbxn0vm-glib-2.54.2/lib/libglib-2.0.so  
-- Checking for module 'libpinyin>=2.1.0'
--   Found fcitx-config, version 4.2.9.5
--   Found libpinyin, version 2.1.0
-- Checking for module 'fcitx-utils'
--   Found fcitx-utils, version 4.2.9.5
-- Detecting CXX compile features - done
-- Performing Test SUPPORT_CXX11
-- fcitx4-config found /nix/store/8hnxy5bg9mln85z18m84r4jc73nl2iiv-fcitx-4.2.9.5/bin/fcitx4-config
-- Found Libpinyin: /nix/store/4bginh43czl642dwdckkvqgg9b50zd4b-libpinyin-2.1.0/lib/libpinyin.so  
-- Found Fcitx: 4.2.9.5 (Required is at least version "4.2.8") 
-- Found D-Bus: /nix/store/qw5h6wy0bm2xid11kmmpxx2m8cz94699-dbus-1.10.24-lib/lib/libdbus-1.so
-- Adding Fcitx Addon libpinyin
XMLLINT not set and xmllint not found in path; skipping xml preprocessing.
INFO: Done
building
-- Performing Test SUPPORT_CXX11 - Success
INFO: Running: ninja -C out_linux/Release mozc_server mozc_tool fcitx-mozc
CMake Error at dictmanager/CMakeLists.txt:18 (find_package):
  By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5" (requested
  version 5.7) with any of the following names:

    Qt5Config.cmake
    qt5-config.cmake

  Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
  to a directory containing one of the above files.  If "Qt5" provides a
  separate development package or SDK, be sure it has been installed.


ninja: Entering directory `out_linux/Release'
-- Configuring incomplete, errors occurred!
See also "/tmp/nix-build-fcitx-libpinyin-0.5.3.drv-0/fcitx-libpinyin-0.5.3/build/CMakeFiles/CMakeOutput.log".
-- Found PkgConfig: /nix/store/s6a6y1inlas284np8khb5gc5qrl4w7b9-pkg-config-0.29.2/bin/pkg-config (found version "0.29.2") 
builder for ‘/nix/store/cx94yvc6icwrfr5d8yc3khwgdpg4v1bm-fcitx-libpinyin-0.5.3.drv’ failed with exit code 1

@ericsagnes

@ericsagnes
Copy link
Contributor

Thanks for the hard work on this!
Getting input methods working on NixOS is really a time consuming task...
I will try too look at this PR in the next few days.

src = fetchFromGitHub {
owner = "fcitx";
repo = "fcitx";
rev = "0ee405a59795232c08cf0cc0b1bf20454fc4cb28";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Prefer stable versions with patches when possible, else rename the package to unstable.
Also the hash seem to have changed:

these derivations will be built:
  /nix/store/imslrw5bmqb2xmjg4pxj523vn1hsradq-source.drv
  /nix/store/8kbjdvj2nxpjb5n8isp9j2bqfb3qh3q6-fcitx-4.2.9.5.drv
building path(s) ‘/nix/store/a0cvbp1vpy2yihw29v9d0bjm1q0wj316-source’

trying https://github.com/fcitx/fcitx/archive/0ee405a59795232c08cf0cc0b1bf20454fc4cb28.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   153    0   153    0     0    153      0 --:--:-- --:--:-- --:--:--   171
100 2604k  100 2604k    0     0   520k      0  0:00:05  0:00:05 --:--:--  590k
unpacking source archive /tmp/nix-build-source.drv-0/0ee405a59795232c08cf0cc0b1bf20454fc4cb28.tar.gz
output path ‘/nix/store/a0cvbp1vpy2yihw29v9d0bjm1q0wj316-source’ has r:sha256 hash ‘0rv69bacdvblka85dakz4ldpznrgwj59nqcccp5mkkn1rab4zh1r’ when ‘1j5wqj1zcihf171p3zc8g6sn4xy5jpcxg3wmiqn32cc6226n19kb’ was expected
cannot build derivation ‘/nix/store/8kbjdvj2nxpjb5n8isp9j2bqfb3qh3q6-fcitx-4.2.9.5.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/8kbjdvj2nxpjb5n8isp9j2bqfb3qh3q6-fcitx-4.2.9.5.drv’ failed

@ericsagnes
Copy link
Contributor

Regarding the fcitx-engines.libpinyin build failure, there is a new dependency on Qt 5 (fcitx-qt5).
As fcitx-qt5 build is also failing, I would advice to fix it first.

@teto
Copy link
Member Author

teto commented Dec 27, 2017 via email

@ericsagnes
Copy link
Contributor

Thanks for looking into it. I also saw the dependency, I will give it
another shot this evening. Do you think using libsForQt5 as in
https://github.com/NixOS/nixpkgs/pull/32622/files#diff-036410e9211b4336186fc613f7200b12R17049
could solve the cmake failure ?

It should solve it, but I am not sure if this is the "right" approach. Maybe @ttuegel have an advice regarding this?

@ttuegel
Copy link
Member

ttuegel commented Dec 27, 2017

Using libsForQt5.callPackage should be fine. The input method will only support one version of Qt 5, though (presently Qt 5.9.3). That is the default version for packages in Nixpkgs, so I don't think it will be a problem.

@teto
Copy link
Member Author

teto commented Dec 27, 2017

It finally compiles with a subset of the packages, I haven't tried the others. It s much more time consuming than I had anticipated :/

         inputMethod = {
           enabled = "fcitx";
           fcitx.engines = with pkgs.fcitx-engines; [
             mozc
             hangul
             m17n
             libpinyin
         ];

I might try to enable other packages before cleaning .

@ericsagnes
Copy link
Contributor

It finally compiles with a subset of the packages, I haven't tried the others.

I have tested mozc with a few toolkits / apps and everything works fine, great job!

@teto teto force-pushed the fctix_xkeyboard branch 2 times, most recently from e96d6c7 to a5e588a Compare December 29, 2017 13:50
@teto
Copy link
Member Author

teto commented Dec 29, 2017

good to know, I've rebuilt with more plugins and it seemed ok too. So I cleaned up the code and mark the PR as RDY (ready).

@teto teto changed the title [WIP] fcitx: fix keyboard not found [RDY] fcitx: fix keyboard not found Dec 29, 2017
@linc01n
Copy link
Contributor

linc01n commented Jan 8, 2018

Hi @teto
I got an error on the sha256?

I need to update the hash to this

modified   pkgs/tools/inputmethods/fcitx/unwrapped.nix
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
     owner = "fcitx";
     repo = "fcitx";
     rev = version;
-    sha256 = "1j5wqj1zcihf171p3zc8g6sn4xy5jpcxg3wmiqn32cc6226n19kb";
+    sha256 = "0rv69bacdvblka85dakz4ldpznrgwj59nqcccp5mkkn1rab4zh1r";
   };

After updating the hash it works perfectly on my machine

@teto teto force-pushed the fctix_xkeyboard branch from a5e588a to 0404955 Compare January 8, 2018 07:22
@teto
Copy link
Member Author

teto commented Jan 8, 2018

Strange that it passed the CI and my local compile. anyway seems like you were right, I rebased and fixed the hash. Thanks for testing !

@teto
Copy link
Member Author

teto commented Jan 20, 2018

@ttuegel is it possible to merge ? it seems to solve problems for linc01n and I.

@teto
Copy link
Member Author

teto commented Jan 28, 2018

Would you mind trying again ? I had not tested with nox-review and it triggered some errors I just fixed. Thanks to @adisbladis for his patch/help.

@adisbladis adisbladis merged commit 7b5d9a2 into NixOS:master Jan 28, 2018
@adisbladis
Copy link
Member

All good now :) Thanks!

@teto teto deleted the fctix_xkeyboard branch January 28, 2018 14:23
teto added 5 commits January 29, 2018 02:06
Previously optional dependencies are now made mandatory like qtwebbrowser.dev .
In order to find these libraries, I used libsForQt5.callPackage.
fcitx now relies on xkeyboard_config.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 11-100
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants