Bazel 报错:/tmp/external/gcc_toolchain_x86_64_files/bin/x86_64-linux-gcc: No such file or directory
在测试bazel编译cpp项目时,遇到一个问题:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
$bazel build //main:hello-world Starting local Bazel server and connecting to it... WARNING: --enable_bzlmod is set, but no MODULE.bazel file was found at the workspace root. Bazel will create an empty MODULE.bazel file. Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel. For more details, please refer to https://github.com/bazelbuild/bazel/issues/18958. INFO: Analyzed target //main:hello-world (69 packages loaded, 6450 targets configured). ERROR: /apsara/xumiaoyong.xmy/bazel-example/cpp-tutorial/stage2/main/BUILD:3:11: Compiling main/hello-greet.cc failed: (Exit 1): gcc failed: error executing CppCompile command (from target //main:hello-greet) external/gcc_toolchain_x86_64/bin/gcc -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 28 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging external/gcc_toolchain_x86_64/bin/gcc: line 45: /tmp/external/gcc_toolchain_x86_64_files/bin/x86_64-linux-gcc: No such file or directory ERROR: /apsara/xumiaoyong.xmy/bazel-example/cpp-tutorial/stage2/main/BUILD:9:10: Compiling main/hello-world.cc failed: (Exit 1): gcc failed: error executing CppCompile command (from target //main:hello-world) external/gcc_toolchain_x86_64/bin/gcc -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 32 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging external/gcc_toolchain_x86_64/bin/gcc: line 45: /tmp/external/gcc_toolchain_x86_64_files/bin/x86_64-linux-gcc: No such file or directory Target //main:hello-world failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 78.477s, Critical Path: 0.22s INFO: 6 processes: 6 internal. ERROR: Build did NOT complete successfully