Skip to content
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

Cross config for multiple targets? #1244

Open
1 of 2 tasks
VorpalBlade opened this issue Apr 7, 2023 · 3 comments
Open
1 of 2 tasks

Cross config for multiple targets? #1244

VorpalBlade opened this issue Apr 7, 2023 · 3 comments

Comments

@VorpalBlade
Copy link

Checklist

Describe your request

I need to install OpenSSL when cross compiling to other Linux architectures (e.g. ARM, Aarch64, i686). However the documented command in https://github.com/cross-rs/cross/wiki/Recipes#openssl would as far as I understand lead to code duplication.

I can't find anywhere to specify a glob pattern, e.g.:

[target.*-unknown-linux-*]
pre-build = [
    "dpkg --add-architecture $CROSS_DEB_ARCH",
    "apt-get update && apt-get install --assume-yes libssl-dev:$CROSS_DEB_ARCH"
]

(and that specific syntax does not work). Do I really need to duplicate this for every single architecture I want to compile to? Or is there a way to stick to the DRY principle (Don't Repeat Yourself)?

Describe why this would be a good inclusion for cross

If this is not supported, it seems like an obvious feature to avoid repetition (and risk of these lines getting out of sync). All matching sections should be applied (e.g. apply both a *windows* and a *x86_64-pc-windows* section when building for 64-bit windows)

Adding a custom docker image for each architecture, maintaining that, and dealing with CI for it is way outside of my personal project scope as well as outside my expertise. Especially since I plan to use a ready-made GitHub CI action to do this (once I confirm everything works locally).

@Emilgardis
Copy link
Member

Emilgardis commented Apr 7, 2023

Yes!

See https://github.com/cross-rs/cross/wiki/Configuration#build

[build]
pre-build = [
    "dpkg --add-architecture $CROSS_DEB_ARCH",
    "apt-get update && apt-get install --assume-yes libssl-dev:$CROSS_DEB_ARCH"
]

@Emilgardis
Copy link
Member

hmm, I'll actually reopen this, it could maybe be useful to have cfg() and wildcards

so

[target."*linux*"] and target."cfg(feature = "feat").<target>"

@Emilgardis Emilgardis reopened this Apr 7, 2023
@orhun
Copy link

orhun commented Jun 7, 2023

[target."*linux*"] and target."cfg(feature = "feat").<target>"

Having this feature would be really nice.

github-merge-queue bot pushed a commit to fishfolk/jumpy that referenced this issue Jun 7, 2023
Closes #788

Tested here: https://github.com/orhun/FishFight/actions/runs/5204576645 

Unfortunately, `cross` doesn't support wildcard for targets so there is
a bit of code duplication in the config. See
cross-rs/cross#1244
zicklag pushed a commit to zicklag/jumpy that referenced this issue Jun 17, 2023
Closes fishfolk#788

Tested here: https://github.com/orhun/FishFight/actions/runs/5204576645 

Unfortunately, `cross` doesn't support wildcard for targets so there is
a bit of code duplication in the config. See
cross-rs/cross#1244
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants