jkvargas / russimp

Assimp bindings for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build fails on linux using default features

ten3roberts opened this issue · comments

Steps to reproduce:

https://github.com/jkvargas/russimp
cd russimp
cargo build

System Information

Fedora Linux 37 (Workstation Edition)

assimp version 5.01 rpm (latest)
assimp-devel version 5.01 rpm (latest)

Output

   Compiling russimp v1.0.6
error[E0425]: cannot find value `aiPrimitiveType_aiPrimitiveType_NGONEncodingFlag` in this scope
    --> /home/tei/.cargo/registry/src/github.com-1ecc6299db9ec823/russimp-1.0.6/src/mesh.rs:30:24
     |
30   |     NGONEncodingFlag = aiPrimitiveType_aiPrimitiveType_NGONEncodingFlag as _,
     |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a constant with a similar name exis
ts: `aiPrimitiveType_aiPrimitiveType_LINE`
     |
    ::: /home/tei/dev/russimp-test/target/debug/build/russimp-sys-64c7442717a60fd5/out/bindings.rs:1686:1
     |
1686 | pub const aiPrimitiveType_aiPrimitiveType_LINE: aiPrimitiveType = 2;
     | --------------------------------------------------------------- similarly named constant `aiPrimitiveType_aiPrimi
tiveType_LINE` defined here

error[E0425]: cannot find value `aiTextureType_aiTextureType_SHEEN` in this scope
    --> /home/tei/.cargo/registry/src/github.com-1ecc6299db9ec823/russimp-1.0.6/src/texture.rs:34:13
     |
34   |     Sheen = aiTextureType_aiTextureType_SHEEN as _,
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a constant with a similar name exists: `aiTextureType_aiTextu
reType_NONE`
     |
    ::: /home/tei/dev/russimp-test/target/debug/build/russimp-sys-64c7442717a60fd5/out/bindings.rs:2344:1
     |
2344 | pub const aiTextureType_aiTextureType_NONE: aiTextureType = 0;
     | --------------------------------------------------------- similarly named constant `aiTextureType_aiTextureType_N
ONE` defined here

error[E0425]: cannot find value `aiTextureType_aiTextureType_CLEARCOAT` in this scope
    --> /home/tei/.cargo/registry/src/github.com-1ecc6299db9ec823/russimp-1.0.6/src/texture.rs:35:17
     |
35   |     Clearcoat = aiTextureType_aiTextureType_CLEARCOAT as _,
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a constant with a similar name exists: `aiTextureType
_aiTextureType_HEIGHT`
     |
    ::: /home/tei/dev/russimp-test/target/debug/build/russimp-sys-64c7442717a60fd5/out/bindings.rs:2349:1
     |
2349 | pub const aiTextureType_aiTextureType_HEIGHT: aiTextureType = 5;
     | ----------------------------------------------------------- similarly named constant `aiTextureType_aiTextureType
_HEIGHT` defined here

error[E0425]: cannot find value `aiTextureType_aiTextureType_TRANSMISSION` in this scope
    --> /home/tei/.cargo/registry/src/github.com-1ecc6299db9ec823/russimp-1.0.6/src/texture.rs:36:20
     |
36   |     Transmission = aiTextureType_aiTextureType_TRANSMISSION as _,
     |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a constant with a similar name exists: `aiTextu
reType_aiTextureType_EMISSIVE`
     |
    ::: /home/tei/dev/russimp-test/target/debug/build/russimp-sys-64c7442717a60fd5/out/bindings.rs:2348:1
     |
2348 | pub const aiTextureType_aiTextureType_EMISSIVE: aiTextureType = 4;
     | ------------------------------------------------------------- similarly named constant `aiTextureType_aiTextureTy
pe_EMISSIVE` defined here

error[E0081]: discriminant value `18` assigned more than once
  --> /home/tei/.cargo/registry/src/github.com-1ecc6299db9ec823/russimp-1.0.6/src/texture.rs:14:1
   |
14 | pub enum TextureType {
   | ^^^^^^^^^^^^^^^^^^^^
...
34 |     Sheen = aiTextureType_aiTextureType_SHEEN as _,
   |             -------------------------------------- `18` assigned here
...
37 |     Unknown = aiTextureType_aiTextureType_UNKNOWN as _,
   |               ---------------------------------------- `18` assigned here

Some errors have detailed explanations: E0081, E0425.
For more information about an error, try `rustc --explain E0081`.
error: could not compile `russimp` due to 5 previous errors

[Process exited 101]

Compiling with:

russimp = { version = "1.0", features = ["static-link"] }

Fails as well

   Compiling russimp-sys v1.0.3
   Compiling russimp v1.0.6
error: could not find native static library `assimp`, perhaps an -L flag is missing?

error: could not compile `russimp-sys` due to previous error
warning: build failed, waiting for other jobs to finish...

Compiling with the features nozlib and nolibcxx does not work either.

The only combinations of options which work are prebuilt

Hi,
you will not be able to compile actual russimp with assimp 5.0.1.
Actual russimp is built with 5.2.5.
You would have to go back to commit ae45635, and even so I believe there are issues to compile it.

Since your distro does not give you a more recent version of assimp you can use
https://github.com/jkvargas/russimp/blob/master/install_assimp.bash
to build and install it on your system.

You will need to edit the file and replace apt lines to dnf compatible prerequisites.

Thank you.

Is this the reason that the default features fails to compile as well?

From my understanding static-link clones and builds from source, so it should not be dependent on system libraries

Digging deeper, it seems that static-link downloads the source inside ~/.cargo/repo/.../russimp-*** builds it into the target dir at target/debug/build/russimp-***/out/build-from-source/assimp/ and uses CMAKE_INSTALL_PREFIX to put it in target/debug/build/russimp-***/out/build-from-source/assimp/out/ which makes cmake --build . --target install --config Release copy the build artefacts into the local target.

It then tries to link to a file inside target/debug/build/russimp-sys-1561b8413c9b1ad5/out/build-from-source/assimp/out/lib, while the compiled artefact ends up in target/debug/build/russimp-sys-1561b8413c9b1ad5/out/build-from-source/assimp/out/lib64, with another copy in target/debug/build/russimp-sys-1561b8413c9b1ad5/out/build-from-source/assimp/lib.

Which is why is fails to link

Hey mate,
sorry didn't find time yet to look at your issue.
Try take a look at https://github.com/jkvargas/russimp-sys/blob/main/.github/workflows/release.yml on how it is building for linux.
Let me know if that helps.