Indra-db / Flecs-Rust

Rust API for Flecs: A Fast and Flexible Entity Component System (ECS)
MIT License
194 stars 11 forks source link

`Unable to find libclang` build error with v0.1.2 #154

Closed Danvil closed 4 months ago

Danvil commented 4 months ago

Everything was working fine with v0.1.1, but then cargo decided to upgrade to v0.1.2 and I get the error below. Forcing the version to v.0.1.1 fixes it:

Caused by:
  process didn't exit successfully: `I:\Ikabur\eph2\target\release\build\flecs_ecs_sys-c811b140ad48d96f\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-changed=src/flecs.h
  cargo:rerun-if-changed=src/flecs.c
  cargo:rerun-if-changed=build.rs
  OUT_DIR = Some(I:\Ikabur\eph2\target\release\build\flecs_ecs_sys-2a20f5b4813dbe96\out)
  TARGET = Some(x86_64-pc-windows-msvc)
  HOST = Some(x86_64-pc-windows-msvc)
  cargo:rerun-if-env-changed=VCINSTALLDIR
  VCINSTALLDIR = None
  cargo:rerun-if-env-changed=VSCMD_ARG_VCVARS_SPECTRE
  VSCMD_ARG_VCVARS_SPECTRE = None
  cargo:rerun-if-env-changed=WindowsSdkDir
  WindowsSdkDir = None
  cargo:rerun-if-env-changed=WindowsSDKVersion
  WindowsSDKVersion = None
  cargo:rerun-if-env-changed=LIB
  LIB = None
  cargo:rerun-if-env-changed=PATH
  PATH = Some(I:\Ikabur\eph2\target\release\deps;I:\Ikabur\eph2\target\release;C:\Users\dtw\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib;C:\Program Files\PowerShell\7;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\PuTTY\;C:\Program Files\Wolfram Research\WolframScript\;C:\Program Files\Process Lasso\;C:\Program Files\dotnet\;C:\Program Files\Intel\PresentMon\PresentMonApplication\;C:\Program Files\Tailscale\;C:\Program Files\Git LFS;C:\Program Files\PowerShell\7\;C:\Program Files\Graphviz\bin;C:\Users\dtw\AppData\Local\SumatraPDF\;C:\Program Files\CMake\bin;I:\vcpkg\installed\x64-windows\bin;C:\Users\dtw\miniconda3;C:\Users\dtw\miniconda3\Library\mingw-w64\bin;C:\Users\dtw\miniconda3\Library\usr\bin;C:\Users\dtw\miniconda3\Library\bin;C:\Users\dtw\miniconda3\Scripts;C:\Users\dtw\AppData\Local\Programs\Python\Python311\Scripts\;C:\Users\dtw\AppData\Local\Programs\Python\Python311\;C:\Users\dtw\.cargo\bin;C:\Users\dtw\AppData\Local\Microsoft\WindowsApps;C:\Users\dtw\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\dtw\AppData\Local\GitHubDesktop\bin;C:\Program Files\RedHat\Podman;C:\Users\dtw\AppData\Local\Programs\MiKTeX\miktex\bin\x64\;C:\Users\dtw\.dotnet\tools)
  cargo:rerun-if-env-changed=INCLUDE
  INCLUDE = None
  cargo:rerun-if-env-changed=CC_x86_64-pc-windows-msvc
  CC_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CC_x86_64_pc_windows_msvc
  CC_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some(cmpxchg16b,fxsr,sse,sse2,sse3)
  DEBUG = Some(false)
  cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-msvc
  CFLAGS_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_msvc
  CFLAGS_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  flecs.c
  src/flecs.c(19463): warning C4127: conditional expression is constant
  src/flecs.c(33931): warning C4310: cast truncates constant value
  src/flecs.c(33932): warning C4310: cast truncates constant value
  src/flecs.c(34067): warning C4310: cast truncates constant value
  src/flecs.c(34078): warning C4310: cast truncates constant value
  src/flecs.c(34099): warning C4310: cast truncates constant value
  src/flecs.c(34246): warning C4310: cast truncates constant value
  src/flecs.c(34249): warning C4310: cast truncates constant value
  src/flecs.c(34281): warning C4310: cast truncates constant value
  src/flecs.c(34282): warning C4310: cast truncates constant value
  src/flecs.c(65152): warning C4310: cast truncates constant value
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(61479) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(62366) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(3407) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(55586) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(56456) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(7036) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(7041) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(55757) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(55689) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(57094) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(56321) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(56610) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(56673) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(56706) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(56797) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(56844) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(56885) : warning C4702: unreachable code
  C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flecs_ecs_sys-0.1.1\src\flecs.c(61127) : warning C4701: potentially uninitialized local variable 'qit' used
  cargo:rerun-if-env-changed=AR_x86_64-pc-windows-msvc
  AR_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=AR_x86_64_pc_windows_msvc
  AR_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_AR
  HOST_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64-pc-windows-msvc
  ARFLAGS_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64_pc_windows_msvc
  ARFLAGS_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_ARFLAGS
  HOST_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS
  ARFLAGS = None
  cargo:rustc-link-lib=static=flecs
  cargo:rustc-link-search=native=I:\Ikabur\eph2\target\release\build\flecs_ecs_sys-2a20f5b4813dbe96\out

  --- stderr
  thread 'main' panicked at C:\Users\dtw\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bindgen-0.69.4\lib.rs:622:31:
  Unable to find libclang: "couldn't find any valid shared libraries matching: ['clang.dll', 'libclang.dll'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
waywardmonkeys commented 4 months ago

This is because the 0.1.2 release unintentionally had the feature enabled to regenerate the C bindings which runs bindgen which needs libclang.

This has been fixed on main If you use flecs_ecs via a git dependency, then you'd be fine:

[dependencies]
flecs_ecs = { git = "https://github.com/Indra-db/Flecs-Rust.git", rev = "3d41a15",  version = "0.1.2" }
Indra-db commented 4 months ago

Fixed on main, should submit a new version soon.