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

Fails to Build in Linux #224

Open
Wright4TheJob opened this issue Mar 2, 2023 · 6 comments
Open

Fails to Build in Linux #224

Wright4TheJob opened this issue Mar 2, 2023 · 6 comments

Comments

@Wright4TheJob
Copy link

This may be a similar issue report to #192 or #87 but I hope more data is helpful for a more robust next update.

Operating System: Pop!_OS 22.04 (Ubuntu based)
Cargo 1.65.0
Rust 2021 Edition

I'm using a fairly minimal test program right now where Z3 and UUId are my only imports. Although I installed Z3 from my package manager I get compile errors from the system compiler (not Cargo) when I attempt to build my library either with a stock Z3 install or with the statically linked library. Both error messages are listed below. I hope one of these errors is simply a mis-configuration on my end.

With this in my Cargo.toml [dependencies]:
z3 = "0.11"
This happens:

error: failed to run custom build command for `z3-sys v0.7.1`

Caused by:
  process didn't exit successfully: `/mnt/HotStorage/Github/ProcessScheduler-rs/target/debug/build/z3-sys-1fb3603f5ca04cca/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=build.rs
  cargo:rerun-if-changed=wrapper.h

  --- stderr
  wrapper.h:1:10: fatal error: 'z3.h' file not found
  wrapper.h:1:10: fatal error: 'z3.h' file not found, err: true
  thread 'main' panicked at 'Unable to generate bindings: ()', /home/davidwright/.cargo/registry/src/github.com-1ecc6299db9ec823/z3-sys-0.7.1/build.rs:33:14
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

And with this in my Cargo.toml [dependencies]:
z3 = {version="0.11.2", features = ["static-link-z3"]}

error: failed to run custom build command for `z3-sys v0.7.1`

Caused by:
  process didn't exit successfully: `/mnt/HotStorage/Github/ProcessScheduler-rs/target/debug/build/z3-sys-1e95f688b8cf2962/build-script-build` (exit status: 101)
  --- stdout
  CMAKE_TOOLCHAIN_FILE_x86_64-unknown-linux-gnu = None
  CMAKE_TOOLCHAIN_FILE_x86_64_unknown_linux_gnu = None
  HOST_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-unknown-linux-gnu = None
  CMAKE_GENERATOR_x86_64_unknown_linux_gnu = None
  HOST_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-unknown-linux-gnu = None
  CMAKE_PREFIX_PATH_x86_64_unknown_linux_gnu = None
  HOST_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-unknown-linux-gnu = None
  CMAKE_x86_64_unknown_linux_gnu = None
  HOST_CMAKE = None
  CMAKE = None

-- snip for privacy and brevity -- expected build steps goes here

 --- stderr
  CMake Warning at CMakeLists.txt:51 (message):
    Disabling Z3_INCLUDE_GIT_DESCRIBE
  Call Stack (most recent call first):
    CMakeLists.txt:100 (disable_git_describe)


  CMake Warning at CMakeLists.txt:55 (message):
    Disabling Z3_INCLUDE_GIT_HASH
  Call Stack (most recent call first):
    CMakeLists.txt:101 (disable_git_hash)


  INFO:root:Generated "/mnt/HotStorage/Github/ProcessScheduler-rs/target/debug/build/z3-sys-1169702a091b35e5/out/build/src/api/dll/install_tactic.cpp"
  /usr/include/stdio.h:33:10: fatal error: 'stddef.h' file not found
  /usr/include/stdio.h:33:10: fatal error: 'stddef.h' file not found, err: true
  thread 'main' panicked at 'Unable to generate bindings: ()', /home/davidwright/.cargo/registry/src/github.com-1ecc6299db9ec823/z3-sys-0.7.1/build.rs:33:14
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@hjfreyer
Copy link

Seeing the same issue. Did you find a workaround?

@Wright4TheJob
Copy link
Author

I have not yet, no. Any luck for you?

@hermanventer
Copy link

I use this as my work-around in MIRAI: z3-sys = { version = "*", git="https://github.com/prove-rs/z3.rs.git", features = ["static-link-z3"], optional = true }

@hjfreyer
Copy link

That didn't work for me - same error, even after deleting Cargo.lock and rebuilding.

@hjfreyer
Copy link

Aha, it seems I was missing clang: apt install clang.

The error message could probably be clearer.

@Wright4TheJob
Copy link
Author

Thank you @hjfreyer! The clang dependency was at the root of my issue, it can compile fine now for me.

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

3 participants