-
Notifications
You must be signed in to change notification settings - Fork 389
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
how to build for powerpc openwrt musl libc 1.2.3 device featuring e500v1 core ? #1363
Comments
commenting out the
makes this release build command work too:
and results in a 321kb big binary:
Running that binary on my openwrt router sadly doesn't print "hello world" as expected, but instead:
I guess that's because it's looking for the first while we only have the second on device:
|
ohhh, but it actually is compatible! running
makes my binary print the expected output!
|
@Emilgardis Can you help me translate our success into something I can put into a |
also, will this solution blow up as soon as I do anything that uses float-point operations? since my musl-libc is actually soft-float but the compiler seems to think we have hardware-float? Can you make the second = soft-float image public so I can use that one instead? Also can you merge what we managed to do into the regular cross-rs infrastructure? |
Awesome! Cross works by running in/starting a container, so unfortunately container in container is needed. If you want you can skip cross and just emulate what cross does but without cross. Shouldn't be too hard, just copy the dockerfile I've made and supply all the needed files and use that as the base image for the runner, then also install rustup and you should be all good :) If you do want to use cross for Gitlab Runners, recommended usage is via |
also, could you try adding a float operation to the binary, interested if the device actually can do hard floats. something like
|
no, doesn't seem like it can:
running in dev environment this instead prints:
I will have a look at https://github.com/cross-rs/cross/wiki/FAQ#gitlab-ci tomorrow and see if I can make that work, thanks for your great support, you're amazing :) gotta get some sleep now. |
Okey, so I don't think what's described at https://github.com/cross-rs/cross/wiki/FAQ#gitlab-ci can work for me, since I'm not hosting a gitlab instance myself but just using the public gitlab.com instance which includes 400 free CI minutes myself - but I don't think (or know how) I can access a docker host from there like described at I'm considering using github instead, but the section about github says it need's to be reworked because actions-rs is unmaintained. |
You should be able to use So, for only using softfloat, you can do Another thing you could do is use a custom target, this way you don't have to specify any rustflags via env. #Cross.toml
[target."powerpc-unknown-linux-muslsf.json"]
image = "ghcr.io/emilgardis/powerpc-unknown-linux-muslsf-cross:test"
build-std = true # powerpc-unknown-linux-muslsf.json
{
"arch": "powerpc",
"crt-objects-fallback": "musl",
"crt-static-default": false,
"crt-static-respected": true,
"data-layout": "E-m:e-p:32:32-Fn32-i64:64-n32",
"dynamic-linking": true,
"env": "musl",
"has-rpath": true,
"has-thread-local": true,
"linker-flavor": "gnu-cc",
"llvm-target": "powerpc-unknown-linux-musl",
"max-atomic-width": 32,
"os": "linux",
"position-independent-executables": true,
"pre-link-args": {
"gnu-cc": [
"-m32"
],
"gnu-lld-cc": [
"-m32"
]
},
"relro-level": "full",
"stack-probes": {
"kind": "inline"
},
"supported-split-debuginfo": [
"packed",
"unpacked",
"off"
],
"target-endian": "big",
"target-family": [
"unix"
],
"target-mcount": "_mcount",
"target-pointer-width": "32",
"features": "-hard-float"
}
|
looking further into the MPC8540, you might be fine with SPE. this comment is a bit concerning though
#Cross.toml
[target."powerpc-unknown-linux-muslspe.json"]
image = "ghcr.io/emilgardis/powerpc-unknown-linux-muslsf-cross:test"
build-std = true # powerpc-unknown-linux-muslspe.json
{
"arch": "powerpc",
"crt-objects-fallback": "musl",
"crt-static-default": false,
"crt-static-respected": true,
"data-layout": "E-m:e-p:32:32-i64:64-n32",
"dynamic-linking": true,
"env": "musl",
"has-rpath": true,
"has-thread-local": true,
"linker-flavor": "gnu-cc",
"llvm-target": "powerpc-unknown-linux-muslspe",
"max-atomic-width": 32,
"os": "linux",
"position-independent-executables": true,
"pre-link-args": {
"gnu-cc": [
"-m32 -mspe"
],
"gnu-lld-cc": [
"-m32 -mspe"
]
},
"relro-level": "full",
"stack-probes": {
"kind": "inline"
},
"supported-split-debuginfo": [
"packed",
"unpacked",
"off"
],
"target-endian": "big",
"target-family": [
"unix"
],
"target-mcount": "_mcount",
"target-pointer-width": "32",
"features": "-fpu,+spe"
} |
hmm, something with that custom target json didn't work as hoped:
|
and the spe version fails like this:
|
okey so the binary resulting from this command:
gives good float output:
even though it does output this warning during building:
|
that warning is what I'm discussing in rust-lang/rust#117347 for the i'm not certain what the envvar would be called but you can set the linker in should be |
I've tried putting those two into
But it didn't change the output of btw. huge thanks for helping me with this! :) |
Also, since you said using |
we have a generic image https://github.com/cross-rs/cross/pkgs/container/cross |
thanks! is there also one with rust nightly pre-installed?
|
no wouldn't make sense to install nightly in the images since they are "nightly" install nightly with |
also, can you answer my question in rust-lang/rust#117347 (comment) please :3 |
Okey, I did, but now get this strange error:
|
that's #1351, im still not sure why it happens since it has worked for a while before |
okey, thanks for showing me the connection! Can you help me get the json based build definition files working?
And for the
|
the however, I'm not sure about the naming of the env-vars with .json targets, I think I remember something about cargo not supporting them for the spe version, same story |
For the last few weeks with the help of @Emilgardis I've tried to get rust compiled for my powerpc openwrt device.
TP-Link TL-WDR4900 v1.x
See also: #1349
Currently we're testing those images created by @Emilgardis:
We managed to get the first one of those to produce debug build using:
but since the resulting binary is 15mb big I'd need a release build to actually test if it can run on my device, which failed to build so far:
The text was updated successfully, but these errors were encountered: