Skip to content

Cross compile fails #18

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

Open
amsitlab opened this issue Feb 17, 2025 · 1 comment
Open

Cross compile fails #18

amsitlab opened this issue Feb 17, 2025 · 1 comment

Comments

@amsitlab
Copy link

error at here:

local src = dir.path(target_path, "release", rustlib)
local dst = dir.path(libdir, mod .. "." .. cfg.lib_extension)
local ok, err = fs.copy(src, dst, "exec")
if not ok then
return nil, "Failed installing " .. src .. " in " .. dst .. ": " .. err
end
end
if rockspec.build.include then
local cwd = dir.path(dir.dir_name(rockspec.local_abs_filename), rockspec.name)
local luadir = path.lua_dir(rockspec.name, rockspec.version)
fs.make_dir(dir.dir_name(luadir))
for from, to in pairs(rockspec.build.include) do
if type(from) == "number" then
from = to
end
to = dir.path(luadir, to)
local ok, err = fs.copy(dir.path(cwd, from), to, "exec")
if not ok then
return nil, "Failed copying " .. from .. " in " .. to .. ": " .. err
end
end

because you just search output in target/release
error will produce when user type CARGO_BUILD_TARGET=aarch64-unknown-linux-gnu luarock build --pack-binary-rock --no-install ....
this command will produce output into target/aarch64-unknown-linux-gnu/release, so.. it will fails at line 105

@alerque
Copy link
Contributor

alerque commented Feb 17, 2025

(Not the maintainer here, just another user that has run into similar issues.)

Cargo is actively resistant to providing a discovery mechanism that a build wrapper can use to discover where Cargo is putting stuff. They really want to be the highest level build system and not be integrated into higher level ones like this. There are several long running issues/PRs/RFCs related to this. There is a little bit of progress lately, but there still isn't a good mechanism for this.

In the mean time you can set the location manually by changing the --target-dir option at build time, or even target_path in your Rockspec. This can be used to substitute the default project relative ./target for another path. For the cross-compile use case set it to target/<target_tripple>.

The mechanisms I know of to parse this manually would require adding a dependency to read JSON or parsing logs, neither of which appeal to my sensibilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants