error[E0080]: index out of bounds error when trying to install LuaCAD

HI,
I am trying to install LuaCAD which is a scripting 3d CAD that uses a Rust engine to convert Lua code to openscad code. LuaCAD was downloaded from github (GitHub - ad-si/LuaCAD: Create CAD models with Lua and OpenSCAD · GitHub)

I Have GCC installed (v=14.2), Rust is installed (v=1.95), i also have the csgrs (v=0.20.1) crate installed which luaCAD requires. I am running mx linux.

The issue seems to be in the manifold-sys crate (v=0.1.0) and specifically the bindings.rs file however my knowledge of Rust is minimal (just a beginner really) so not sure whether this is an error in the code or an incompatibility issue related to the manifold-sys library. The full error is below.

Any help with this is much appreciated.

error[E0080]: index out of bounds: the length is 1 but the index is 8
   --> /home/richard/Dev/CAD/LuaCAD/target/release/build/manifold-sys-5178a39b48578b69/out/bindings.rs:102:3
    |
102 | /   ["Size of ManifoldManifoldPair"]
103 | |     [::std::mem::size_of::<ManifoldManifoldPair>() - 8usize];
    | |____________________________________________________________^ evaluation of `_` failed here

error[E0080]: index out of bounds: the length is 1 but the index is 32
   --> /home/richard/Dev/CAD/LuaCAD/target/release/build/manifold-sys-5178a39b48578b69/out/bindings.rs:218:3
    |
218 | /   ["Size of ManifoldMeshGLOptions"]
219 | |     [::std::mem::size_of::<ManifoldMeshGLOptions>() - 32usize];
    | |______________________________________________________________^ evaluation of `_` failed here

error[E0080]: index out of bounds: the length is 1 but the index is 32
   --> /home/richard/Dev/CAD/LuaCAD/target/release/build/manifold-sys-5178a39b48578b69/out/bindings.rs:262:3
    |
262 | /   ["Size of ManifoldMeshGL64Options"]
263 | |     [::std::mem::size_of::<ManifoldMeshGL64Options>() - 32usize];
    | |________________________________________________________________^ evaluation of `_` failed here

For more information about this error, try `rustc --explain E0080`.
error: could not compile `manifold-sys` (lib) due to 3 previous errors
error: failed to compile `luacad v0.1.0 (/home/richard/Dev/CAD/LuaCAD/crates/luacad)`, intermediate artifacts can be found at `/home/richard/Dev/CAD/LuaCAD/target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_BUILD_BUILD_DIR` to that path.
make: *** [makefile:64: install] Error 101

these error messages look like some compile time assertion failures. since it's in the binding.rs, I assume it's generated using bindgen, in which case it's a possible indicator of potential bindgen bug.

let me try to build manifold-sys on my machine to see what would be the outcome.

it works fine for me.

I think it may be a target architecture error. for example, the ManifoldManifoldPair struct has a size of 16 on a 64-bit target, but your code expects it to be 8.

are you cross compiling it from a different machine? I suggest you report the failure to the LuaCAD project.

@Nerditation, thanks for the reply, much appreciated.

I did try and alter the code related to the struct but it didn't seem to change anything. All i have done so far is to clone the github source to my linux box (64 bit) then ran "make install" from the source directory as the install notes suggest.

Note that LuaCAD can also be installed from within the Rust environment using Cargo but this also failed.

I will report the failure to the LuaCAD project.

Thanks for your help with this.

Cheers.

These are (ugly) tests checking whether the non-Rust library you have is compatible with the version of the library that the Rust wrapper has been designed for, and the answer is "no".

Your version of manifold has data structures with a content/layout that is unexpectedly different from what manifold-sys Rust package wants. It could be due to different version of manifold library. Some of these types mention GL, maybe the data in manifold library includes data from OpenGL, which is different.

If by any chance you've installed a 32-bit version of Rust (for i686), then this may be the problem.

If you have 64-bit OS and 64-but Rust, and the right version of the C dependencies, then ask author of manifold-sys to see if they can support your setup.