-
Notifications
You must be signed in to change notification settings - Fork 3
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
Builds fail with useless errors if user's global Cargo target-dir is changed #13
Comments
Having dug into this a big farther is apparent that the actual I this the install routine needs to take into account that the cargo build dir may not be the default. Using a global target directory saves a lot of disk space and compile time when you work with a lot of Rust projects and is not an entirely uncommon way to handle CI caching either. |
You can specify a custom target path when configuring luarocks-build-rust-mlua via rockspec file. |
First, sorry this is on the wrong repository. I think you have a move button in the sidebar and you can move it to the Second, thanks for the tip, but that's a pretty unsatisfactory resolution. Of course I could configure my own project to override all user and system settings and hard code a target location, but that wouldn't be particularly friendly to other users. Worse, it isn't just my project it turns out I can't build anything that uses the rust-mlua builder on this system. I have to either change the global Cargo settings or hand-tweak all the rockspecs to override it. I looked into a solution and it looks like this is another case of Cargo not playing nice with other build systems because it assumes it is in ultimate control of a project. There is a long running issue about being able to determine the current target directory with to clear solutions. The current artifact build directory cat be had with some effort: $ cargo build --quiet --message-format=json | jq -sr 'map(select(.reason == "build-script-executed")) | last | .out_dir' ... but that isn't the same as the target directory which seems to be even harder to locate. A temporary solution might be to override the default target in the build. Instead of just using the |
I just spent an unreasonable amount of time debugging a little app that includes Lua bindings that I was adding some trivial new features to. For whatever reason I kept getting successful builds but unusable Lua modules.
Eventually I realized that my last stable tested tag was also not building for me, but that it had built fine and even was still building fine in CI. That finally made me stop looking at what changes I'd just made to the project and look for other local changes.
Eventually I discovered that a change I made a long time back to my user's default Cargo config (in
~/.cargo/config.toml
) was the culprit. It wasn't the default change toclang
+mold
for linking, it was thetarget-dir
change:This causes a bizarre error condition. The build process actually doesn't throw an error:
luarocks make
builds and installs an .so module as usual. The.so
file has execute permissions, and looking at it withfile mymodule.so
shows it looks about right:Trying to load and use the module however is a failure:
The text was updated successfully, but these errors were encountered: