aws / aws-lc-rs

aws-lc-rs is a cryptographic library using AWS-LC for its cryptographic operations. The library strives to be API-compatible with the popular Rust library named ring.
Other
318 stars 49 forks source link

Many warnings from cmake and can't build with `cc1.exe: all warnings being treated as errors` #425

Closed eitsupi closed 5 months ago

eitsupi commented 6 months ago

Problem:

I could not successfully build a package that has this crate as a dependency. Perhaps there is something wrong with the way I have it set up?

Relevant details

aws-lc-sys@0.17.0

System information: for linux, below info can be collected by running uname -srvmp

Build log:

https://github.com/eitsupi/r-glaredb/actions/runs/9234681710/job/25408657673?pr=18#step:11:1086

  make[1]: Leaving directory '/d/a/r-glaredb/r-glaredb/src/rust/target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-0c92a44fbc815c4b/out/build'

  --- stderr
  CMake Deprecation Warning at CMakeLists.txt:4 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.

  CMake Deprecation Warning at aws-lc/CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.

  Copying platform assembly files from C:/Users/runneradmin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.17.0/aws-lc/generated-src/win-x86_64/crypto/ to D:/a/r-glaredb/r-glaredb/src/rust/target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-0c92a44fbc815c4b/out/build/aws-lc/crypto
  In file included from C:/Users/runneradmin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.17.0/aws-lc/crypto/fipsmodule/bcm.c:116:
  C:/Users/runneradmin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.17.0/aws-lc/crypto/fipsmodule/hmac/hmac.c:111:50: error: ISO C does not allow extra ';' outside of a function [-Werror=pedantic]
    111 | MD_TRAMPOLINES_EXPLICIT(MD5, MD5_CTX, MD5_CBLOCK);
        |                                                  ^
  C:/Users/runneradmin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.17.0/aws-lc/crypto/fipsmodule/hmac/hmac.c:112:51: error: ISO C does not allow extra ';' outside of a function [-Werror=pedantic]
    112 | MD_TRAMPOLINES_EXPLICIT(SHA1, SHA_CTX, SHA_CBLOCK);
        |                                                   ^
  C:/Users/runneradmin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.17.0/aws-lc/crypto/fipsmodule/hmac/hmac.c:113:59: error: ISO C does not allow extra ';' outside of a function [-Werror=pedantic]
    113 | MD_TRAMPOLINES_EXPLICIT(SHA224, SHA256_CTX, SHA256_CBLOCK);
        |                                                           ^
  C:/Users/runneradmin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.17.0/aws-lc/crypto/fipsmodule/hmac/hmac.c:114:59: error: ISO C does not allow extra ';' outside of a function [-Werror=pedantic]
    114 | MD_TRAMPOLINES_EXPLICIT(SHA256, SHA256_CTX, SHA256_CBLOCK);
        |                                                           ^
  C:/Users/runneradmin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.17.0/aws-lc/crypto/fipsmodule/hmac/hmac.c:115:59: error: ISO C does not allow extra ';' outside of a function [-Werror=pedantic]
    115 | MD_TRAMPOLINES_EXPLICIT(SHA384, SHA512_CTX, SHA512_CBLOCK);
        |                                                           ^
  C:/Users/runneradmin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.17.0/aws-lc/crypto/fipsmodule/hmac/hmac.c:116:59: error: ISO C does not allow extra ';' outside of a function [-Werror=pedantic]
    116 | MD_TRAMPOLINES_EXPLICIT(SHA512, SHA512_CTX, SHA512_CBLOCK);
        |                                                           ^
  C:/Users/runneradmin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.17.0/aws-lc/crypto/fipsmodule/hmac/hmac.c:117:63: error: ISO C does not allow extra ';' outside of a function [-Werror=pedantic]
    117 | MD_TRAMPOLINES_EXPLICIT(SHA512_224, SHA512_CTX, SHA512_CBLOCK);
        |                                                               ^
  C:/Users/runneradmin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.17.0/aws-lc/crypto/fipsmodule/hmac/hmac.c:118:63: error: ISO C does not allow extra ';' outside of a function [-Werror=pedantic]
    118 | MD_TRAMPOLINES_EXPLICIT(SHA512_256, SHA512_CTX, SHA512_CBLOCK);
        |                                                               ^
  cc1.exe: all warnings being treated as errors
  make[3]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:77: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/bcm.c.obj] Error 1
  make[3]: *** Waiting for unfinished jobs....
  make[2]: *** [CMakeFiles/Makefile2:258: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/all] Error 2
  make[2]: *** Waiting for unfinished jobs....
  D:/a/r-glaredb/r-glaredb/src/rust/target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-0c92a44fbc815c4b/out/build/aws-lc/crypto/err_data.c:1603:5: error: string length '16178' is greater than the length '4095' ISO C99 compilers are required to support [-Werror=overlength-strings]
   1603 |     "";
        |     ^~
  cc1.exe: all warnings being treated as errors
  make[3]: *** [aws-lc/crypto/CMakeFiles/crypto_objects.dir/build.make:1292: aws-lc/crypto/CMakeFiles/crypto_objects.dir/err_data.c.obj] Error 1
  make[3]: *** Waiting for unfinished jobs....
  make[2]: *** [CMakeFiles/Makefile2:204: aws-lc/crypto/CMakeFiles/crypto_objects.dir/all] Error 2
  make[1]: *** [Makefile:136: all] Error 2
  thread 'main' panicked at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\cmake-0.1.50\src\lib.rs:1098:5:

  command did not execute successfully, got: exit code: 2

  build script failed, must exit now
