google / fully-homomorphic-encryption

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

Transpiler fails to build under Ubuntu 22.04 #31

Closed davidbrucecousins closed 1 year ago

davidbrucecousins commented 1 year ago

I have been running the transpiler successfully under Ubuntu but after upgrading to 22.04, there is an issue when Bazel tries to build the llvm toolsuite, failing with the message:

Error in fail: Unknown LLVM release: clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
Please ensure file name is correct.

Even deleting everything and reloading the repo does not fix this.

I did find a workaround, based on what I read in this issue report . The workaround is to edit /etc/os-release , changing 22 to 20 everywhere. After that Bazel will build properly with no further issues. Apparently there is not an appropriate release in the llvm repo for 22.04 yet?

However, one needs su privileges to do this, so some users will not be able (or may not want to) implement this workaround.

j2kun commented 1 year ago

Acknowledged. I'm going to get the existing Debian docker image working again and then modify it for Ubuntu 22.04.

As a preview, I'm modifying the Dockerfile to install LLVM inside the image via apt, and then trying to ensure the LLVM version 13 aligns with the installed version, so that one is not required to rebuild LLVM from scratch.

RUN wget -O llvm.sh https://apt.llvm.org/llvm.sh \
  && chmod +x llvm.sh \
  # It's critical that this version matches the version specified in
  # llvm_toolchain in the WORKSPACE file.
  && ./llvm.sh 13

LLVM has an Ubuntu 22.04 package, but the WORKSPACE file is currently pinning to LLVM 10, and the 22.04 versions start at 11, while 10 is only supported for 18.04 and 20.04. Because we rely on XLS for the hardware synthesis toolchain XLS, and they use LLVM 13, I'm going to try to make it all work with LLVM 13.

j2kun commented 1 year ago

In other words, you may be able to fix this quickly by changing the llvm_toolchain version in WORKSPACE to match the LLVM installed on your machine, and use the command above to install the version of your choice.

j2kun commented 1 year ago

A patch has been submitted to add an Ubuntu jammy dockerfile. Probably won't get reviewed internally until next week as folks are out of office. In the mean time, https://github.com/google/fully-homomorphic-encryption/commit/23491cc2cc8196baedd1ad1dc0b3d8d6c84f7cc9 should resolve your installation issues by switching the project to use LLVM 13, which has a package on jammy.

j2kun commented 1 year ago

To install LLVM manually on your machine, you can run

wget -O llvm.sh https://apt.llvm.org/llvm.sh \
  && chmod +x llvm.sh \
  # It's critical that this version matches the version specified in
  # llvm_toolchain in the WORKSPACE file.
  && ./llvm.sh 13