TFHE-rs compiling error

Hello!

I’m trying to run a code in TFHE-rs with GPU Acceleration, but the compilation raises an error:

Build tfhe-cuda-backend
cargo::rerun-if-changed=cuda/include
cargo::rerun-if-changed=cuda/src
cargo::rerun-if-changed=cuda/tests_and_benchmarks
cargo::rerun-if-changed=cuda/CMakeLists.txt
cargo::rerun-if-changed=src
CMAKE_TOOLCHAIN_FILE_x86_64-unknown-linux-gnu = None
CMAKE_TOOLCHAIN_FILE_x86_64_unknown_linux_gnu = None
HOST_CMAKE_TOOLCHAIN_FILE = None
CMAKE_TOOLCHAIN_FILE = None
CMAKE_GENERATOR_x86_64-unknown-linux-gnu = None
CMAKE_GENERATOR_x86_64_unknown_linux_gnu = None
HOST_CMAKE_GENERATOR = None
CMAKE_GENERATOR = None
CMAKE_PREFIX_PATH_x86_64-unknown-linux-gnu = None
CMAKE_PREFIX_PATH_x86_64_unknown_linux_gnu = None
HOST_CMAKE_PREFIX_PATH = None
CMAKE_PREFIX_PATH = None
CMAKE_x86_64-unknown-linux-gnu = None
CMAKE_x86_64_unknown_linux_gnu = None
HOST_CMAKE = None
CMAKE = None
running: cd “/home/rkruger/github.com/rodkruger/ppml-rust/target/release/build/tfhe-cuda-backend-84fa06932536527c/out/build” && CMAKE_PREFIX_PATH=“” LC_ALL=“C” “cmake” “/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda” “-DCMAKE_INSTALL_PREFIX=/home/rkruger/github.com/rodkruger/ppml-rust/target/release/build/tfhe-cuda-backend-84fa06932536527c/out” “-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64” “-DCMAKE_C_COMPILER=/usr/bin/cc” “-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64” “-DCMAKE_CXX_COMPILER=/usr/bin/c++” “-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64” “-DCMAKE_ASM_COMPILER=/usr/bin/cc” “-DCMAKE_BUILD_TYPE=Release”
– The CXX compiler identification is GNU 14.2.0
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: /usr/bin/c++ - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Looking for a CUDA compiler
– Looking for a CUDA compiler - /usr/local/cuda/bin/nvcc
– The CUDA compiler identification is NVIDIA 12.8.93
– Detecting CUDA compiler ABI info
– Detecting CUDA compiler ABI info - done
– Check for working CUDA compiler: /usr/local/cuda/bin/nvcc - skipped
– Detecting CUDA compile features
– Detecting CUDA compile features - done
– CUDA Architecture: -arch=sm_61
– CUDA Version:
– CUDA Path:
– CUDA Libraries:
– CUDA Performance Primitives:
– Found OpenMP_CXX: -fopenmp (found version “4.5”)
– Found OpenMP: TRUE (found version “4.5”)
– Configuring done (5.7s)
– Generating done (0.0s)
– Build files have been written to: /home/rkruger/github.com/rodkruger/ppml-rust/target/release/build/tfhe-cuda-backend-84fa06932536527c/out/build
running: cd “/home/rkruger/github.com/rodkruger/ppml-rust/target/release/build/tfhe-cuda-backend-84fa06932536527c/out/build” && LC_ALL=“C” MAKEFLAGS=“-j --jobserver-fds=8,9 --jobserver-auth=8,9” “cmake” “–build” “/home/rkruger/github.com/rodkruger/ppml-rust/target/release/build/tfhe-cuda-backend-84fa06932536527c/out/build” “–target” “install” “–config” “Release”
[ 3%] Building CUDA object src/CMakeFiles/tfhe_cuda_backend.dir/crypto/ciphertext.cu.o
[ 6%] Building CUDA object src/CMakeFiles/tfhe_cuda_backend.dir/device.cu.o
[ 9%] Building CUDA object src/CMakeFiles/tfhe_cuda_backend.dir/integer/cmux.cu.o
[ 12%] Building CUDA object src/CMakeFiles/tfhe_cuda_backend.dir/integer/comparison.cu.o
[ 21%] Building CUDA object src/CMakeFiles/tfhe_cuda_backend.dir/integer/compression/compression.cu.o
[ 21%] Building CUDA object src/CMakeFiles/tfhe_cuda_backend.dir/integer/bitwise_ops.cu.o
[ 21%] Building CUDA object src/CMakeFiles/tfhe_cuda_backend.dir/integer/abs.cu.o
[ 28%] Building CUDA object src/CMakeFiles/tfhe_cuda_backend.dir/crypto/keyswitch.cu.o
[ 28%] Building CUDA object src/CMakeFiles/tfhe_cuda_backend.dir/integer/div_rem.cu.o
[ 31%] Building CUDA object src/CMakeFiles/tfhe_cuda_backend.dir/fft/twiddles.cu.o
[ 34%] Building CUDA object src/CMakeFiles/tfhe_cuda_backend.dir/integer/integer.cu.o
[ 37%] Building CUDA object src/CMakeFiles/tfhe_cuda_backend.dir/integer/multiplication.cu.o
[ 40%] Building CUDA object src/CMakeFiles/tfhe_cuda_backend.dir/integer/negation.cu.o
[ 43%] Building CUDA object src/CMakeFiles/tfhe_cuda_backend.dir/integer/radix_ciphertext.cu.o
[ 46%] Building CUDA object src/CMakeFiles/tfhe_cuda_backend.dir/integer/scalar_addition.cu.o

— stderr
nvcc warning : Support for offline compilation for architectures prior to ‘<compute/sm/lto>_75’ will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
Compiling in Release mode
CMake Warning:
Manually-specified variables were not used by the project:

  CMAKE_ASM_COMPILER
  CMAKE_ASM_FLAGS
  CMAKE_C_COMPILER
  CMAKE_C_FLAGS

nvcc warning : Support for offline compilation for architectures prior to ‘<compute/sm/lto>_75’ will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : Support for offline compilation for architectures prior to ‘<compute/sm/lto>_75’ will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : Support for offline compilation for architectures prior to ‘<compute/sm/lto>_75’ will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : Support for offline compilation for architectures prior to ‘<compute/sm/lto>_75’ will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : Support for offline compilation for architectures prior to ‘<compute/sm/lto>_75’ will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : Support for offline compilation for architectures prior to ‘<compute/sm/lto>_75’ will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : Support for offline compilation for architectures prior to ‘<compute/sm/lto>_75’ will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : Support for offline compilation for architectures prior to ‘<compute/sm/lto>_75’ will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : Support for offline compilation for architectures prior to ‘<compute/sm/lto>_75’ will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : Support for offline compilation for architectures prior to ‘<compute/sm/lto>_75’ will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : Support for offline compilation for architectures prior to ‘<compute/sm/lto>_75’ will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : Support for offline compilation for architectures prior to ‘<compute/sm/lto>_75’ will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : Support for offline compilation for architectures prior to ‘<compute/sm/lto>_75’ will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : Support for offline compilation for architectures prior to ‘<compute/sm/lto>_75’ will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : Support for offline compilation for architectures prior to ‘<compute/sm/lto>_75’ will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/./integer/integer.cuh(1179): error: namespace “std” has no member “rotate”
std::rotate(buffer, buffer + mid, buffer + array_length);
^

/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/./integer/integer.cuh(1179): error: namespace “std” has no member “rotate”
std::rotate(buffer, buffer + mid, buffer + array_length);
^

/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/./integer/integer.cuh(1179): error: namespace “std” has no member “rotate”
std::rotate(buffer, buffer + mid, buffer + array_length);
^

/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/./integer/integer.cuh(1179): error: namespace “std” has no member “rotate”
std::rotate(buffer, buffer + mid, buffer + array_length);
^

1 error detected in the compilation of “/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/integer/bitwise_ops.cu”.
1 error detected in the compilation of “/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/integer/cmux.cu”.
/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/./integer/integer.cuh(1179): error: namespace “std” has no member “rotate”
std::rotate(buffer, buffer + mid, buffer + array_length);
^

/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/./integer/integer.cuh(1179): error: namespace “std” has no member “rotate”
std::rotate(buffer, buffer + mid, buffer + array_length);
^