justsmth commented 6 months ago

The is due to the -pedantic flag being passed via CMAKE_C_FLAGS here, but I'm not sure where that's coming from.

I'll try to get these issues cleaned up upstream in AWS-LC.

eitsupi commented 5 months ago

The is due to the -pedantic flag being passed via CMAKE_C_FLAGS here, but I'm not sure where that's coming from.

Thanks for your reply and the fixes!

I think I have been able to suppress the error and work around it for now, but another problem caused it to fail to compile.

   Copying platform assembly files from C:/Users/runneradmin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.17.0/aws-lc/generated-src/win-x86_64/crypto/ to D:/a/r-glaredb/r-glaredb/src/rust/target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-50dad33b9ae93e0d/out/build/aws-lc/crypto
  D:/a/r-glaredb/r-glaredb/src/rust/target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-50dad33b9ae93e0d/out/build/aws-lc/crypto/fipsmodule/aesni-xts-avx512.asm:136: error: undefined symbol `zmm25' (first use)
  D:/a/r-glaredb/r-glaredb/src/rust/target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-50dad33b9ae93e0d/out/build/aws-lc/crypto/fipsmodule/aesni-xts-avx512.asm:136: error:  (Each undefined symbol is reported only once.)

I know this is off-topic, is it worth submitting a new issue?

justsmth commented 5 months ago

Do you have a link to the full output? I believe "zmm25" is related to AVX-512 support, which is supported by NASM v2.11 and later: https://www.nasm.us/xdoc/2.11/html/nasmdocc.html

Is it possible that an older version of NASM is being used?

eitsupi commented 5 months ago

Thanks for your response! The log is here: https://github.com/eitsupi/r-glaredb/actions/runs/9426573806/job/25969635968?pr=34#step:11:1469

Is it possible that an older version of NASM is being used?

It seems NASM version 2.16.01 compiled on Dec 21 2022 is downloaded. https://github.com/eitsupi/r-glaredb/actions/runs/9426573806/job/25969635968?pr=34#step:8:23

Is this a cross compile to x86_64-pc-windows-gnu so something is misconfigured?

justinwsmith commented 5 months ago

The issue is that your build is using YASM instead of NASM as the assembler.

...
  -- The ASM_NASM compiler identification is YASM
  -- Found assembler: C:/rtools44/x86_64-w64-mingw32.static.posix/bin/yasm.exe
...

YASM appears to be an abandoned rewrite of NASM that's not had a release since August of 2014 -- around the time NASM 2.11 released. I'm not sure how it's being installed or why it's being found instead of NASM.

eitsupi commented 5 months ago

The issue is that your build is using YASM instead of NASM as the assembler.

...
  -- The ASM_NASM compiler identification is YASM
  -- Found assembler: C:/rtools44/x86_64-w64-mingw32.static.posix/bin/yasm.exe
...

YASM appears to be an abandoned rewrite of NASM that's not had a release since August of 2014 -- around the time NASM 2.11 released. I'm not sure how it's being installed or why it's being found instead of NASM.

Thanks for pointing out that!

YASM seems to have been updated even recently, and the rtools used here (based on msys2) seem to include both NASM and YASM; I don't know why YASM was preferred over NASM. https://packages.msys2.org/package/yasm https://svn.r-project.org/R-dev-web/trunk/WindowsBuilds/winutf8/ucrt3/toolchain_libs/mxe/src/

justsmth commented 5 months ago

I posted a PR upstream to help address this issue.

eitsupi commented 5 months ago

Thanks for taking a look at this, I checked rtools44 and found that I was wrong and that yasm is included but nasm is not. It appears that I probably need to install additional nasm at this point.

image

justsmth commented 5 months ago

Our patches to address this issue have been released in v1.7.3. Let us know if you have any other build issues. Thanks!

eitsupi commented 5 months ago

Thanks for quick updates! I will try.