UberLambda / libktx-rs

Reading, writing, transcoding Khronos Textures in Rust. Bindings to KhronosGroup/KTX-Software.
Apache License 2.0
8 stars 3 forks source link

build error when adding as a depedency to cargo.toml #2

Open eldyer opened 3 years ago

eldyer commented 3 years ago

Thanks for making these crates, super useful stuff!

While building the library by recursively cloning the repo as said in the README works fine, I'm getting the following build script error when adding libktx-rs = "*" to my Cargo.toml dependency list:

  --- stderr
  CMake Warning at cmake/version.cmake:151 (message):
    Error retrieving version from GIT tag.  Falling back to 0.0.0-noversion
  Call Stack (most recent call first):
    CMakeLists.txt:10 (include)

  CMake Error at CMakeLists.txt:200 (add_library):
    Cannot find source file:

      lib/internalexport.def

    Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
    .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc

  CMake Error at CMakeLists.txt:200 (add_library):
    No SOURCES given to target: ktx_read

  CMake Error at CMakeLists.txt:195 (add_library):
    No SOURCES given to target: ktx

  CMake Generate step failed.  Build files cannot be regenerated correctly.
  thread 'main' panicked at '
  command did not execute successfully, got: exit code: 1
eldyer commented 3 years ago

Update: It works when using libktx-rs = {git = "https://github.com/UberLambda/libktx-rs"} instead.

UberLambda commented 3 years ago

Hello, I'll have a look at this during the weekend :)
I most probably forgot to include some files after I switched to building via CMake...

kanerogers commented 3 years ago

Update: It works when using libktx-rs = {git = "https://github.com/UberLambda/libktx-rs"} instead.

Just chiming in to say I'm having the same problem. 😄

Thanks for taking a look, @UberLambda!

UberLambda commented 3 years ago

Hey @eldyer @kanerogers, I just pushed v0.3.3 to crates.io that includes the .def files in the package. Could you please see if it works now?

(If it doesn't, I assume that the version detection script from KhronosGroup/KTX-Software is doing something weird on Windows)

eldyer commented 3 years ago

Hi! Still not working, but the error message became slightly different:

  --- stderr
  CMake Warning at cmake/version.cmake:151 (message):
    Error retrieving version from GIT tag.  Falling back to 0.0.0-noversion
  Call Stack (most recent call first):
    CMakeLists.txt:10 (include)

  thread 'main' panicked at '
  command did not execute successfully, got: exit code: 1

Backtrace:

     0: std::panicking::begin_panic_handler
               at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b\/library\std\src\panicking.rs:515
     1: std::panicking::begin_panic_fmt
               at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b\/library\std\src\panicking.rs:457
     2: cmake::find_exe::{{closure}}
     3: cmake::Config::maybe_clear::{{closure}}
     4: cmake::Config::build
     5: __ImageBase
     6: core::ops::function::FnOnce::call_once
UberLambda commented 3 years ago

Hmm, the version detection script upstream wants to see a real .git tree. If it does not, it defaults to "noversion" and then fails to compile any further :/

This probably requires either patching the CMakeLists.txt manually (from inside the build.rs script) or shipping the entire .git folder with the Cargo package. I don't really like either solution...