bazel-contrib / rules_foreign_cc

Build rules for interfacing with "foreign" (non-Bazel) build systems (CMake, configure-make, GNU Make, boost, ninja, Meson)
https://bazel-contrib.github.io/rules_foreign_cc
Apache License 2.0
680 stars 249 forks source link

Foreign Cc - CMake: Building xxxx failed: not all outputs were created or valid #881

Closed xiedeacc closed 2 years ago

xiedeacc commented 2 years ago

rules_foreign_cc cmake rule said output xxx.a was not created, but CMake.log display all success bazel version: 5.1.0 compile from source use oracle jdk11

build log

clear && bazel build -s //...
SUBCOMMAND: # @rules_foreign_cc//toolchains:make_tool [action 'BootstrapGNUMake external/rules_foreign_cc/toolchains/make', configuration: 8fde4ce518755422fc1adcaef3e030e90847cc6da4df3f599a44ff11e10d6374, execution platform: @local_config_platform//:host]
(cd /root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/execroot/bazel_cmake_demo && \
  exec env - \
    PATH=/usr/local/jdk-11.0.14/bin:/usr/local/jdk-11.0.14/jre/bin:/usr/local/node-v16.14.2-linux-x64/bin:/usr/local/nginx/sbin:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/data/src/go/bin \
  /bin/bash -c bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make_tool_foreign_cc/wrapper_build_script.sh)
# Configuration: 8fde4ce518755422fc1adcaef3e030e90847cc6da4df3f599a44ff11e10d6374
# Execution platform: @local_config_platform//:host
SUBCOMMAND: # @smhasher//:smhasher [action 'Foreign Cc - CMake: Building smhasher', configuration: d762925729a1e18d6a8bccbddcd1576e4dff3530a38be61ea64828e89bea4b8e, execution platform: @local_config_platform//:host]
(cd /root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/execroot/bazel_cmake_demo && \
  exec env - \
    PATH=/usr/local/jdk-11.0.14/bin:/usr/local/jdk-11.0.14/jre/bin:/usr/local/node-v16.14.2-linux-x64/bin:/usr/local/nginx/sbin:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/data/src/go/bin \
  /bin/bash -c bazel-out/k8-fastbuild/bin/external/smhasher/smhasher_foreign_cc/wrapper_build_script.sh)
 configuration: d762925729a1e18d6a8bccbddcd1576e4dff3530a38be61ea64828e89bea4b8e
 execution platform: @local_config_platform//:host
ERROR: /root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/external/smhasher/BUILD.bazel:9:6: output 'external/smhasher/smhasher/lib/libSMHasherSupport.a' was not created
ERROR: /root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/external/smhasher/BUILD.bazel:9:6: Foreign Cc - CMake: Building smhasher failed: not all outputs were created or valid
Target //src:bazel_cmake_demo failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 53.848s, Critical Path: 38.13s
INFO: 10 processes: 8 internal, 2 linux-sandbox.
FAILED: Build did NOT complete successfully

CMake.log

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

Environment:______________
BUILD_SCRIPT=bazel-out/k8-fastbuild/bin/external/smhasher/smhasher_foreign_cc/build_script.sh
EXT_BUILD_ROOT=/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/2/execroot/bazel_cmake_demo
BUILD_LOG=bazel-out/k8-fastbuild/bin/external/smhasher/smhasher_foreign_cc/CMake.log
PWD=/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/2/execroot/bazel_cmake_demo
BUILD_WRAPPER_SCRIPT=bazel-out/k8-fastbuild/bin/external/smhasher/smhasher_foreign_cc/wrapper_build_script.sh
TMPDIR=/tmp
EXT_BUILD_DEPS=/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/2/execroot/bazel_cmake_demo/bazel-out/k8-fastbuild/bin/external/smhasher/smhasher.ext_build_deps
BUILD_TMPDIR=/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/2/execroot/bazel_cmake_demo/bazel-out/k8-fastbuild/bin/external/smhasher/smhasher.build_tmpdir
SHLVL=2
INSTALLDIR=/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/2/execroot/bazel_cmake_demo/bazel-out/k8-fastbuild/bin/external/smhasher/smhasher
PATH=/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/2/execroot/bazel_cmake_demo:/usr/local/jdk-11.0.14/bin:/usr/local/jdk-11.0.14/jre/bin:/usr/local/node-v16.14.2-linux-x64/bin:/usr/local/nginx/sbin:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/data/src/go/bin
_=/usr/bin/env
__________________________
+ /root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/2/execroot/bazel_cmake_demo/external/cmake-3.22.1-linux-x86_64/bin/cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_TOOLCHAIN_FILE=crosstool_bazel.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/2/execroot/bazel_cmake_demo/bazel-out/k8-fastbuild/bin/external/smhasher/smhasher -DCMAKE_PREFIX_PATH=/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/2/execroot/bazel_cmake_demo/bazel-out/k8-fastbuild/bin/external/smhasher/smhasher.ext_build_deps -DCMAKE_RANLIB= -DCMAKE_MAKE_PROGRAM=/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/2/execroot/bazel_cmake_demo/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make -G 'Unix Makefiles' /root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/2/execroot/bazel_cmake_demo/external/smhasher
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/gcc
-- Detecting C compiler ABI info
................
................

