rust-native-ui / libui-rs

Rust bindings to the minimalist, native, cross-platform UI toolkit `libui`
Apache License 2.0
926 stars 74 forks source link

iui = "0.3" in toml - not work, require git folder. Git method - work. #109

Open Zymlex opened 3 years ago

Zymlex commented 3 years ago

Windows Server 2019

error: failed to run custom build command for `ui-sys v0.1.3`
Caused by:
  process didn't exit successfully: `D:\Projects\Test\target\debug\build\ui-sys-54eef348477f7dd2\build-script-build` (exit code: 101)
  --- stdout
  git version 2.30.0.windows.1
  running: "cmake" "D:\\Rust\\cargo\\registry\\src\\github.com-1ecc6299db9ec823\\ui-sys-0.1.3\\libui" "-G" "Visual Studio 16 2019" "-Thost=x64" "-Ax64" "-DCMAKE_INSTALL_PREFIX=D:\\Projects\\Test\\target\\debug\\build\\ui-sys-9f5ae8adb4cc987e\\out" "-DCMAKE_C_FLAGS= -nologo -MD -Brepro" "-DCMAKE_C_FLAGS_RELEASE= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS_RELEASE= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS_RELEASE= -nologo -MD -Brepro" "-DCMAKE_BUILD_TYPE=release"
  --- stderr
  fatal: not a git repository (or any of the parent directories): .git
  thread 'main' panicked at '
  failed to execute command: The system cannot find the file specified. (os error 2)
  is `cmake` not installed?
  build script failed, must exit now', D:\Rust\cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.45\src\lib.rs:894:5
  stack backtrace:
     0: std::panicking::begin_panic_handler
               at /rustc/e38fb306b7f5e65cca34df2dab1f0db15e1defb4\/library\std\src\panicking.rs:493
     1: std::panicking::begin_panic_fmt
               at /rustc/e38fb306b7f5e65cca34df2dab1f0db15e1defb4\/library\std\src\panicking.rs:435
     2: cmake::fail
               at D:\Rust\cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.45\src\lib.rs:894
     3: cmake::run
               at D:\Rust\cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.45\src\lib.rs:864
     4: cmake::Config::build
               at D:\Rust\cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.45\src\lib.rs:707
     5: build_script_build::main
               at .\build.rs:35
     6: core::ops::function::FnOnce::call_once<fn(),tuple<>>
               at D:\Rust\rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs:227
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
warning: build failed, waiting for other jobs to finish...
error: build failed
Process finished with exit code 101
gbj commented 3 years ago

I’ll just add that I experienced the same thing trying to build IUI for the first time on my Mac today; using this repo in Cargo.toml solved it for me as well.

nashley commented 3 years ago

86 removed the dependency on cmake, but that hasn't made it into a release yet. I suspect that installing cmake would let you compile with the released version, but that's nearly 3 years old at this point, so it's probably a good idea to stick with using the git version.

quickdudley commented 3 years ago

I get the same error if I try to use iui from GitHub as a dependency in another crate, but if I run cd libui-rs/iui; cargo build it compiles without error.

vstojkovic commented 2 years ago

If people are still interested in this, I just ran into a bunch of issues with the cmake dependency, on Windows 10, and managed to solve them successfully. First, make sure that you install CMake and that it's version is no newer than 3.19. Second, make sure CMake is on your path. The installer can add it there, or you can set it manually. These two things should allow you to build iui version 0.3.0 without problems.

In case anyone is wondering why CMake 3.19, here's an explanation. The build.rs script in ui-sys uses the cmake crate incorrectly, by specifying an empty build target instead of calling no_build_target(true). This results in the command line option --target "" being passed to CMake, which used to work fine with older CMake version. CMake 3.15 added support for multiple build targets, but empty build target still worked the same as omitting the --target switch. Starting with CMake 3.20, specifying an empty target triggers the usage message, which breaks the ui-sys build.

NoraCodes commented 2 years ago

For what it's worth, I'm likely to have some free time from work soon and hopefully can take the time to fix the build script. Thank you all for this very useful discussion!

kleinesfilmroellchen commented 2 years ago

This still happens on Windows 10 with version 0.3. (trunk has some different issues with bindgen not finding clang so couldn't test that.) It's very unfortunate that this requires an outdated cmake version (I only have 3.22) and I don't want users of my project to have to apply these hacks in order to get IUI compiling.