google / differential-privacy

Google's differential privacy libraries.
Apache License 2.0
3.07k stars 346 forks source link

Unable to build on Fedora 34 #86

Closed Mikerah closed 3 years ago

Mikerah commented 3 years ago

I'm in the process of building the cpp library for DP building blocks and get the following errors:

NFO: Analyzed 80 targets (75 packages loaded, 19049 targets configured).
INFO: Found 80 targets...
ERROR: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/external/zlib/BUILD.bazel:31:11: Compiling inffast.c failed: (Exit 1): gcc failed: error executing command /usr/lib64/ccache/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 25 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
ccache: error: Failed to create temporary file for /run/user/1000/ccache-tmp/tmp.cpp_stdout.FNkvly: Read-only file system
INFO: Elapsed time: 50.929s, Critical Path: 0.40s
INFO: 18 processes: 16 internal, 2 linux-sandbox.
FAILED: Build did NOT complete successfully

I previously installed bazelisk and am able to run bazel.

Mikerah commented 3 years ago

After some searching around, I did the following, ran

export CC="/usr/bin/gcc"
export CXX="/usr/bin/g++"

Then, ran the command for building the C++ DP library and got the following errors:

ERROR: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/external/boringssl/BUILD:151:11: Compiling src/crypto/curve25519/curve25519.c failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -MD -MF ... (remaining 35 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
external/boringssl/src/crypto/curve25519/curve25519.c:503:57: error: argument 2 of type 'const uint8_t[32]' {aka 'const unsigned char[32]'} with mismatched bound [-Werror=array-parameter=]
  503 | int x25519_ge_frombytes_vartime(ge_p3 *h, const uint8_t s[32]) {
      |                                           ~~~~~~~~~~~~~~^~~~~
In file included from external/boringssl/src/crypto/curve25519/curve25519.c:33:
external/boringssl/src/crypto/curve25519/internal.h:109:58: note: previously declared as 'const uint8_t *' {aka 'const unsigned char *'}
  109 | int x25519_ge_frombytes_vartime(ge_p3 *h, const uint8_t *s);
      |                                           ~~~~~~~~~~~~~~~^
external/boringssl/src/crypto/curve25519/curve25519.c:823:57: error: argument 2 of type 'const uint8_t *' {aka 'const unsigned char *'} declared as a pointer [-Werror=array-parameter=]
  823 | void x25519_ge_scalarmult_base(ge_p3 *h, const uint8_t *a) {
      |                                          ~~~~~~~~~~~~~~~^
In file included from external/boringssl/src/crypto/curve25519/curve25519.c:33:
external/boringssl/src/crypto/curve25519/internal.h:117:56: note: previously declared as an array 'const uint8_t[32]' {aka 'const unsigned char[32]'}
  117 | void x25519_ge_scalarmult_base(ge_p3 *h, const uint8_t a[32]);
      |                                          ~~~~~~~~~~~~~~^~~~~
cc1: all warnings being treated as errors
INFO: Elapsed time: 27.619s, Critical Path: 9.24s
INFO: 422 processes: 11 internal, 411 linux-sandbox.
FAILED: Build did NOT complete successfully
dasmdasm commented 3 years ago

Seems like this is a known issue in BoringSSL with gcc 11. Can you include the results of gcc --version g++ --version ?

I assume you're probably using version 11. We run continuous integration with gcc 9. I can look into upgrading our BoringSSL version (looks like this should be fixed at head), or you can also downgrade your compiler to match what we're testing with.

dasmdasm commented 3 years ago

The BoringSSL update should be released next week.

Mikerah commented 3 years ago

The results of gcc --version g++ --version is

gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
dasmdasm commented 3 years ago

I think you're missing the first line of output with the version number? What I get is


Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE```
Mikerah commented 3 years ago

I updated my comment. I improperly formatted the text. So, indeed I am using gcc version 11 instead of gcc 9 which is what is currently being used with BoringSSL.

dasmdasm commented 3 years ago

We updated our BoringSSL version on Monday. Try pulling and building again - I think it should work with gcc 11 now.

Mikerah commented 3 years ago

I'm getting closer now but I'm still unable to build the entire thing. The new error messages I get are the following:

Starting local Bazel server and connecting to it...
INFO: Analyzed 79 targets (75 packages loaded, 19049 targets configured).
INFO: Found 79 targets...
ERROR: /home/mikerah/Documents/HashCloak/Projects/differential-privacy/cc/accounting/kissfft/BUILD.bazel:22:6: output 'accounting/kissfft/kissfft/lib/libkissfft-double.a' was not created
ERROR: /home/mikerah/Documents/HashCloak/Projects/differential-privacy/cc/accounting/kissfft/BUILD.bazel:22:6: CcCmakeMakeRule accounting/kissfft/kissfft/include failed: not all outputs were created or valid
INFO: Elapsed time: 13.353s, Critical Path: 3.01s
INFO: 31 processes: 10 internal, 21 linux-sandbox.
FAILED: Build did NOT complete successfully
dasmdasm commented 3 years ago

Hmm. That's not a very descriptive error message. There should be some cmake logs - mine were in bazel-bin/accounting/kissfft/kissfft_foreign_cc/CMake.log. Taking a look there is probably a good start - we can see whether kissfft built successfully.

I'll also note that kissfft is only required for the accounting library, so getting it to build may not be necessary, depending on what you're trying to do. But it would be good to get it working, if you're up to help.

Mikerah commented 3 years ago

I've tried running the build again and now get a different error that's more akin to the original error I was getting:

ERROR: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/external/com_google_googletest/BUILD.bazel:67:11: Compiling googlemock/src/gmock-cardinalities.cc failed: (Exit 1): gcc failed: error executing command /usr/lib64/ccache/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 35 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
ccache: error: Failed to create temporary file for /run/user/1000/ccache-tmp/tmp.cpp_stdout.zNH5MJ: Read-only file system
INFO: Elapsed time: 0.356s, Critical Path: 0.07s
INFO: 12 processes: 12 internal.
FAILED: Build did NOT complete successfully
Mikerah commented 3 years ago

After setting some PATHs related to gcc and g++:

export CC="/usr/bin/gcc"
export CXX="/usr/bin/g++"

I now get the following errors:

ccache: error: Failed to create temporary file for /run/user/1000/ccache-tmp/tmp.cpp_stdout.iZpupt: Read-only file system
_____ END BUILD LOGS _____
rules_foreign_cc: Build wrapper script location: bazel-out/host/bin/external/rules_foreign_cc/toolchains/make_tool_foreign_cc/wrapper_build_script.sh
rules_foreign_cc: Build script location: bazel-out/host/bin/external/rules_foreign_cc/toolchains/make_tool_foreign_cc/build_script.sh
rules_foreign_cc: Build log location: bazel-out/host/bin/external/rules_foreign_cc/toolchains/make_tool_foreign_cc/BootstrapGNUMake.log
dasmdasm commented 3 years ago

Could you try running with --verbose_failures and --sandbox_debug?

I suspect you're running into a similar error as this stackoverflow question. It seems like your export statements aren't doing what they're supposed to do, and bazel is still calling ccache instead of gcc/g++. You could try to troubleshoot why ccache is still being called, or you could use the --sandbox_writable_path flag to make the ccache directory writeable from the bazel sandbox.

Which version of bazel are you using?

Mikerah commented 3 years ago

Output from adding --verbose_failures and --sandbox_debug flags:

INFO: Analyzed 79 targets (75 packages loaded, 19049 targets configured).
INFO: Found 79 targets...
INFO: Deleting stale sandbox base /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox
ERROR: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/external/com_github_google_glog/BUILD:5:13: Compiling src/logging.cc failed: (Exit 1): linux-sandbox failed: error executing command 
  (cd /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/2/execroot/com_google_cc_differential_privacy && \
  exec env - \
    PATH=/home/mikerah/.cache/bazelisk/downloads/bazelbuild/bazel-4.1.0-linux-x86_64/bin:/home/mikerah/.gvm/bin:/home/mikerah/.opam/4.06.0/bin:/home/mikerah/.cargo/bin:/home/mikerah/.gvm/bin:/home/mikerah/.nvm/versions/node/v16.4.2/bin:/home/mikerah/.local/bin:/home/mikerah/bin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/mikerah/bin:/usr/lib/jvm/java-16-openjdk-16.0.2.0.7-1.rolling.fc34.x86_64//bin:/usr/local/gradle/bin:/home/mikerah/bin:/usr/lib/jvm/java-16-openjdk-16.0.2.0.7-1.rolling.fc34.x86_64//bin:/usr/local/gradle/bin \
    PWD=/proc/self/cwd \
    TMPDIR=/tmp \
  /home/mikerah/.cache/bazel/_bazel_mikerah/install/f95ca91ebc34d56aa0f8ad499de91220/linux-sandbox -t 15 -w /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/2/execroot/com_google_cc_differential_privacy -w /tmp -w /dev/shm -D -- /usr/lib64/ccache/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF bazel-out/k8-fastbuild/bin/external/com_github_google_glog/_objs/glog/logging.pic.d '-frandom-seed=bazel-out/k8-fastbuild/bin/external/com_github_google_glog/_objs/glog/logging.pic.o' -fPIC -iquote external/com_github_google_glog -iquote bazel-out/k8-fastbuild/bin/external/com_github_google_glog -iquote external/com_github_gflags_gflags -iquote bazel-out/k8-fastbuild/bin/external/com_github_gflags_gflags -Ibazel-out/k8-fastbuild/bin/external/com_github_google_glog/_virtual_includes/default_glog_headers -Ibazel-out/k8-fastbuild/bin/external/com_github_gflags_gflags/_virtual_includes/gflags -Wno-sign-compare '-std=c++17' -DGLOG_BAZEL_BUILD -DHAVE_STDINT_H -DHAVE_STRING_H -DHAVE_UNWIND_H -DHAVE_LIB_GFLAGS -Wno-sign-compare -Wno-unused-function -Wno-unused-local-typedefs -Wno-unused-variable '-DGOOGLE_NAMESPACE=google' -DHAVE_PTHREAD -DHAVE_SYS_UTSNAME_H -DHAVE_SYS_TIME_H -DHAVE_SIGACTION -DHAVE_PREAD -DHAVE___ATTRIBUTE__ -Ibazel-out/k8-fastbuild/bin/external/com_github_google_glog/glog_internal -DHAVE_SYS_SYSCALL_H -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/com_github_google_glog/src/logging.cc -o bazel-out/k8-fastbuild/bin/external/com_github_google_glog/_objs/glog/logging.pic.o)
1631975258.363418621: src/main/tools/linux-sandbox.cc:152: calling pipe(2)...
1631975258.363449405: src/main/tools/linux-sandbox.cc:171: calling clone(2)...
1631975258.363671981: src/main/tools/linux-sandbox.cc:180: linux-sandbox-pid1 has PID 1402651
1631975258.364170962: src/main/tools/linux-sandbox-pid1.cc:434: Pid1Main started
1631975258.364223559: src/main/tools/linux-sandbox.cc:197: done manipulating pipes
1631975258.364362140: src/main/tools/linux-sandbox-pid1.cc:176: working dir: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/2/execroot/com_google_cc_differential_privacy
1631975258.364373491: src/main/tools/linux-sandbox-pid1.cc:208: writable: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/2/execroot/com_google_cc_differential_privacy
1631975258.364378955: src/main/tools/linux-sandbox-pid1.cc:208: writable: /tmp
1631975258.364384414: src/main/tools/linux-sandbox-pid1.cc:208: writable: /dev/shm
1631975258.364421876: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /
1631975258.364427404: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /sys
1631975258.364431723: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /sys/kernel/security
1631975258.364437290: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /sys/fs/cgroup
1631975258.364441413: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /sys/fs/pstore
1631975258.364445213: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /sys/firmware/efi/efivars
1631975258.364449974: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /sys/fs/bpf
1631975258.364453883: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /sys/fs/selinux
1631975258.364457558: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /sys/kernel/debug
1631975258.364460903: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /sys/kernel/tracing
1631975258.364465031: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /sys/fs/fuse/connections
1631975258.364468798: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /sys/kernel/config
1631975258.364483858: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /dev
1631975258.364487226: src/main/tools/linux-sandbox-pid1.cc:279: remount rw: /dev/shm
1631975258.364490712: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /dev/pts
1631975258.364494162: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /dev/mqueue
1631975258.364497482: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /dev/hugepages
1631975258.364501186: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /run
1631975258.364504935: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /run/user/1000
1631975258.364508995: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /run/user/1000/gvfs
1631975258.364512765: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /run/user/1000/doc
1631975258.364516357: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /proc
1631975258.364520087: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /proc/sys/fs/binfmt_misc
1631975258.364524207: src/main/tools/linux-sandbox-pid1.cc:300: remount(nullptr, /proc/sys/fs/binfmt_misc, nullptr, 2101281, nullptr) failure (Operation not permitted) ignored
1631975258.364544563: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /proc/sys/fs/binfmt_misc
1631975258.364549540: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /home
1631975258.364553198: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /boot
1631975258.364557255: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /boot/efi
1631975258.364561813: src/main/tools/linux-sandbox-pid1.cc:279: remount rw: /tmp
1631975258.364565735: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /tmp/.mount_Safe-MgGAP2A
1631975258.364569324: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /var/lib/nfs/rpc_pipefs
1631975258.364574520: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /var/lib/docker/btrfs
1631975258.364584524: src/main/tools/linux-sandbox-pid1.cc:279: remount rw: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/2/execroot/com_google_cc_differential_privacy
1631975258.364596002: src/main/tools/linux-sandbox-pid1.cc:279: remount rw: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/2/execroot/com_google_cc_differential_privacy
1631975258.364601272: src/main/tools/linux-sandbox-pid1.cc:279: remount rw: /tmp
1631975258.364605017: src/main/tools/linux-sandbox-pid1.cc:279: remount ro: /tmp/.mount_Safe-MgGAP2A
1631975258.364608816: src/main/tools/linux-sandbox-pid1.cc:279: remount rw: /dev/shm
1631975258.364650366: src/main/tools/linux-sandbox-pid1.cc:363: calling fork...
1631975258.364763169: src/main/tools/linux-sandbox-pid1.cc:393: child started with PID 2
ccache: error: Failed to create temporary file for /run/user/1000/ccache-tmp/tmp.cpp_stdout.BskrCV: Read-only file system
1631975258.366578069: src/main/tools/linux-sandbox-pid1.cc:410: wait returned pid=2, status=0x100
1631975258.366587719: src/main/tools/linux-sandbox-pid1.cc:428: child exited normally with code 1
1631975258.366815273: src/main/tools/linux-sandbox.cc:233: child exited normally with code 1
INFO: Elapsed time: 3.162s, Critical Path: 0.03s
INFO: 4 processes: 4 internal.
FAILED: Build did NOT complete successfully

Then I ran the command with the --sandbox_writable_path flag and get the following error:

INFO: Analyzed 79 targets (0 packages loaded, 0 targets configured).
INFO: Found 79 targets...
ERROR: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/external/com_google_googletest/BUILD.bazel:124:11: Compiling googlemock/src/gmock_main.cc failed: (Exit 1): gcc failed: error executing command /usr/lib64/ccache/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 34 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
ccache: error: Failed to create temporary file for /run/user/1000/ccache-tmp/tmp.cpp_stdout.AEEbhX: Read-only file system
INFO: Elapsed time: 0.233s, Critical Path: 0.06s
INFO: 11 processes: 11 internal.
FAILED: Build did NOT complete successfully
dasmdasm commented 3 years ago

Ah, sorry, the --sandbox_writeable_path flag needs arguments. Based on where it's trying to create temporary files, try --sandbox_writeable_path=$HOME/.ccache and/or --sandbox_writeable_path=/run/user/1000/ccache-tmp

Looks like the export statements are failing because the compilation is being run with env.

Mikerah commented 3 years ago

I tried running it with bazel build --sandbox_writable_path=/run/user/1000/ccache-tmp ... and I get the following errors:

Starting local Bazel server and connecting to it...
INFO: Analyzed 79 targets (75 packages loaded, 19049 targets configured).
INFO: Found 79 targets...
ERROR: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/external/zlib/BUILD.bazel:31:11: Compiling zutil.c failed: (Exit 1): gcc failed: error executing command /usr/lib64/ccache/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -MD -MF ... (remaining 23 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
ccache: error: Failed to create temporary file for /home/mikerah/.cache/ccache/0/b/9843tmllsmpo23ngdphac1j2nu8vi46R.tmp.c0zXqJ: Read-only file system
INFO: Elapsed time: 4.846s, Critical Path: 0.26s
INFO: 24 processes: 24 internal.
FAILED: Build did NOT complete successfully
dasmdasm commented 3 years ago

Try running it with bazel build --sandbox_writable_path=/run/user/1000/ccache-tmp --sandbox_writable_path=/home/mikerah/.cache/ccache ... ?

And if you get more of the ccache: error: Failed to create temporary file errors, you can make additional paths writable to fix the problem.

Mikerah commented 3 years ago

I think that the initial compilation problems have been solved for the most part. Now, I am unable to compile the accounting library. I get the following errors:

ERROR: /home/mikerah/Documents/HashCloak/Projects/differential-privacy/cc/accounting/kissfft/BUILD.bazel:22:6: output 'accounting/kissfft/kissfft/lib/libkissfft-double.a' was not created
ERROR: /home/mikerah/Documents/HashCloak/Projects/differential-privacy/cc/accounting/kissfft/BUILD.bazel:22:6: CcCmakeMakeRule accounting/kissfft/kissfft/include failed: not all outputs were created or valid
dasmdasm commented 3 years ago

Got it, we're back to that error. Can you see if you can find the cmake logs for kissfft? Mine are in bazel-bin/accounting/kissfft/kissfft_foreign_cc/CMake.log

Mikerah commented 3 years ago

Here are the logs:


Bazel external C/C++ Rules. Building library kissfft

Environment:______________
BUILD_SCRIPT=bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft_foreign_cc/build_script.sh
EXT_BUILD_ROOT=/home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy
BUILD_LOG=bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft_foreign_cc/CMake.log
PWD=/home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy
BUILD_WRAPPER_SCRIPT=bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft_foreign_cc/wrapper_build_script.sh
TMPDIR=/tmp
EXT_BUILD_DEPS=/home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft.ext_build_deps
BUILD_TMPDIR=/home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft.build_tmpdir
SHLVL=2
CMAKE_MAKE_PROGRAM=/home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/host/bin/external/rules_foreign_cc/toolchains/make/bin/make
INSTALLDIR=/home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft
PATH=/home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy:/home/mikerah/.cache/bazelisk/downloads/bazelbuild/bazel-4.1.0-linux-x86_64/bin:/home/mikerah/.gvm/bin:/home/mikerah/.opam/4.06.0/bin:/home/mikerah/.cargo/bin:/home/mikerah/.gvm/bin:/home/mikerah/.nvm/versions/node/v16.4.2/bin:/home/mikerah/.local/bin:/home/mikerah/bin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/mikerah/bin:/usr/lib/jvm/java-16-openjdk-16.0.2.0.7-1.rolling.fc34.x86_64//bin:/usr/local/gradle/bin:/home/mikerah/bin:/usr/lib/jvm/java-16-openjdk-16.0.2.0.7-1.rolling.fc34.x86_64//bin:/usr/local/gradle/bin
_=/usr/bin/env
__________________________
+ /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/external/cmake-3.19.6-Linux-x86_64/bin/cmake -DCMAKE_TOOLCHAIN_FILE=crosstool_bazel.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=kissfft -DCMAKE_PREFIX_PATH=/home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft.ext_build_deps -DCMAKE_RANLIB= -DKISSFFT_DATATYPE=double -DKISSFFT_STATIC=ON -DKISSFFT_TEST=OFF -DKISSFFT_TOOLS=OFF -G 'Unix Makefiles' /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/external/kissfft
-- The C compiler identification is GNU 11.2.1
-- The CXX compiler identification is GNU 11.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/lib64/ccache/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/lib64/ccache/gcc - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building KissFFT with datatype: double
-- Building static library
-- PKGINCLUDEDIR is include/kissfft
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft.build_tmpdir
+ /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/external/cmake-3.19.6-Linux-x86_64/bin/cmake --build . --config Release
Scanning dependencies of target kissfft
[ 16%] Building C object CMakeFiles/kissfft.dir/kiss_fft.c.o
[ 33%] Building C object CMakeFiles/kissfft.dir/kfc.c.o
[ 50%] Building C object CMakeFiles/kissfft.dir/kiss_fftnd.c.o
[ 66%] Building C object CMakeFiles/kissfft.dir/kiss_fftndr.c.o
[ 83%] Building C object CMakeFiles/kissfft.dir/kiss_fftr.c.o
[100%] Linking C static library libkissfft-double.a
[100%] Built target kissfft
+ /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/external/cmake-3.19.6-Linux-x86_64/bin/cmake --install . --config Release
-- Installing: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft.build_tmpdir/kissfft/lib64/libkissfft-double.a
-- Installing: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft.build_tmpdir/kissfft/include/kissfft/kiss_fft.h
-- Installing: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft.build_tmpdir/kissfft/include/kissfft/kissfft.hh
-- Installing: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft.build_tmpdir/kissfft/include/kissfft/kiss_fftnd.h
-- Installing: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft.build_tmpdir/kissfft/include/kissfft/kiss_fftndr.h
-- Installing: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft.build_tmpdir/kissfft/include/kissfft/kiss_fftr.h
-- Installing: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft.build_tmpdir/kissfft/lib64/cmake/kissfft/kissfft-double-static-targets.cmake
-- Installing: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft.build_tmpdir/kissfft/lib64/cmake/kissfft/kissfft-double-static-targets-release.cmake
-- Installing: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft.build_tmpdir/kissfft/lib64/cmake/kissfft/kissfft-config.cmake
-- Installing: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft.build_tmpdir/kissfft/lib64/cmake/kissfft/kissfft-config-version.cmake
-- Installing: /home/mikerah/.cache/bazel/_bazel_mikerah/dbaf4a023d8e28c5039358720ba4a0cb/sandbox/linux-sandbox/796/execroot/com_google_cc_differential_privacy/bazel-out/k8-fastbuild/bin/accounting/kissfft/kissfft.build_tmpdir/kissfft/lib64/pkgconfig/kissfft-double.pc
+ set +x
dasmdasm commented 3 years ago

The problem is that bazel is looking for libkissfft-double.a in a lib directory, but it's being built in a lib64 directory on your system. It looks like kissfft's cmake file tries to detect your system, and automatically choose between lib64 and lib based on that. You can work around it by adding

out_lib_dir = "lib64",

to the kissfft build rule in cc/accounting/kissfft/BUILD.bazel. So it should look like:

cmake(
    name = "kissfft",
    generate_args = [
        # See README of kissfft package for explanations of each flag.
        "-DKISSFFT_DATATYPE=double",
        "-DKISSFFT_STATIC=ON",
        "-DKISSFFT_TEST=OFF",
        "-DKISSFFT_TOOLS=OFF",
    ],
    lib_source = "@kissfft//:all",
    out_lib_dir = "lib64",
    out_static_libs = ["libkissfft-double.a"],
)

A permanent fix would require us to be able to configure the directory when building kissfft, but they don't offer that option. Sending them a PR is probably not something I will have time to do in the short-medium term.

Mikerah commented 3 years ago

Using all of these steps, I've finally been able to successfully compile this library.

Thank you for your patience @dasmdasm !