1 error detected in the compilation of “/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/integer/integer.cu”.
gmake[2]: *** [src/CMakeFiles/tfhe_cuda_backend.dir/build.make:152: src/CMakeFiles/tfhe_cuda_backend.dir/integer/bitwise_ops.cu.o] Error 2
gmake[2]: *** Waiting for unfinished jobs…
gmake[2]: *** [src/CMakeFiles/tfhe_cuda_backend.dir/build.make:167: src/CMakeFiles/tfhe_cuda_backend.dir/integer/cmux.cu.o] Error 2
1 error detected in the compilation of “/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/integer/comparison.cu”.
gmake[2]: *** [src/CMakeFiles/tfhe_cuda_backend.dir/build.make:227: src/CMakeFiles/tfhe_cuda_backend.dir/integer/integer.cu.o] Error 2
1 error detected in the compilation of “/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/integer/compression/compression.cu”.
gmake[2]: *** [src/CMakeFiles/tfhe_cuda_backend.dir/build.make:182: src/CMakeFiles/tfhe_cuda_backend.dir/integer/comparison.cu.o] Error 2
/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/./integer/integer.cuh(1179): error: namespace “std” has no member “rotate”
std::rotate(buffer, buffer + mid, buffer + array_length);
^

gmake[2]: *** [src/CMakeFiles/tfhe_cuda_backend.dir/build.make:197: src/CMakeFiles/tfhe_cuda_backend.dir/integer/compression/compression.cu.o] Error 2
1 error detected in the compilation of “/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/integer/div_rem.cu”.
gmake[2]: *** [src/CMakeFiles/tfhe_cuda_backend.dir/build.make:212: src/CMakeFiles/tfhe_cuda_backend.dir/integer/div_rem.cu.o] Error 2
1 error detected in the compilation of “/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/integer/abs.cu”.
gmake[2]: *** [src/CMakeFiles/tfhe_cuda_backend.dir/build.make:137: src/CMakeFiles/tfhe_cuda_backend.dir/integer/abs.cu.o] Error 2
/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/./integer/integer.cuh(1179): error: namespace “std” has no member “rotate”
std::rotate(buffer, buffer + mid, buffer + array_length);
^

/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/./integer/integer.cuh(1179): error: namespace “std” has no member “rotate”
std::rotate(buffer, buffer + mid, buffer + array_length);
^

1 error detected in the compilation of “/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/integer/multiplication.cu”.
gmake[2]: *** [src/CMakeFiles/tfhe_cuda_backend.dir/build.make:242: src/CMakeFiles/tfhe_cuda_backend.dir/integer/multiplication.cu.o] Error 2
1 error detected in the compilation of “/home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tfhe-cuda-backend-0.8.1/cuda/src/integer/negation.cu”.
gmake[2]: *** [src/CMakeFiles/tfhe_cuda_backend.dir/build.make:257: src/CMakeFiles/tfhe_cuda_backend.dir/integer/negation.cu.o] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:116: src/CMakeFiles/tfhe_cuda_backend.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

thread ‘main’ panicked at /home/rkruger/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cmake-0.1.54/src/lib.rs:1119:5:

I’m using a NVIDIA GTX 1050ti, and my Cargo.toml is below:
[package]
name = “ppml-rust”
version = “0.1.0”
edition = “2024”

[dependencies]
tfhe = { version = “~1.0.1”, features = [“boolean”, “shortint”, “integer”, “gpu”] }

Any help?

Hey @Rodrigo_Kruger!

Does compilation work for you with prior versions, for example version 1.0.0?

Could you send me also the following information:

  • what is your operating system?
  • what is your gcc version?
  • what is your nvcc version?
  • what is your nvidia driver version?

Cheers,
Agnès

Hi Agnes!

Even in 0.6.4 version (present in the documentation) for TFHE-rs I wasn’t able to compile.

I could compile the code in another computer with an RTX 2080ti GPU. The GPU model impacts the compilation?

It seems like your gcc version might be too recent: you’re using gcc 14.2.0 with nvcc 12.8.93. you could try using an older version of gcc (for example gcc 11 or even gcc 10). You can do that by using update alternative for example:

sudo apt install gcc-11 g++-11
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 110
sudo update-alternatives --config gcc
sudo update-alternatives --config g++

and select gcc & g++ 11 at the last step. You can verify your gcc version is the desired one with:

gcc --version

It worked!

Thanks Agnes!

1 Like