If you are not sure what the following commands do, please check the descriptions below and make sure the operations before running them.
curl -O https://raw.githubusercontent.com/google/mozc/master/docker/ubuntu24.04/Dockerfile
docker build --rm --tag mozc_ubuntu24.04 .
docker create --interactive --tty --name mozc_build mozc_ubuntu24.04
docker start mozc_build
docker exec mozc_build bazel build package --config oss_linux --config release_build
docker cp mozc_build:/home/mozc_builder/work/mozc/src/bazel-bin/unix/mozc.zip .
Docker containers are available to build Mozc binaries for Android JNI library and Linux desktop.
Currently, only Ubuntu 24.04 is tested to host the Docker container to build Mozc.
- Dockerfile for Ubuntu 24.04
curl -O https://raw.githubusercontent.com/google/mozc/master/docker/ubuntu24.04/Dockerfile
docker build --rm --tag mozc_ubuntu24.04 .
docker create --interactive --tty --name mozc_build mozc_ubuntu24.04
You may need to execute docker
with sudo
(e.g. sudo docker build ...
).
Notes
mozc_ubuntu24.04
is a Docker image name (customizable).mozc_build
is a Docker container name (customizable).- Don't forget to rebuild Docker container when Dockerfile is updated.
docker start mozc_build
docker exec mozc_build bazel build package --config oss_linux --config release_build
docker cp mozc_build:/home/mozc_builder/work/mozc/src/bazel-bin/unix/mozc.zip .
mozc.zip
contains built files.
Notes
- You might want to execute
docker stop
after build. mozc_build
is the Docker container name created in the above section.
bazel build package --config oss_linux --config release_build
Note: You might want to execute docker start --interactive mozc_build
to enter the docker container before the above command.
package
builds Mozc binaries and locates them into mozc.zip
as follows.
build rule | install path |
---|---|
//server:mozc_server | /usr/lib/mozc/mozc_server |
//gui/tool:mozc_tool | /usr/lib/mozc/mozc_tool |
//renderer:mozc_renderer | /usr/lib/mozc/mozc_renderer |
//unix/ibus/ibus_mozc | /usr/lib/ibus-mozc/ibus-engine-mozc |
//unix/ibus:gen_mozc_xml | /usr/share/ibus/component/mozc.xml |
//unix:icons | /usr/share/ibus-mozc/... |
//unix:icons | /usr/share/icons/mozc/... |
//unix/emacs:mozc.el | /usr/share/emacs/site-lisp/emacs-mozc/mozc.el |
//unix/emacs:mozc_emacs_helper | /usr/bin/mozc_emacs_helper |
Install paths are configurable by modifying src/config.bzl.
bazel test ... --config oss_linux --build_tests_only -c dbg
...
means all targets under the current and subdirectories.
bazel test base/... composer/... --config oss_linux --build_tests_only -c dbg
<dir>/...
means all targets under the<dir>/
directory.
bazel test ... --config oss_linux --build_tests_only -c dbg -- -base/...
--
means the end of the flags which start from-
.-<dir>/...
means exclusion of all targets under thedir
.
bazel test base:util_test --config oss_linux -c dbg
util_test
is defined inbase/BUILD.bazel
.
bazel test base:util_test --config oss_linux --test_arg=--stderrthreshold=0 --test_output=all
- The
--test_arg=--stderrthreshold=0 --test_output=all
flags shows the output of unitests to stderr.
Note: This section is not about our officially supported build process.
- Python: 3.7 or later
- Ibus: 1.5.4 or later
- libglib
- Qt6: 6.2.5 or later, or Qt 6.2.x with working around QTBUG-86080 by yourself
- libgl
You may also need other libraries. See the configurations of Dockerfile and GitHub Actions.
To build Mozc on other Linux environment rather than the supported Docker environment, you might need to modify the following files.
- src/config.bzl - configuration of install paths, etc.
- src/.bazelrc - compiler flags, etc.
- src/MODULE.bazel - build dependencies.
Tips: the following command makes the specified file untracked by Git.
git update-index --assume-unchanged src/config.bzl
This command reverts the above change.
git update-index --no-assume-unchanged src/config.bzl
You may have some build errors when you update build environment or configurations. In that case, try the following command to refetch external repositories.
bazel sync --configure
If the issue persists, also try the following command to clean Bazel's build cache
bazel clean --expunge
Client code for Android apk is deprecated. (the last revision with Android client code is afb03dd).
The conversion engine for Android is built with Bazel.
bazel build package --config oss_android
package
is an alias to build android/jni:native_libs
.
We have tested Android NDK r27. The former versions may not work.
Please check the previous version for more information. https://github.com/google/mozc/blob/2.29.5374.102/docs/build_mozc_in_docker.md#build-mozc-for-linux-desktop-with-gyp-maintenance-mode