Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build flecs_ecs_sys v0.1.2 on Darwin 24.2.0 with Xcode 16.2 #802

Open
georgik opened this issue Jan 5, 2025 · 3 comments
Open

Comments

@georgik
Copy link

georgik commented Jan 5, 2025

The build of Hyperion fails on M4 - commit 83512a0

Related conversation: #800

rust-toolchain.toml (no change):

[toolchain]
channel = "nightly-2024-12-18"
components = ["rustfmt", "clippy"]
profile = "minimal"

Steps to reproduce:

cargo clean
cargo update
cargo run --release --bin tag

Build log:

...
   Compiling darling v0.20.10
   Compiling derive-build v0.1.1
error: failed to run custom build command for `flecs_ecs_sys v0.1.2 (https://github.com/Indra-db/Flecs-Rust#cb296d0a)`

Caused by:
  process didn't exit successfully: `/Users/georgik/projects/hyperion/target/release/build/flecs_ecs_sys-1cc293d70dd97d31/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=src/flecs.h
  cargo:rerun-if-changed=src/flecs.c
  cargo:rerun-if-changed=src/flecs_rust.h
  cargo:rerun-if-changed=src/flecs_rust.c
  cargo:rerun-if-changed=build.rs
  OUT_DIR = Some(/Users/georgik/projects/hyperion/target/release/build/flecs_ecs_sys-1d9c9a69f869f33d/out)
  TARGET = Some(aarch64-apple-darwin)
  HOST = Some(aarch64-apple-darwin)
  cargo:rerun-if-env-changed=CC_aarch64-apple-darwin
  CC_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=CC_aarch64_apple_darwin
  CC_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  RUSTC_WRAPPER = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some(false)
  cargo:rerun-if-env-changed=MACOSX_DEPLOYMENT_TARGET
  MACOSX_DEPLOYMENT_TARGET = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64-apple-darwin
  CFLAGS_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_apple_darwin
  CFLAGS_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  CARGO_ENCODED_RUSTFLAGS = Some(--cfgtokio_unstable-Ctarget-cpu=native)
  cargo:rerun-if-env-changed=AR_aarch64-apple-darwin
  AR_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=AR_aarch64_apple_darwin
  AR_aarch64_apple_darwin = 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_aarch64-apple-darwin
  ARFLAGS_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=ARFLAGS_aarch64_apple_darwin
  ARFLAGS_aarch64_apple_darwin = 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=/Users/georgik/projects/hyperion/target/release/build/flecs_ecs_sys-1d9c9a69f869f33d/out

  --- stderr
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:1037:2: error: Unsupported architecture
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/machine/_types.h:36:2: error: architecture not supported
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:67:9: error: unknown type name '__int64_t'
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:68:9: error: unknown type name '__int32_t'
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:69:9: error: unknown type name '__int32_t'
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:72:9: error: unknown type name '__uint32_t'
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t'
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:74:9: error: unknown type name '__uint64_t'
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:80:9: error: unknown type name '__darwin_natural_t'
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:82:9: error: unknown type name '__uint16_t'
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:83:9: error: unknown type name '__int64_t'
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:84:9: error: unknown type name '__int32_t'
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:85:9: error: unknown type name '__uint32_t'
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:86:9: error: unknown type name '__int32_t'
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:87:9: error: unknown type name '__uint32_t'
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:88:9: error: unknown type name '__uint32_t'
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_size_t.h:50:9: error: unknown type name '__darwin_size_t'
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/machine/types.h:39:2: error: architecture not supported
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_rsize_t.h:50:9: error: unknown type name '__darwin_size_t'
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  thread 'main' panicked at /Users/georgik/.cargo/git/checkouts/flecs-rust-182003fcd2303c9b/cb296d0/flecs_ecs_sys/build.rs:198:40:
  Unable to generate bindings: ClangDiagnostic("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:1037:2: error: Unsupported architecture\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/machine/_types.h:36:2: error: architecture not supported\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:67:9: error: unknown type name '__int64_t'\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:68:9: error: unknown type name '__int32_t'\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:69:9: error: unknown type name '__int32_t'\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:72:9: error: unknown type name '__uint32_t'\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t'\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:74:9: error: unknown type name '__uint64_t'\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:80:9: error: unknown type name '__darwin_natural_t'\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:82:9: error: unknown type name '__uint16_t'\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:83:9: error: unknown type name '__int64_t'\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:84:9: error: unknown type name '__int32_t'\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:85:9: error: unknown type name '__uint32_t'\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:86:9: error: unknown type name '__int32_t'\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:87:9: error: unknown type name '__uint32_t'\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:88:9: error: unknown type name '__uint32_t'\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_size_t.h:50:9: error: unknown type name '__darwin_size_t'\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/machine/types.h:39:2: error: architecture not supported\n/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_rsize_t.h:50:9: error: unknown type name '__darwin_size_t'\nfatal error: too many errors emitted, stopping now [-ferror-limit=]\n")
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
@georgik
Copy link
Author

georgik commented Jan 5, 2025

It seems that problem is caused by incorrect mapping of architecture name:

thread 'main' panicked at /Users/georgik/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bindgen-0.70.1/lib.rs:892:13:
  assertion `left == right` failed: "arm64-apple-darwin" "aarch64-apple-darwin"
    left: 4
   right: 8
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/a4cb3c831823d9baa56c3d90514b75b2660116fa/library/std/src/panicking.rs:681:5
     1: core::panicking::panic_fmt
               at /rustc/a4cb3c831823d9baa56c3d90514b75b2660116fa/library/core/src/panicking.rs:75:14
     2: core::panicking::assert_failed_inner
     3: core::panicking::assert_failed
               at /rustc/a4cb3c831823d9baa56c3d90514b75b2660116fa/library/core/src/panicking.rs:364:5
     4: bindgen::Bindings::generate
     5: bindgen::Builder::generate
     6: build_script_build::generate_bindings
     7: build_script_build::main
     8: core::ops::function::FnOnce::call_once

For some reason there is arm64 instead of aarch64.

@georgik
Copy link
Author

georgik commented Jan 5, 2025

The problem is really in flecs_ecs_sys create. It's not setting target arch correctly.
I made modification of the crate localy and added the following line to flecs_ecs_sys/build.rs

.clang_arg(format!("--target={}", env::var("HOST").unwrap()))

After this change, it was possible to build the project.
I will report the issue to crate repo.

The solution is based on similar issue in other project: westerndigitalcorporation/spdm-utils@a0aadc3#diff-d0d98998092552a1d3259338c2c71e118a5b8343dd4703c0c7f552ada7f9cb42R74

@georgik
Copy link
Author

georgik commented Jan 5, 2025

Reported: Indra-db/Flecs-Rust#218

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant