google / fully-homomorphic-encryption

An FHE compiler for C++
Apache License 2.0
3.5k stars 252 forks source link

Docker build on Debian fails #66

Closed Janmajayamall closed 1 year ago

Janmajayamall commented 1 year ago

I tried running docker build -t google-fhe-transpiler -f docker/debian-bullseye.Dockerfile . on Debian 11 bullseye and it failed with following output. Looks like there's analysis of target add_one_fhe_py_lib_lut3 fails. I am unsure how to fix it. Any suggestions?

[+] Building 41.5s (11/11) FINISHED                                                                                                                                                                                            docker:default
 => [internal] load .dockerignore                                                                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                                                                          0.0s
 => [internal] load build definition from debian-bullseye.Dockerfile                                                                                                                                                                     0.0s
 => => transferring dockerfile: 1.79kB                                                                                                                                                                                                   0.0s
 => [internal] load metadata for docker.io/library/debian:bullseye-20220527                                                                                                                                                              0.3s
 => [1/7] FROM docker.io/library/debian:bullseye-20220527@sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510                                                                                                        0.0s
 => [internal] load build context                                                                                                                                                                                                        0.0s
 => => transferring context: 26.84kB                                                                                                                                                                                                     0.0s
 => CACHED [2/7] RUN apt-get update && apt-get install -y   gcc   git   libtinfo5   python   python3   python3-pip   autoconf   libreadline-dev   flex   bison   wget                                                                    0.0s
 => CACHED [3/7] RUN wget -O bazel "https://github.com/bazelbuild/bazel/releases/download/5.3.2/bazel-5.3.2-linux-x86_64"   && test "973e213b1e9207ccdd3ea4730c0f92cbef769ec112ac2b84980583220d8db845  bazel" = "$(sha256sum bazel)"     0.0s
 => CACHED [4/7] WORKDIR /usr/src/fhe/                                                                                                                                                                                                   0.0s
 => CACHED [5/7] COPY . .                                                                                                                                                                                                                0.0s
 => CACHED [6/7] RUN bazel build @llvm_toolchain//:all                                                                                                                                                                                   0.0s
 => ERROR [7/7] RUN bazel build ...                                                                                                                                                                                                     41.1s
------
 > [7/7] RUN bazel build ...:
0.188 Starting local Bazel server and connecting to it...
1.496 Loading:
1.499 Loading: 0 packages loaded
2.504 Loading: 0 packages loaded
3.505 Loading: 31 packages loaded
3.505     currently loading:
3.868 Analyzing: 1941 targets (32 packages loaded, 0 targets configured)
4.896 Analyzing: 1941 targets (75 packages loaded, 24 targets configured)
5.945 Analyzing: 1941 targets (115 packages loaded, 697 targets configured)
7.079 Analyzing: 1941 targets (121 packages loaded, 716 targets configured)
8.138 Analyzing: 1941 targets (129 packages loaded, 716 targets configured)
9.240 Analyzing: 1941 targets (146 packages loaded, 765 targets configured)
10.71 Analyzing: 1941 targets (147 packages loaded, 811 targets configured)
12.29 Analyzing: 1941 targets (150 packages loaded, 1559 targets configured)
14.04 Analyzing: 1941 targets (192 packages loaded, 6797 targets configured)
16.13 Analyzing: 1941 targets (205 packages loaded, 15175 targets configured)
18.46 Analyzing: 1941 targets (209 packages loaded, 15276 targets configured)
21.04 Analyzing: 1941 targets (241 packages loaded, 20792 targets configured)
24.81 Analyzing: 1941 targets (269 packages loaded, 24728 targets configured)
28.52 Analyzing: 1941 targets (287 packages loaded, 32093 targets configured)
32.84 Analyzing: 1941 targets (301 packages loaded, 32764 targets configured)
33.08 ERROR: /usr/src/fhe/transpiler/examples/add_one/BUILD:78:15: in _verilog_to_netlist rule //transpiler/examples/add_one:add_one_fhe_py_lib_lut3.netlist:
33.08 Traceback (most recent call last):
33.08   File "/usr/src/fhe/transpiler/fhe_yosys.bzl", line 103, column 40, in _verilog_to_netlist_impl
33.08       generated_files = _generate_netlist(ctx, name, verilog_ir_file, metadata_entry_file)
33.08   File "/usr/src/fhe/transpiler/fhe_yosys.bzl", line 259, column 20, in _generate_netlist
33.08       ctx.actions.run(
33.08 Error in run: run() got unexpected keyword argument 'toolchain'
33.08 ERROR: /usr/src/fhe/transpiler/examples/add_one/BUILD:78:15: Analysis of target '//transpiler/examples/add_one:add_one_fhe_py_lib_lut3.netlist' failed
33.29 ERROR: Analysis of target '//transpiler/examples/add_one:add_one_fhe_py_lib_lut3.srcs' failed; build aborted:
33.31 INFO: Elapsed time: 33.098s
33.31 INFO: 0 processes.
33.31 FAILED: Build did NOT complete successfully (302 packages loaded, 33606 targets configured)
33.31 FAILED: Build did NOT complete successfully (302 packages loaded, 33606 targets configured)
------
debian-bullseye.Dockerfile:54
--------------------
  52 |
  53 |     # Build all targets.
  54 | >>> RUN bazel build ...
  55 |
--------------------
ERROR: failed to solve: process "/bin/sh -c bazel build ..." did not complete successfully: exit code: 1
asraa commented 1 year ago

Hey! Thank you so much for the report. It looks like the dockerfile is installing Bazel version 5.3.2, while the .bazelversion file requires 5.4.1. It turns out that the changelog for 5.4.1 describes adding in the toolchain argument to ctx.actions.run (https://github.com/bazelbuild/bazel/blob/master/CHANGELOG.md#release-541-2023-04-19), so I'll go ahead and update the Dockerfile. That should fix the issue.

Once again, thank you!

Janmajayamall commented 1 year ago

Hey @asraa ! Thanks for the quick fix. I can confirm the PR fixes it!