make[3]: Leaving directory '/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/2/execroot/bazel_cmake_demo/bazel-out/k8-fastbuild/bin/external/smhasher/smhasher.build_tmpdir'
[100%] Built target SMHasherSupport
make[2]: Leaving directory '/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/2/execroot/bazel_cmake_demo/bazel-out/k8-fastbuild/bin/external/smhasher/smhasher.build_tmpdir'
/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/external/cmake-3.22.1-linux-x86_64/bin/cmake -E cmake_progress_start /root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/2/execroot/bazel_cmake_demo/bazel-out/k8-fastbuild/bin/external/smhasher/smhasher.build_tmpdir/CMakeFiles 0
make[1]: Leaving directory '/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/2/execroot/bazel_cmake_demo/bazel-out/k8-fastbuild/bin/external/smhasher/smhasher.build_tmpdir'
+ /root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/2/execroot/bazel_cmake_demo/external/cmake-3.22.1-linux-x86_64/bin/cmake --install . --config Release
+ set +x

here was demo:

https://github.com/xiedeacc/bazel_cmake_demo.git

here was build file

load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")

filegroup(
    name = "all",
    srcs = glob(["**"], exclude=[]),
    visibility = ["//visibility:public"],
)

cmake(
    name = "smhasher",
    cache_entries = {
        "CMAKE_C_FLAGS": "-fPIC",
        "CMAKE_VERBOSE_MAKEFILE" : "ON",
    },
    build_args = [],
    lib_source = ":all",
    out_static_libs = ["libSMHasherSupport.a"],
    targets = ["SMHasherSupport"],
    visibility = ["//visibility:public"],
)

with postfix_script = "tree . ; exit 1"

[ 98%] Building C object CMakeFiles/SMHasherSupport.dir/umash.c.o
/usr/bin/gcc -DHAVE_AESNI -DHAVE_CLMUL -DHAVE_INT128 -DHAVE_INT64 -DHAVE_SSE2 -DHAVE_SSE42  -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -march=native -O3 -DNDEBUG -flto -fno-fat-lto-objects -fPIC -MD -MT CMakeFiles/SMHasherSupport.dir/umash.c.o -MF CMakeFiles/SMHasherSupport.dir/umash.c.o.d -o CMakeFiles/SMHasherSupport.dir/umash.c.o -c /root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/9/execroot/bazel_cmake_demo/external/smhasher/umash.c
[100%] Linking CXX static library libSMHasherSupport.a
/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/external/cmake-3.22.1-linux-x86_64/bin/cmake -P CMakeFiles/SMHasherSupport.dir/cmake_clean_target.cmake
/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/external/cmake-3.22.1-linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/SMHasherSupport.dir/link.txt --verbose=1
"/usr/bin/gcc-ar-9" cr libSMHasherSupport.a CMakeFiles/SMHasherSupport.dir/AvalancheTest.cpp.o CMakeFiles/SMHasherSupport.dir/Bitslice.cpp.o CMakeFiles/SMHasherSupport.dir/Bitvec.cpp.o CMakeFiles/SMHasherSupport.dir/chaskey.c.o CMakeFiles/SMHasherSupport.dir/CityTest.cpp.o CMakeFiles/SMHasherSupport.dir/City.cpp.o CMakeFiles/SMHasherSupport.dir/crc.cpp.o CMakeFiles/SMHasherSupport.dir/DifferentialTest.cpp.o CMakeFiles/SMHasherSupport.dir/HashMapTest.cpp.o CMakeFiles/SMHasherSupport.dir/Hashes.cpp.o CMakeFiles/SMHasherSupport.dir/hasshe2.c.o CMakeFiles/SMHasherSupport.dir/crc32_hw.c.o CMakeFiles/SMHasherSupport.dir/KeysetTest.cpp.o CMakeFiles/SMHasherSupport.dir/lookup3.cpp.o CMakeFiles/SMHasherSupport.dir/md5.cpp.o CMakeFiles/SMHasherSupport.dir/MurmurHash1.cpp.o CMakeFiles/SMHasherSupport.dir/MurmurHash2.cpp.o CMakeFiles/SMHasherSupport.dir/MurmurHash3.cpp.o CMakeFiles/SMHasherSupport.dir/Platform.cpp.o CMakeFiles/SMHasherSupport.dir/Random.cpp.o CMakeFiles/SMHasherSupport.dir/sha1.cpp.o CMakeFiles/SMHasherSupport.dir/siphash_ssse3.c.o CMakeFiles/SMHasherSupport.dir/SpeedTest.cpp.o CMakeFiles/SMHasherSupport.dir/Spooky.cpp.o CMakeFiles/SMHasherSupport.dir/SpookyTest.cpp.o CMakeFiles/SMHasherSupport.dir/SpookyV2.cpp.o CMakeFiles/SMHasherSupport.dir/SpookyTestV2.cpp.o CMakeFiles/SMHasherSupport.dir/Stats.cpp.o CMakeFiles/SMHasherSupport.dir/SuperFastHash.cpp.o CMakeFiles/SMHasherSupport.dir/Types.cpp.o CMakeFiles/SMHasherSupport.dir/PMurHash.c.o CMakeFiles/SMHasherSupport.dir/tifuhash.cpp.o CMakeFiles/SMHasherSupport.dir/floppsyhash.cpp.o CMakeFiles/SMHasherSupport.dir/fasthash.cpp.o CMakeFiles/SMHasherSupport.dir/beamsplitter.cpp.o CMakeFiles/SMHasherSupport.dir/discohash.cpp.o CMakeFiles/SMHasherSupport.dir/xxhash.c.o CMakeFiles/SMHasherSupport.dir/metrohash/metrohash64.cpp.o CMakeFiles/SMHasherSupport.dir/metrohash/metrohash128.cpp.o CMakeFiles/SMHasherSupport.dir/cmetrohash64.c.o CMakeFiles/SMHasherSupport.dir/opt_cmetrohash64_1.c.o CMakeFiles/SMHasherSupport.dir/farmhash.cc.o CMakeFiles/SMHasherSupport.dir/FarmTest.cc.o CMakeFiles/SMHasherSupport.dir/pearson_hash/pearson.c.o CMakeFiles/SMHasherSupport.dir/t1ha/t1ha0.c.o CMakeFiles/SMHasherSupport.dir/t1ha/t1ha1.c.o CMakeFiles/SMHasherSupport.dir/t1ha/t1ha2.c.o CMakeFiles/SMHasherSupport.dir/t1ha/t1ha0_ia32aes_noavx.c.o CMakeFiles/SMHasherSupport.dir/t1ha/t1ha0_ia32aes_avx.c.o CMakeFiles/SMHasherSupport.dir/t1ha/t1ha0_ia32aes_avx2.c.o CMakeFiles/SMHasherSupport.dir/mum.cc.o CMakeFiles/SMHasherSupport.dir/jody_hash32.c.o CMakeFiles/SMHasherSupport.dir/jody_hash64.c.o CMakeFiles/SMHasherSupport.dir/tsip.c.o CMakeFiles/SMHasherSupport.dir/seahash.c.o CMakeFiles/SMHasherSupport.dir/farmhash-c.c.o CMakeFiles/SMHasherSupport.dir/farmhash-c-test.cc.o CMakeFiles/SMHasherSupport.dir/clhash.c.o CMakeFiles/SMHasherSupport.dir/metrohash/metrohash64crc.cpp.o CMakeFiles/SMHasherSupport.dir/metrohash/metrohash128crc.cpp.o CMakeFiles/SMHasherSupport.dir/crc32_hw1.c.o CMakeFiles/SMHasherSupport.dir/crc32-pclmul_asm.S.o CMakeFiles/SMHasherSupport.dir/blake2b.c.o CMakeFiles/SMHasherSupport.dir/blake2s.c.o CMakeFiles/SMHasherSupport.dir/rmd128.c.o CMakeFiles/SMHasherSupport.dir/rmd160.c.o CMakeFiles/SMHasherSupport.dir/rmd256.c.o CMakeFiles/SMHasherSupport.dir/sha2/sha224.c.o CMakeFiles/SMHasherSupport.dir/sha2/sha256.c.o CMakeFiles/SMHasherSupport.dir/sha2/sha512_224.c.o CMakeFiles/SMHasherSupport.dir/sha2/sha512_256.c.o CMakeFiles/SMHasherSupport.dir/sha3.c.o CMakeFiles/SMHasherSupport.dir/PMP_Multilinear.cpp.o CMakeFiles/SMHasherSupport.dir/PMP_Multilinear_64.cpp.o CMakeFiles/SMHasherSupport.dir/PMP_Multilinear_test.cpp.o CMakeFiles/SMHasherSupport.dir/vmac.cpp.o CMakeFiles/SMHasherSupport.dir/rijndael-alg-fst.c.o CMakeFiles/SMHasherSupport.dir/blake3/blake3.c.o CMakeFiles/SMHasherSupport.dir/blake3/blake3_dispatch.c.o CMakeFiles/SMHasherSupport.dir/blake3/blake3_portable.c.o CMakeFiles/SMHasherSupport.dir/blake3/blake3_sse41.c.o CMakeFiles/SMHasherSupport.dir/blake3/blake3_avx2.c.o CMakeFiles/SMHasherSupport.dir/pengyhash.c.o CMakeFiles/SMHasherSupport.dir/pearson_hash/pearsonb.c.o CMakeFiles/SMHasherSupport.dir/asconhashv12/hash.c.o CMakeFiles/SMHasherSupport.dir/umash.c.o /root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/9/execroot/bazel_cmake_demo/external/smhasher/falkhash-elf64.o
"/usr/bin/gcc-ranlib-9" libSMHasherSupport.a
make[3]: Leaving directory '/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/9/execroot/bazel_cmake_demo/bazel-out/k8-fastbuild/bin/external/smhasher/smhasher.build_tmpdir'
[100%] Built target SMHasherSupport
make[2]: Leaving directory '/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/9/execroot/bazel_cmake_demo/bazel-out/k8-fastbuild/bin/external/smhasher/smhasher.build_tmpdir'
/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/external/cmake-3.22.1-linux-x86_64/bin/cmake -E cmake_progress_start /root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/9/execroot/bazel_cmake_demo/bazel-out/k8-fastbuild/bin/external/smhasher/smhasher.build_tmpdir/CMakeFiles 0
make[1]: Leaving directory '/root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/9/execroot/bazel_cmake_demo/bazel-out/k8-fastbuild/bin/external/smhasher/smhasher.build_tmpdir'
+ /root/.cache/bazel/_bazel_root/183bc51d72f65dddef7d4f4d84861ca6/sandbox/linux-sandbox/9/execroot/bazel_cmake_demo/external/cmake-3.22.1-linux-x86_64/bin/cmake --install . --config Release
+ set +x
.
|-- CMakeCache.txt
|-- CMakeFiles
|   |-- 3.22.1
|   |   |-- CMakeASMCompiler.cmake
|   |   |-- CMakeCCompiler.cmake
|   |   |-- CMakeCXXCompiler.cmake
|   |   |-- CMakeDetermineCompilerABI_C.bin
|   |   |-- CMakeDetermineCompilerABI_CXX.bin
|   |   |-- CMakeSystem.cmake
|   |   |-- CompilerIdASM
|   |   |-- CompilerIdC
|   |   |   |-- CMakeCCompilerId.c
|   |   |   |-- a.out
|   |   |   `-- tmp
|   |   `-- CompilerIdCXX
|   |       |-- CMakeCXXCompilerId.cpp
|   |       |-- a.out
|   |       `-- tmp
|   |-- CMakeDirectoryInformation.cmake
|   |-- CMakeError.log
|   |-- CMakeOutput.log
|   |-- CMakeRuleHashes.txt
|   |-- CMakeTmp
|   |-- CheckTypeSize
|   |   |-- INT64_T.bin
|   |   |-- INT64_T.c
|   |   |-- __INT64.c
|   |   |-- __UINT128_T.bin
|   |   `-- __UINT128_T.c
|   |-- Makefile.cmake
|   |-- Makefile2
|   |-- SMHasher.dir
|   |   |-- DependInfo.cmake
|   |   |-- build.make
|   |   |-- cmake_clean.cmake
|   |   |-- compiler_depend.make
|   |   |-- compiler_depend.ts
|   |   |-- depend.make
|   |   |-- flags.make
|   |   |-- link.txt
|   |   `-- progress.make
|   |-- SMHasherSupport.dir
|   |   |-- ASM.includecache
|   |   |-- AvalancheTest.cpp.o
|   |   |-- AvalancheTest.cpp.o.d
|   |   |-- Bitslice.cpp.o
|   |   |-- Bitslice.cpp.o.d
|   |   |-- Bitvec.cpp.o
|   |   |-- Bitvec.cpp.o.d
|   |   |-- City.cpp.o
|   |   |-- City.cpp.o.d
|   |   |-- CityTest.cpp.o
|   |   |-- CityTest.cpp.o.d
|   |   |-- DependInfo.cmake
|   |   |-- DifferentialTest.cpp.o
|   |   |-- DifferentialTest.cpp.o.d
|   |   |-- FarmTest.cc.o
|   |   |-- FarmTest.cc.o.d
|   |   |-- HashMapTest.cpp.o
|   |   |-- HashMapTest.cpp.o.d
|   |   |-- Hashes.cpp.o
|   |   |-- Hashes.cpp.o.d
|   |   |-- KeysetTest.cpp.o
|   |   |-- KeysetTest.cpp.o.d
|   |   |-- MurmurHash1.cpp.o
|   |   |-- MurmurHash1.cpp.o.d
|   |   |-- MurmurHash2.cpp.o
|   |   |-- MurmurHash2.cpp.o.d
|   |   |-- MurmurHash3.cpp.o
|   |   |-- MurmurHash3.cpp.o.d
|   |   |-- PMP_Multilinear.cpp.o
|   |   |-- PMP_Multilinear.cpp.o.d
|   |   |-- PMP_Multilinear_64.cpp.o
|   |   |-- PMP_Multilinear_64.cpp.o.d
|   |   |-- PMP_Multilinear_test.cpp.o
|   |   |-- PMP_Multilinear_test.cpp.o.d
|   |   |-- PMurHash.c.o
|   |   |-- PMurHash.c.o.d
|   |   |-- Platform.cpp.o
|   |   |-- Platform.cpp.o.d
|   |   |-- Random.cpp.o
|   |   |-- Random.cpp.o.d
|   |   |-- SpeedTest.cpp.o
|   |   |-- SpeedTest.cpp.o.d
|   |   |-- Spooky.cpp.o
|   |   |-- Spooky.cpp.o.d
|   |   |-- SpookyTest.cpp.o
|   |   |-- SpookyTest.cpp.o.d
|   |   |-- SpookyTestV2.cpp.o
|   |   |-- SpookyTestV2.cpp.o.d
|   |   |-- SpookyV2.cpp.o
|   |   |-- SpookyV2.cpp.o.d
|   |   |-- Stats.cpp.o
|   |   |-- Stats.cpp.o.d
|   |   |-- SuperFastHash.cpp.o
|   |   |-- SuperFastHash.cpp.o.d
|   |   |-- Types.cpp.o
|   |   |-- Types.cpp.o.d
|   |   |-- asconhashv12
|   |   |   |-- hash.c.o
|   |   |   `-- hash.c.o.d
|   |   |-- beamsplitter.cpp.o
|   |   |-- beamsplitter.cpp.o.d
|   |   |-- blake2b.c.o
|   |   |-- blake2b.c.o.d
|   |   |-- blake2s.c.o
|   |   |-- blake2s.c.o.d
|   |   |-- blake3
|   |   |   |-- blake3.c.o
|   |   |   |-- blake3.c.o.d
|   |   |   |-- blake3_avx2.c.o
|   |   |   |-- blake3_avx2.c.o.d
|   |   |   |-- blake3_dispatch.c.o
|   |   |   |-- blake3_dispatch.c.o.d
|   |   |   |-- blake3_portable.c.o
|   |   |   |-- blake3_portable.c.o.d
|   |   |   |-- blake3_sse41.c.o
|   |   |   `-- blake3_sse41.c.o.d
|   |   |-- build.make
|   |   |-- chaskey.c.o
|   |   |-- chaskey.c.o.d
|   |   |-- clhash.c.o
|   |   |-- clhash.c.o.d
|   |   |-- cmake_clean.cmake
|   |   |-- cmake_clean_target.cmake
|   |   |-- cmetrohash64.c.o
|   |   |-- cmetrohash64.c.o.d
|   |   |-- compiler_depend.make
|   |   |-- compiler_depend.ts
|   |   |-- crc.cpp.o
|   |   |-- crc.cpp.o.d
|   |   |-- crc32-pclmul_asm.S.o
|   |   |-- crc32_hw.c.o
|   |   |-- crc32_hw.c.o.d
|   |   |-- crc32_hw1.c.o
|   |   |-- crc32_hw1.c.o.d
|   |   |-- depend.internal
|   |   |-- depend.make
|   |   |-- discohash.cpp.o
|   |   |-- discohash.cpp.o.d
|   |   |-- farmhash-c-test.cc.o
|   |   |-- farmhash-c-test.cc.o.d
|   |   |-- farmhash-c.c.o
|   |   |-- farmhash-c.c.o.d
|   |   |-- farmhash.cc.o
|   |   |-- farmhash.cc.o.d
|   |   |-- fasthash.cpp.o
|   |   |-- fasthash.cpp.o.d
|   |   |-- flags.make
|   |   |-- floppsyhash.cpp.o
|   |   |-- floppsyhash.cpp.o.d
|   |   |-- hasshe2.c.o
|   |   |-- hasshe2.c.o.d
|   |   |-- jody_hash32.c.o
|   |   |-- jody_hash32.c.o.d
|   |   |-- jody_hash64.c.o
|   |   |-- jody_hash64.c.o.d
|   |   |-- link.txt
|   |   |-- lookup3.cpp.o
|   |   |-- lookup3.cpp.o.d
|   |   |-- md5.cpp.o
|   |   |-- md5.cpp.o.d
|   |   |-- metrohash
|   |   |   |-- metrohash128.cpp.o
|   |   |   |-- metrohash128.cpp.o.d
|   |   |   |-- metrohash128crc.cpp.o
|   |   |   |-- metrohash128crc.cpp.o.d
|   |   |   |-- metrohash64.cpp.o
|   |   |   |-- metrohash64.cpp.o.d
|   |   |   |-- metrohash64crc.cpp.o
|   |   |   `-- metrohash64crc.cpp.o.d
|   |   |-- mum.cc.o
|   |   |-- mum.cc.o.d
|   |   |-- opt_cmetrohash64_1.c.o
|   |   |-- opt_cmetrohash64_1.c.o.d
|   |   |-- pearson_hash
|   |   |   |-- pearson.c.o
|   |   |   |-- pearson.c.o.d
|   |   |   |-- pearsonb.c.o
|   |   |   `-- pearsonb.c.o.d
|   |   |-- pengyhash.c.o
|   |   |-- pengyhash.c.o.d
|   |   |-- progress.make
|   |   |-- rijndael-alg-fst.c.o
|   |   |-- rijndael-alg-fst.c.o.d
|   |   |-- rmd128.c.o
|   |   |-- rmd128.c.o.d
|   |   |-- rmd160.c.o
|   |   |-- rmd160.c.o.d
|   |   |-- rmd256.c.o
|   |   |-- rmd256.c.o.d
|   |   |-- seahash.c.o
|   |   |-- seahash.c.o.d
|   |   |-- sha1.cpp.o
|   |   |-- sha1.cpp.o.d
|   |   |-- sha2
|   |   |   |-- sha224.c.o
|   |   |   |-- sha224.c.o.d
|   |   |   |-- sha256.c.o
|   |   |   |-- sha256.c.o.d
|   |   |   |-- sha512_224.c.o
|   |   |   |-- sha512_224.c.o.d
|   |   |   |-- sha512_256.c.o
|   |   |   `-- sha512_256.c.o.d
|   |   |-- sha3.c.o
|   |   |-- sha3.c.o.d
|   |   |-- siphash_ssse3.c.o
|   |   |-- siphash_ssse3.c.o.d
|   |   |-- t1ha
|   |   |   |-- t1ha0.c.o
|   |   |   |-- t1ha0.c.o.d
|   |   |   |-- t1ha0_ia32aes_avx.c.o
|   |   |   |-- t1ha0_ia32aes_avx.c.o.d
|   |   |   |-- t1ha0_ia32aes_avx2.c.o
|   |   |   |-- t1ha0_ia32aes_avx2.c.o.d
|   |   |   |-- t1ha0_ia32aes_noavx.c.o
|   |   |   |-- t1ha0_ia32aes_noavx.c.o.d
|   |   |   |-- t1ha1.c.o
|   |   |   |-- t1ha1.c.o.d
|   |   |   |-- t1ha2.c.o
|   |   |   `-- t1ha2.c.o.d
|   |   |-- tifuhash.cpp.o
|   |   |-- tifuhash.cpp.o.d
|   |   |-- tsip.c.o
|   |   |-- tsip.c.o.d
|   |   |-- umash.c.o
|   |   |-- umash.c.o.d
|   |   |-- vmac.cpp.o
|   |   |-- vmac.cpp.o.d
|   |   |-- xxhash.c.o
|   |   `-- xxhash.c.o.d
|   |-- TAGS.dir
|   |   |-- DependInfo.cmake
|   |   |-- build.make
|   |   |-- cmake_clean.cmake
|   |   |-- compiler_depend.make
|   |   |-- compiler_depend.ts
|   |   `-- progress.make
|   |-- TargetDirectories.txt
|   |-- _CMakeLTOTest-C
|   |   |-- bin
|   |   |   |-- CMakeCache.txt
|   |   |   |-- CMakeFiles
|   |   |   |   |-- CMakeDirectoryInformation.cmake
|   |   |   |   |-- Makefile.cmake
|   |   |   |   |-- Makefile2
|   |   |   |   |-- TargetDirectories.txt
|   |   |   |   |-- boo.dir
|   |   |   |   |   |-- C.includecache
|   |   |   |   |   |-- DependInfo.cmake
|   |   |   |   |   |-- build.make
|   |   |   |   |   |-- cmake_clean.cmake
|   |   |   |   |   |-- compiler_depend.make
|   |   |   |   |   |-- compiler_depend.ts
|   |   |   |   |   |-- depend.internal
|   |   |   |   |   |-- depend.make
|   |   |   |   |   |-- flags.make
|   |   |   |   |   |-- link.txt
|   |   |   |   |   |-- main.c.o
|   |   |   |   |   `-- progress.make
|   |   |   |   |-- cmake.check_cache
|   |   |   |   |-- foo.dir
|   |   |   |   |   |-- C.includecache
|   |   |   |   |   |-- DependInfo.cmake
|   |   |   |   |   |-- build.make
|   |   |   |   |   |-- cmake_clean.cmake
|   |   |   |   |   |-- cmake_clean_target.cmake
|   |   |   |   |   |-- compiler_depend.make
|   |   |   |   |   |-- compiler_depend.ts
|   |   |   |   |   |-- depend.internal
|   |   |   |   |   |-- depend.make
|   |   |   |   |   |-- flags.make
|   |   |   |   |   |-- foo.c.o
|   |   |   |   |   |-- link.txt
|   |   |   |   |   `-- progress.make
|   |   |   |   `-- progress.marks
|   |   |   |-- Makefile
|   |   |   |-- boo
|   |   |   |-- cmake_install.cmake
|   |   |   `-- libfoo.a
|   |   `-- src
|   |       |-- CMakeLists.txt
|   |       |-- foo.c
|   |       `-- main.c
|   |-- _CMakeLTOTest-CXX
|   |   |-- bin
|   |   |   |-- CMakeCache.txt
|   |   |   |-- CMakeFiles
|   |   |   |   |-- CMakeDirectoryInformation.cmake
|   |   |   |   |-- Makefile.cmake
|   |   |   |   |-- Makefile2
|   |   |   |   |-- TargetDirectories.txt
|   |   |   |   |-- boo.dir
|   |   |   |   |   |-- CXX.includecache
|   |   |   |   |   |-- DependInfo.cmake
|   |   |   |   |   |-- build.make
|   |   |   |   |   |-- cmake_clean.cmake
|   |   |   |   |   |-- compiler_depend.make
|   |   |   |   |   |-- compiler_depend.ts
|   |   |   |   |   |-- depend.internal
|   |   |   |   |   |-- depend.make
|   |   |   |   |   |-- flags.make
|   |   |   |   |   |-- link.txt
|   |   |   |   |   |-- main.cpp.o
|   |   |   |   |   `-- progress.make
|   |   |   |   |-- cmake.check_cache
|   |   |   |   |-- foo.dir
|   |   |   |   |   |-- CXX.includecache
|   |   |   |   |   |-- DependInfo.cmake
|   |   |   |   |   |-- build.make
|   |   |   |   |   |-- cmake_clean.cmake
|   |   |   |   |   |-- cmake_clean_target.cmake
|   |   |   |   |   |-- compiler_depend.make
|   |   |   |   |   |-- compiler_depend.ts
|   |   |   |   |   |-- depend.internal
|   |   |   |   |   |-- depend.make
|   |   |   |   |   |-- flags.make
|   |   |   |   |   |-- foo.cpp.o
|   |   |   |   |   |-- link.txt
|   |   |   |   |   `-- progress.make
|   |   |   |   `-- progress.marks
|   |   |   |-- Makefile
|   |   |   |-- boo
|   |   |   |-- cmake_install.cmake
|   |   |   `-- libfoo.a
|   |   `-- src
|   |       |-- CMakeLists.txt
|   |       |-- foo.cpp
|   |       `-- main.cpp
|   |-- cmake.check_cache
|   `-- progress.marks
|-- CTestTestfile.cmake
|-- Makefile
|-- cmake_install.cmake
|-- crosstool_bazel.cmake
|-- install_manifest.txt
`-- libSMHasherSupport.a

30 directories, 307 files
_____ END BUILD LOGS _____
rules_foreign_cc: Build wrapper script location: bazel-out/k8-fastbuild/bin/external/smhasher/smhasher_foreign_cc/wrapper_build_script.sh
rules_foreign_cc: Build script location: bazel-out/k8-fastbuild/bin/external/smhasher/smhasher_foreign_cc/build_script.sh
rules_foreign_cc: Build log location: bazel-out/k8-fastbuild/bin/external/smhasher/smhasher_foreign_cc/CMake.log

Target //src:bazel_cmake_demo failed to build
INFO: Elapsed time: 34.255s, Critical Path: 17.41s
INFO: 4 processes: 4 internal.
FAILED: Build did NOT complete successfully
UebelAndre commented 2 years ago

This can be tricky to identify but could mean a configuration error. The CMake action was successful but it didn't produce a particular output the rule was configured to expect. CMake logs might reveal more.

xiedeacc commented 2 years ago

This can be tricky to identify but could mean a configuration error. The CMake action was successful but it didn't produce a particular output the rule was configured to expect. CMake logs might reveal more.

I have proviede a very tiny project to reproduce this prolem, can you figure out which configuration problem? I notice output library file was generated in BUILD_TMPDIR in my project, but demo nothing generated

UebelAndre commented 2 years ago

It seems the CMake target SMHasherSupport does not actually produce libSMHasherSupport.a. One of my favorite tricks is to set postfix_script = "tree . ; exit 1" on my targets and inspect what's actually being produced. Perhaps give that a try (note you may need to install the tree command on your system)?

xiedeacc commented 2 years ago

It seems the CMake target SMHasherSupport does not actually produce libSMHasherSupport.a. One of my favorite tricks is to set postfix_script = "tree . ; exit 1" on my targets and inspect what's actually being produced. Perhaps give that a try (note you may need to install the tree command on your system)?

use postfix_script show it really produce a libSMHasherSupport.a, but I cannot find any direcotry named sandbox under bazel out directory, was this problem?

UebelAndre commented 2 years ago

Not all CMake projects correctly setup their install targets. This means when cmake install runs, the build artifacts aren't actually moved into the correct location. Unfortunately the fix for this is to either update the CMake files to define install targets or use postfix_script to do some extra copying of files to the location Bazel expects.

xiedeacc commented 2 years ago

Not all CMake projects correctly setup their install targets. This means when cmake install runs, the build artifacts aren't actually moved into the correct location. Unfortunately the fix for this is to either update the CMake files to define install targets or use postfix_script to do some extra copying of files to the location Bazel expects.

ok, I try fix it

xiedeacc commented 2 years ago

fixed by add install directive in cmake