bytedance / Elkeid

Elkeid is an open source solution that can meet the security requirements of various workloads such as hosts, containers and K8s, and serverless. It is derived from ByteDance's internal best practices.
https://elkeid.bytedance.com
2.22k stars 429 forks source link

scanner rust 编译报错 #87

Closed ca110us closed 3 years ago

ca110us commented 3 years ago

Describe the bug scanner rust 编译报错 环境:windows10 + wsl2

To Reproduce chmod +x ./build.sh && ./build.sh

Expected behavior 编译成功

Screenshots 微信截图_20210721163520

Additional context

 Compiling yara-sys v0.6.2
error: failed to run custom build command for `yara-sys v0.6.2`

Caused by:
  process didn't exit successfully: `/mnt/e/S/cplugin/scanner/target/release/build/yara-sys-c4f27cafef8ededd/build-script-build` (exit code: 101)
  --- stdout
  TARGET = Some("x86_64-unknown-linux-gnu")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_x86_64-unknown-linux-gnu = None
  CC_x86_64_unknown_linux_gnu = None
  HOST_CC = None
  CC = None
  CFLAGS_x86_64-unknown-linux-gnu = None
  CFLAGS_x86_64_unknown_linux_gnu = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("crt-static,fxsr,sse,sse2")
  CC_x86_64-unknown-linux-gnu = None
  CC_x86_64_unknown_linux_gnu = None
  HOST_CC = None
  CC = None
  CFLAGS_x86_64-unknown-linux-gnu = None
  CFLAGS_x86_64_unknown_linux_gnu = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("crt-static,fxsr,sse,sse2")
  CC_x86_64-unknown-linux-gnu = None
  CC_x86_64_unknown_linux_gnu = None
  HOST_CC = None
  CC = None
  CFLAGS_x86_64-unknown-linux-gnu = None
  CFLAGS_x86_64_unknown_linux_gnu = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("crt-static,fxsr,sse,sse2")
  CC_x86_64-unknown-linux-gnu = None
  CC_x86_64_unknown_linux_gnu = None
  HOST_CC = None
  CC = None
  CFLAGS_x86_64-unknown-linux-gnu = None
  CFLAGS_x86_64_unknown_linux_gnu = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("crt-static,fxsr,sse,sse2")
  CC_x86_64-unknown-linux-gnu = None
  CC_x86_64_unknown_linux_gnu = None
  HOST_CC = None
  CC = None
  CFLAGS_x86_64-unknown-linux-gnu = None
  CFLAGS_x86_64_unknown_linux_gnu = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("crt-static,fxsr,sse,sse2")
  CC_x86_64-unknown-linux-gnu = None
  CC_x86_64_unknown_linux_gnu = None
  HOST_CC = None
  CC = None
  CFLAGS_x86_64-unknown-linux-gnu = None
  CFLAGS_x86_64_unknown_linux_gnu = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("crt-static,fxsr,sse,sse2")
  CC_x86_64-unknown-linux-gnu = None
  CC_x86_64_unknown_linux_gnu = None
  HOST_CC = None
  CC = None
  CFLAGS_x86_64-unknown-linux-gnu = None
  CFLAGS_x86_64_unknown_linux_gnu = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("crt-static,fxsr,sse,sse2")
  CC_x86_64-unknown-linux-gnu = None
  CC_x86_64_unknown_linux_gnu = None
  HOST_CC = None
  CC = None
  CFLAGS_x86_64-unknown-linux-gnu = None
  CFLAGS_x86_64_unknown_linux_gnu = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("crt-static,fxsr,sse,sse2")
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-static" "-I" "/home/c4rp3/.cargo/registry/src/github.com-1ecc6299db9ec823/yara-sys-0.6.2/yara/libyara" "-I" "/home/c4rp3/.cargo/registry/src/github.com-1
ecc6299db9ec823/yara-sys-0.6.2/yara/libyara/include" "-Wall" "-Wextra" "-Wno-deprecated-declarations" "-Wno-unused-parameter" "-Wno-unused-function" "-Wno-cast-function-type" "-Wno-type-limits" "-Wno-tautological-constant-out-of-ran
ge-compare" "-Wno-sign-compare" "-DDEX_MODULE=" "-DDOTNET_MODULE=" "-DMACHO_MODULE=" "-DNDEBUG=1" "-DUSE_LINUX_PROC=" "-DPOSIX=" "-o" "/mnt/e/S/cplugin/scanner/target/x86_64-unknown-linux-gnu/release/build/yara-sys-8beadc18cf505f1f/
out/ahocorasick.o" "-c" "/home/c4rp3/.cargo/registry/src/github.com-1ecc6299db9ec823/yara-sys-0.6.2/yara/libyara/ahocorasick.c"
  exit code: 0
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-static" "-I" "/home/c4rp3/.cargo/registry/src/github.com-1ecc6299db9ec823/yara-sys-0.6.2/yara/libyara" "-I" "/home/c4rp3/.cargo/registry/src/github.com-1
ecc6299db9ec823/yara-sys-0.6.2/yara/libyara/include" "-Wall" "-Wextra" "-Wno-deprecated-declarations" "-Wno-unused-parameter" "-Wno-unused-function" "-Wno-cast-function-type" "-Wno-type-limits" "-Wno-tautological-constant-out-of-ran
ge-compare" "-Wno-sign-compare" "-DDEX_MODULE=" "-DDOTNET_MODULE=" "-DMACHO_MODULE=" "-DNDEBUG=1" "-DUSE_LINUX_PROC=" "-DPOSIX=" "-o" "/mnt/e/S/cplugin/scanner/target/x86_64-unknown-linux-gnu/release/build/yara-sys-8beadc18cf505f1f/
out/arena.o" "-c" "/home/c4rp3/.cargo/registry/src/github.com-1ecc6299db9ec823/yara-sys-0.6.2/yara/libyara/arena.c"
  exit code: 0
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-static" "-I" "/home/c4rp3/.cargo/registry/src/github.com-1ecc6299db9ec823/yara-sys-0.6.2/yara/libyara" "-I" "/home/c4rp3/.cargo/registry/src/github.com-1
ecc6299db9ec823/yara-sys-0.6.2/yara/libyara/include" "-Wall" "-Wextra" "-Wno-deprecated-declarations" "-Wno-unused-parameter" "-Wno-unused-function" "-Wno-cast-function-type" "-Wno-type-limits" "-Wno-tautological-constant-out-of-ran
ge-compare" "-Wno-sign-compare" "-DDEX_MODULE=" "-DDOTNET_MODULE=" "-DMACHO_MODULE=" "-DNDEBUG=1" "-DUSE_LINUX_PROC=" "-DPOSIX=" "-o" "/mnt/e/S/cplugin/scanner/target/x86_64-unknown-linux-gnu/release/build/yara-sys-8beadc18cf505f1f/
out/atoms.o" "-c" "/home/c4rp3/.cargo/registry/src/github.com-1ecc6299db9ec823/yara-sys-0.6.2/yara/libyara/atoms.c"
  exit code: 0
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-static" "-I" "/home/c4rp3/.cargo/registry/src/github.com-1ecc6299db9ec823/yara-sys-0.6.2/yara/libyara" "-I" "/home/c4rp3/.cargo/registry/src/github.com-1
ecc6299db9ec823/yara-sys-0.6.2/yara/libyara/include" "-Wall" "-Wextra" "-Wno-deprecated-declarations" "-Wno-unused-parameter" "-Wno-unused-function" "-Wno-cast-function-type" "-Wno-type-limits" "-Wno-tautological-constant-out-of-ran
ge-compare" "-Wno-sign-compare" "-DDEX_MODULE=" "-DDOTNET_MODULE=" "-DMACHO_MODULE=" "-DNDEBUG=1" "-DUSE_LINUX_PROC=" "-DPOSIX=" "-o" "/mnt/e/S/cplugin/scanner/target/x86_64-unknown-linux-gnu/release/build/yara-sys-8beadc18cf505f1f/
out/base64.o" "-c" "/home/c4rp3/.cargo/registry/src/github.com-1ecc6299db9ec823/yara-sys-0.6.2/yara/libyara/base64.c"
  exit code: 0
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-static" "-I" "/home/c4rp3/.cargo/registry/src/github.com-1ecc6299db9ec823/yara-sys-0.6.2/yara/libyara" "-I" "/home/c4rp3/.cargo/registry/src/github.com-1
ecc6299db9ec823/yara-sys-0.6.2/yara/libyara/include" "-Wall" "-Wextra" "-Wno-deprecated-declarations" "-Wno-unused-parameter" "-Wno-unused-function" "-Wno-cast-function-type" "-Wno-type-limits" "-Wno-tautological-constant-out-of-ran
ge-compare" "-Wno-sign-compare" "-DDEX_MODULE=" "-DDOTNET_MODULE=" "-DMACHO_MODULE=" "-DNDEBUG=1" "-DUSE_LINUX_PROC=" "-DPOSIX=" "-o" "/mnt/e/S/cplugin/scanner/target/x86_64-unknown-linux-gnu/release/build/yara-sys-8beadc18cf505f1f/
out/bitmask.o" "-c" "/home/c4rp3/.cargo/registry/src/github.com-1ecc6299db9ec823/yara-sys-0.6.2/yara/libyara/bitmask.c"
  exit code: 0
kulukami commented 3 years ago

Missing build tool-chain

#add build target x86_64-unknown-linux-gnu

rustup target add x86_64-unknown-linux-gnu
ca110us commented 3 years ago
sudo apt-get install llvm
sudo apt-get install clang

之后编译就 ok 了