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

crypto\fipsmodule\aes\aes_nohw.c : fatal error C1056: cannot update the time date stamp field #2415

Closed
davehorner opened this issue Feb 20, 2025 · 7 comments

Comments

@davehorner
Copy link

was just attempting this eventsource_client on windows.

use eventsource_client::Client as EventSourceClient;
use futures::StreamExt;
use std::env;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Get the SSE URL from the environment or default to localhost:3030/sse.
    let url = env::var("SSE_URL").unwrap_or_else(|_| "http://127.0.0.1:3030/sse".to_string());
    println!("Connecting to SSE endpoint at {}", url);

    // Create an EventSource client.
    let client = EventSourceClient::for_url(&url)?;
    let mut stream = client.stream();

    // Listen for events.
    while let Some(event) = stream.next().await {
        match event {
            Ok(ev) => {
                println!("Received event: id = {:?}, data = {:?}", ev.id, ev.data);
            }
            Err(err) => {
                eprintln!("Error receiving event: {}", err);
            }
        }
    }

    Ok(())
}

I get:

   cargo:rerun-if-env-changed=INCLUDE
  INCLUDE = None
  HOST = Some(x86_64-pc-windows-msvc)
  cargo:rerun-if-env-changed=CC_x86_64-pc-windows-msvc
  CC_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CC_x86_64_pc_windows_msvc
  CC_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some(cmpxchg16b,fxsr,lahfsahf,sse,sse2,sse3)
  DEBUG = Some(true)
  cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-msvc
  CFLAGS_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_msvc
  CFLAGS_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  CARGO_ENCODED_RUSTFLAGS = Some(-Aunreachable_code▼-Airrefutable_let_patterns▼-Aunused_assignments▼-Aunused_must_use▼-Adead_code)
  curve25519.c
  aes_nohw.c
  C:\Users\dhorner\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.17.9\crypto\fipsmodule\aes\aes_nohw.c : fatal error C1056: cannot update the time date stamp field in 'c:\working\rust\codepen_genai\ts\servers\sse\sse_example\target\debug\build\ring-6f25180f880a733d\out\3c60697ff6d5dd9e-aes_nohw.o'; error code %u

  --- stderr


  error occurred in cc-rs: Command "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.42.34433\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-Z7" "-Brepro" "-I" "C:\\Users\\dhorner\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\ring-0.17.9\\include" "-I" "C:\\Users\\dhorner\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\ring-0.17.9\\pregenerated" "-W4" "/Gy" "/Zc:wchar_t" "/Zc:forScope" "/Zc:inline" "/Wall" "/wd4127" "/wd4464" "/wd4514" "/wd4710" "/wd4711" "/wd4820" "/wd5045" "-DNDEBUG" "-Foc:\\working\\rust\\codepen_genai\\ts\\servers\\sse\\sse_example\\target\\debug\\build\\ring-6f25180f880a733d\\out\\3c60697ff6d5dd9e-aes_nohw.o" "-c" "C:\\Users\\dhorner\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\ring-0.17.9\\crypto/fipsmodule/aes/aes_nohw.c" with args cl.exe did not execute successfully (status code exit code: 2).

@davehorner
Copy link
Author

davehorner commented Feb 20, 2025

I got a patch working.

I added these two args; I think /Zm may be enough. I did 2000 and that got through some but not all the errors; i threw it to 20000 and it built successfully.

.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.17.9\build.rs

            "/Zm20000",
            "/ZS",

Context in ring’s Build:
In the context of ring’s build (or similar projects), /ZS is added along with /Zm20000 in an effort to change how the compiler processes the source code. The combination of these flags aims to both increase the macro expansion limit and modify certain behaviors (for example, disabling or altering specific optimizations or safety checks) that might otherwise lead to errors like “cannot update the time date stamp field” or similar issues during the build.

Caveats:
Since /ZS is not as widely documented as many other flags, its exact behavior might vary between compiler versions. It’s often used as part of a workaround when standard approaches (such as increasing the macro expansion limit with /Zm) aren’t enough.

For those following along; the sample is junk, use the example from the crate. But it did find an interesting issue on windows with Ring.

@davehorner
Copy link
Author

Ok, I don't know whats going on.

just found that specifying it on the cmd line > 2000 is invalid.

set CL=/Zm25000

makes it work. IDK; I have something I can script to work. lol

@briansmith
Copy link
Owner

Did you try deleting C:\Users\dhorner\.cargo\registry\ and trying again? I wonder if, perhaps, you might have some file permission issues or other filesystem issues with your .cargo/registry, based on the error.

@davehorner
Copy link
Author

davehorner commented Feb 20, 2025

just tried that now. no its really a macro expansion error and adding /Zm will fix it in certain scenarios. I produced working builds with /Zm20000 which is an invalid parameter. it isn't something I can script...its inconsistent.

deleting and doing a clean registry results in the same errors.

clean with no registry.

  aes_nohw.c
ring2\crypto\fipsmodule\aes\aes_nohw.c : fatal error C1056: cannot update the time date stamp field in 'ring2\target\debug\build\ring-4869f007be3b4c54\out\3c60697ff6d5dd9e-aes_nohw.o'; error code %u

adding /Zm2000 we move past that and stick on curve.

ring2\crypto\curve25519\curve25519.c : fatal error C1056: cannot update the time date stamp field in 'ring2\target\debug\build\ring-4869f007be3b4c54\out\73090ba2100ad232-curve25519.o'; error code %u

I do not suspect file permissions.

2000 > is invalid, and going to 20000 fixed it one time. Doing that now from the clean copy; its not working.

@briansmith
Copy link
Owner

Does it happen with ring 0.17.8? Could you find the earliest version it happens with?

@davehorner
Copy link
Author

davehorner commented Feb 20, 2025

if you tell me how to do it for one I can get a script to query and run builds until it works...if you think this is a problem introduced recently.

is there a good way to get a list of the released versions? i don't see tags git tag --list 'v*'

front page
Releases
No releases published

I created this script and went off the versions from crate.io.
https://github.com/davehorner/ring/blob/77c8ab3b537a8c121305a7f22d35ff9f8435f358/mk/test_versions.py

cat build_output_ring_0.17.8_sanitized.txt
    Updating crates.io index
     Locking 40 packages to latest compatible versions
      Adding getrandom v0.2.15 (available: v0.3.1)
      Adding windows-sys v0.52.0 (available: v0.59.0)
   Compiling shlex v1.3.0
   Compiling cfg-if v1.0.0
   Compiling spin v0.9.8
   Compiling untrusted v0.9.0
   Compiling getrandom v0.2.15
   Compiling cc v1.2.14
   Compiling ring v0.17.8 (<CWD>\crates\ring-0.17.8\ring-0.17.8)
warning: unexpected `cfg` condition name: `pregenerate_asm_only`
  --> src\lib.rs:47:12
   |
47 | #![cfg(not(pregenerate_asm_only))]
   |            ^^^^^^^^^^^^^^^^^^^^
   |
   = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
   = help: consider using a Cargo feature instead
   = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
            [lints.rust]
            unexpected_cfgs = { level = "warn", check-cfg = ['cfg(pregenerate_asm_only)'] }
   = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(pregenerate_asm_only)");` to the top of the `build.rs`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
   = note: `#[warn(unexpected_cfgs)]` on by default

warning: `ring` (lib) generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 8.15s
cat build_output_ring_0.17.10-alpha1_sanitized.txt
    Updating crates.io index
     Locking 39 packages to latest compatible versions
      Adding getrandom v0.2.15 (available: v0.3.1)
      Adding windows-sys v0.52.0 (available: v0.59.0)
   Compiling shlex v1.3.0
   Compiling cfg-if v1.0.0
   Compiling untrusted v0.9.0
   Compiling getrandom v0.2.15
   Compiling cc v1.2.14
   Compiling ring v0.17.10-alpha1 (<CWD>\crates\ring-0.17.10-alpha1\ring-0.17.10-alpha1)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 7.31s

that hurts my head. I'm not sure why they are building. doesn't make sense to me.

update:
Ok i added code to test eventsourceclient against the ring crates I tested.
https://github.com/davehorner/ring/blob/test_versions/mk/test_versions.py

build_output_eventsource_client_0.17.8_sanitized.txt
build_output_eventsource_client_0.17.10-alpha1_sanitized.txt
build_output_ring_0.17.8_sanitized.txt
build_output_ring_0.17.10-alpha1_sanitized.txt

they are building. what the?!

the problem persists in my project thats consuming eventsource_client. i don't understand what's different.

@briansmith briansmith closed this as not planned Won't fix, can't repro, duplicate, stale Feb 25, 2025
@davehorner
Copy link
Author

thanks for closing; I don't know what is going on but its environmental. have a good day.

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

Successfully merging a pull request may close this issue.

2 participants