-
Notifications
You must be signed in to change notification settings - Fork 481
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
Default curve25519_dalek_bits
on non-standard Rust target / build tooling
#511
Comments
It seems some of these are using a Makefile where simple thing is just to add the environment variable in there. e.g. this is just a matter of education given we've changed this - educational blog coming up I think will suffice here. Will just add some wordding around Makefile Also some people may be using Cross.toml - https://github.com/cross-rs/cross#passing-environment-variables-into-the-build-environment There is passthrough option which people usually use with |
I think picking some default and if possible printing a warning is the way to go. It seems enough people have hit this even in prerelease testing we should do something about it. |
I suspect this may be a cargo / rustc bug - I have a feeling it doesn't allow passing cfg with custom targets. I want to get to bottom of this why even setting the cfg does work as that would mean we have problems setting backend. So if we introduce the environment variables for build:
This would work/around the rustc issue not setting These would be additional where the Even if we hack a default for bits then people would be having problems setting these that is an issue as well we need to address. |
Is there an advantage to using these new variables vs. the |
Does it relay the Vary of using namespace that is affected by a cargo / rustc bug setting them. EDIT: @jcape the PR is up #516 with @ryankurte fix - as indeed that variable works across all the rust versions we support and various configurations. Given the complexity of setting these cfg flags we might just fallback to u32 and print out that warning. EDIT: I just checked that there seems to be no way of doing "warnings" in build scripts 🤷♀️ So it's either hard error or transparently set something the end-user might not have intended to be set. |
FWIW, you can use |
Ah thanks! Think we'll just default to |
Follow-up
Use-Case
a) Non-standard Rust build tooling which doesn't signal
cfg
correctly andb) Custom non-Rust targets which are not known or
c) Situations where the
RUSTENV
was set incorrectly but relied onCurrent
We spit out an error #508 (comment) where we ask the downstream to set the desired
cfg(curve25519_dalek_bits)
This ensures that the downstream is consciously selecting the correct
curve25519_dalek_bits
if the downstream is attempting to use thecfg
to set it and errors out appropriately when the target platform is non-standard Rust target with unknowntarget_pointer_width
Alternative
Set the
cfg(curve25519_dalek_bits)
to32
silently if either thecfg
was not signalled or a custom non-standard Rust target.This would have a downside where it would silently set something else but it would "just work" on other hand but silently.
Potential Improvements
Maybe we could print out a warning ? Do people read warnings ?
Also maybe could add some tests that simulate these error messages.
Document these error messages in README
The text was updated successfully, but these errors were encountered: