fcitx / mozc

Mozc - a Japanese Input Method Editor designed for multi-platform
Other
114 stars 11 forks source link

Does fcitx4-mozc support Bazel build? #20

Closed utuhiro78 closed 2 years ago

utuhiro78 commented 2 years ago

Hello,

Mozc developers wrote "new targets will be supported by Bazel only". I could build fcitx5-mozc with Bazel (Thanks Nocifer), but I couldn't build fcitx4-mozc. I'm using Arch Linux (gcc-11.1.0).

Did you test Bazel build for fcitx4-mozc?

mkdir mozc_tmp
cd mozc_tmp/
git clone --depth=1 --recurse-submodules --shallow-submodules https://github.com/fcitx/mozc.git
cd mozc/
sed -i -e 's/x86_64-linux-gnu\/qt5/qt/' src/config.bzl
cd src/

env PATH="/usr/lib/jvm/java-11-openjdk/bin/:$PATH" bazel build server:mozc_server gui/tool:mozc_tool unix/fcitx:fcitx-mozc.so unix/icons --config oss_linux --compilation_mode opt

Errors:

In file included from external/com_google_absl/absl/functional/function_ref.h:53,
                 from external/com_google_absl/absl/strings/cord.h:78,
                 from external/com_google_absl/absl/status/internal/status_internal.h:20,
                 from external/com_google_absl/absl/status/status.h:58,
                 from ./base/file_util.h:43,
                 from unix/fcitx/fcitx_mozc.cc:41:
external/com_google_absl/absl/functional/internal/function_ref.h:78:68: error: macro "InvokeFunction" requires 4 arguments, but only 2 given
   78 | R InvokeFunction(VoidPtr ptr, typename ForwardT<Args>::type... args) {
      |                                                                    ^
In file included from unix/fcitx/fcitx_mozc.cc:34:
/usr/include/fcitx/module.h:131: note: macro "InvokeFunction" defined here
  131 | #define InvokeFunction(INST, MODULE, FUNC, ARG)                         \
      | 
In file included from external/com_google_absl/absl/functional/function_ref.h:53,
                 from external/com_google_absl/absl/strings/cord.h:78,
                 from external/com_google_absl/absl/status/internal/status_internal.h:20,
                 from external/com_google_absl/absl/status/status.h:58,
                 from ./base/file_util.h:43,
                 from unix/fcitx/fcitx_mozc.cc:41:
external/com_google_absl/absl/functional/internal/function_ref.h:79:3: error: expected primary-expression before 'auto'
   79 |   auto f = reinterpret_cast<Fun>(ptr.fun);
      |   ^~~~
external/com_google_absl/absl/functional/internal/function_ref.h:79:3: error: expected '}' before 'auto'
external/com_google_absl/absl/functional/internal/function_ref.h:78:70: note: to match this '{'
   78 | R InvokeFunction(VoidPtr ptr, typename ForwardT<Args>::type... args) {
      |                                                                      ^
external/com_google_absl/absl/functional/internal/function_ref.h:78:71: error: expected ';' before 'auto'
   78 | R InvokeFunction(VoidPtr ptr, typename ForwardT<Args>::type... args) {
      |                                                                       ^
      |                                                                       ;
   79 |   auto f = reinterpret_cast<Fun>(ptr.fun);
      |   ~~~~                                                                 
external/com_google_absl/absl/functional/internal/function_ref.h:80:3: error: expected unqualified-id before 'return'
   80 |   return static_cast<R>(
      |   ^~~~~~
external/com_google_absl/absl/functional/internal/function_ref.h:104:1: error: expected declaration before '}' token
  104 | }  // namespace absl
      | ^
In file included from external/com_google_absl/absl/strings/cord.h:78,
                 from external/com_google_absl/absl/status/internal/status_internal.h:20,
                 from external/com_google_absl/absl/status/status.h:58,
                 from ./base/file_util.h:43,
                 from unix/fcitx/fcitx_mozc.cc:41:
external/com_google_absl/absl/functional/function_ref.h:115:7: error: 'absl::lts_20210324::functional_internal::EnableIf' has not been declared
  115 |       absl::functional_internal::EnableIf<absl::is_function<F>::value> = 0>
      |       ^~~~
external/com_google_absl/absl/functional/function_ref.h:115:42: error: expected '>' before '<' token
  115 |       absl::functional_internal::EnableIf<absl::is_function<F>::value> = 0>
      |                                          ^
external/com_google_absl/absl/functional/function_ref.h: In constructor 'absl::lts_20210324::FunctionRef<R(Args ...)>::FunctionRef(const F&)':
external/com_google_absl/absl/functional/function_ref.h:103:32: error: 'AssertNonNull' is not a member of 'absl::lts_20210324::functional_internal'; did you mean 'absl::lts_20210324::AssertNonNull'?
  103 |     absl::functional_internal::AssertNonNull(f);
      |                                ^~~~~~~~~~~~~
In file included from external/com_google_absl/absl/functional/function_ref.h:53,
                 from external/com_google_absl/absl/strings/cord.h:78,
                 from external/com_google_absl/absl/status/internal/status_internal.h:20,
                 from external/com_google_absl/absl/status/status.h:58,
                 from ./base/file_util.h:43,
                 from unix/fcitx/fcitx_mozc.cc:41:
external/com_google_absl/absl/functional/internal/function_ref.h:94:6: note: 'absl::lts_20210324::AssertNonNull' declared here
   94 | void AssertNonNull(F C::*f) {
      |      ^~~~~~~~~~~~~
utuhiro78 commented 2 years ago

I added error message. Thank you for developing Fcitx.

I found the article wirtten by Hiroyuki Komatsu (a developer of Mozc). https://zenn.dev/komatsuh/articles/d6844edd398402

The first character is not entered in Chrome This is not a Mozc issue in most cases If you are using fcitx, change it to fcitx5. It will solve the problem in many cases

He is testing fcitx and fcitx5!

utuhiro78 commented 2 years ago

I close this issue and test fcitx4-mozc another way.

wengxt commented 2 years ago

Please give it a try, it should be fixed.

utuhiro78 commented 2 years ago

Please give it a try, it should be fixed.

Thanks wengxt! It works fine.

I uploaded PKGBUILD files for fcitx4-mozc/fcitx5-mozc. https://osdn.net/users/utuhiro/pf/utuhiro/dl/fcitx-mozc-ut-bazel-20211009.PKGBUILD https://osdn.net/users/utuhiro/pf/utuhiro/dl/fcitx5-mozc-ut-bazel-20211009.PKGBUILD https://osdn.net/users/utuhiro/pf/utuhiro/files/

I don't know about Bazel, so I thought I was wrong.