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 build for target x86_64-pc-windows-gnu failed #413

Closed
zonyitoo opened this issue Apr 27, 2024 · 6 comments · Fixed by #414
Closed

Cross build for target x86_64-pc-windows-gnu failed #413

zonyitoo opened this issue Apr 27, 2024 · 6 comments · Fixed by #414
Assignees
Labels
build problem Build failure

Comments

@zonyitoo
Copy link

zonyitoo commented Apr 27, 2024

Problem:

Trying to cross build from Linux host with cross:

$ cargo new repro
$ cd repro
$ echo '[target.x86_64-pc-windows-gnu]
pre-build = [
    "apt-get update",
    "apt-get install --assume-yes nasm",
]' > Cross.toml
$ cross build --target "x86_64-pc-windows-gnu"

Relevant details

aws-lc-sys v0.15.0 (on crates.io).

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

  • CPU architecture: x86_64
  • CPU name: Intel Core i7
  • OS: macOS

Build log:

  • Build without "bindgen" in Cargo.toml
$ cross build --target "x86_64-pc-windows-gnu"
   Compiling libc v0.2.153
   Compiling once_cell v1.19.0
   Compiling fs_extra v1.3.0
   Compiling dunce v1.0.4
   Compiling paste v1.0.14
   Compiling aws-lc-rs v1.7.0
   Compiling untrusted v0.7.1
   Compiling mirai-annotations v1.12.0
   Compiling zeroize v1.7.0
   Compiling jobserver v0.1.31
   Compiling cc v1.0.95
   Compiling cmake v0.1.50
   Compiling aws-lc-sys v0.15.0
error: failed to run custom build command for `aws-lc-sys v0.15.0`

Caused by:
  process didn't exit successfully: `/target/debug/build/aws-lc-sys-ff13cb9381e767cd/build-script-main` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=AWS_LC_SYS_INTERNAL_NO_PREFIX
  cargo:rerun-if-env-changed=AWS_LC_RUST_INTERNAL_BINDGEN
  cargo:rerun-if-env-changed=AWS_LC_SYS_CMAKE_BUILDER
  cargo:rerun-if-env-changed=AWS_LC_SYS_STATIC

  --- stderr
  thread 'main' panicked at /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/builder/main.rs:401:5:
  aws-lc-sys build failed. Please enable the 'bindgen' feature on aws-lc-rs or aws-lc-sys.For more information, see the aws-lc-rs User Guide: https://aws.github.io/aws-lc-rs/index.html
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  • Build with "bindgen" in Cargo.toml
   Compiling libc v0.2.153
   Compiling proc-macro2 v1.0.81
   Compiling unicode-ident v1.0.12
   Compiling glob v0.3.1
   Compiling rustix v0.38.34
   Compiling prettyplease v0.2.19
   Compiling linux-raw-sys v0.4.13
   Compiling bitflags v2.5.0
   Compiling regex-syntax v0.8.3
   Compiling cfg-if v1.0.0
   Compiling either v1.11.0
   Compiling minimal-lexical v0.2.1
   Compiling memchr v2.7.2
   Compiling libloading v0.8.3
   Compiling bindgen v0.69.4
   Compiling home v0.5.9
   Compiling itertools v0.12.1
   Compiling log v0.4.21
   Compiling rustc-hash v1.1.0
   Compiling clang-sys v1.7.0
   Compiling jobserver v0.1.31
   Compiling shlex v1.3.0
   Compiling nom v7.1.3
   Compiling lazy_static v1.4.0
   Compiling lazycell v1.3.0
   Compiling paste v1.0.14
   Compiling aws-lc-rs v1.7.0
   Compiling regex-automata v0.4.6
   Compiling cc v1.0.95
   Compiling cmake v0.1.50
   Compiling cexpr v0.6.0
   Compiling regex v1.10.4
   Compiling quote v1.0.36
   Compiling which v4.4.2
   Compiling syn v2.0.60
   Compiling aws-lc-sys v0.15.0
error: failed to run custom build command for `aws-lc-sys v0.15.0`

Caused by:
  process didn't exit successfully: `/target/debug/build/aws-lc-sys-c43836429621d40f/build-script-main` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=AWS_LC_SYS_INTERNAL_NO_PREFIX
  cargo:rerun-if-env-changed=AWS_LC_RUST_INTERNAL_BINDGEN
  cargo:rerun-if-env-changed=AWS_LC_SYS_CMAKE_BUILDER
  cargo:rerun-if-env-changed=AWS_LC_SYS_STATIC
  cargo:rerun-if-env-changed=AWS_LC_SYS_INCLUDES

  --- stderr
  /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/mem.h:174:5: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/mem.h:178:48: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/mem.h:184:5: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/mem.h:189:5: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/err.h:474:5: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/bio.h:351:5: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/digest.h:60:10: fatal error: 'stdbool.h' file not found
  clang diag: /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/mem.h:174:5: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  clang diag: /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/mem.h:178:48: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  clang diag: /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/mem.h:184:5: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  clang diag: /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/mem.h:189:5: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  clang diag: /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/err.h:474:5: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  clang diag: /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/bio.h:351:5: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  thread 'main' panicked at /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/builder/bindgen.rs:155:10:
  Unable to generate bindings.: ClangDiagnostic("/cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/digest.h:60:10: fatal error: 'stdbool.h' file not found\n")
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@zonyitoo zonyitoo reopened this Apr 27, 2024
@zonyitoo
Copy link
Author

It looks like the key issue is:

  /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/digest.h:60:10: fatal error: 'stdbool.h' file not found

Why was it not found in this build environment? Shouldn't stdbool.h always be available for any C compilers?

@zonyitoo
Copy link
Author

After installing clang by apt-get install clang in the container, build was able to continue, but still failed with the following messages:

   Compiling proc-macro2 v1.0.81
   Compiling rustix v0.38.34
   Compiling prettyplease v0.2.19
   Compiling clang-sys v1.7.0
   Compiling bindgen v0.69.4
   Compiling quote v1.0.36
   Compiling syn v2.0.60
   Compiling which v4.4.2
   Compiling aws-lc-sys v0.15.0
error: failed to run custom build command for `aws-lc-sys v0.15.0`

Caused by:
  process didn't exit successfully: `/target/debug/build/aws-lc-sys-c43836429621d40f/build-script-main` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=AWS_LC_SYS_INTERNAL_NO_PREFIX
  cargo:rerun-if-env-changed=AWS_LC_RUST_INTERNAL_BINDGEN
  cargo:rerun-if-env-changed=AWS_LC_SYS_CMAKE_BUILDER
  cargo:rerun-if-env-changed=AWS_LC_SYS_STATIC
  cargo:rerun-if-env-changed=AWS_LC_SYS_INCLUDES
  cargo:rustc-cfg=use_bindgen_generated
  cargo:rerun-if-env-changed=AWS_LC_SYS_STATIC
  CMAKE_TOOLCHAIN_FILE_x86_64-pc-windows-gnu = None
  CMAKE_TOOLCHAIN_FILE_x86_64_pc_windows_gnu = None
  TARGET_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-pc-windows-gnu = None
  CMAKE_GENERATOR_x86_64_pc_windows_gnu = None
  TARGET_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-pc-windows-gnu = None
  CMAKE_PREFIX_PATH_x86_64_pc_windows_gnu = None
  TARGET_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-pc-windows-gnu = None
  CMAKE_x86_64_pc_windows_gnu = None
  TARGET_CMAKE = None
  CMAKE = Some("cmake")
  running: cd "/target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-6eb105538bbd3bf5/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0" "-DBUILD_SHARED_LIBS=0" "-DCMAKE_BUILD_TYPE=debug" "-DBORINGSSL_PREFIX=aws_lc_0_15_0_" "-DBORINGSSL_PREFIX_HEADERS=/cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/generated-include" "-DBUILD_TESTING=OFF" "-DBUILD_LIBSSL=OFF" "-DDISABLE_PERL=ON" "-DDISABLE_GO=ON" "-DCMAKE_SYSTEM_NAME=Windows" "-DCMAKE_SYSTEM_PROCESSOR=AMD64" "-DCMAKE_INSTALL_PREFIX=/target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-6eb105538bbd3bf5/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_C_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc-posix" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/x86_64-w64-mingw32-g++-posix" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_ASM_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc-posix" "--no-warn-unused-cli"
  Not searching for unused variables given on the command line.
  -- The C compiler identification is GNU 7.3.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc-posix - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Go not found. Disabling some code generation and using pre-generated code in generated-src/
  -- Perl not found. Disabling some code generation and using pre-generated code in generated-src/
  -- stdalign_check.c probe is positive, enabling AWS_LC_STDALIGN_AVAILABLE
  -- builtin_swap_check.c probe is positive, enabling AWS_LC_BUILTIN_SWAP_SUPPORTED
  -- The ASM_NASM compiler identification is NASM
  -- Found assembler: /usr/bin/nasm
  -- Looking for pthread.h
  -- Looking for pthread.h - found
  -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
  -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
  -- Found Threads: TRUE
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-6eb105538bbd3bf5/out/build
  running: cd "/target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-6eb105538bbd3bf5/out/build" && MAKEFLAGS="-j --jobserver-fds=7,8 --jobserver-auth=7,8" "cmake" "--build" "." "--target" "install" "--config" "Debug"
  [  0%] Built target boringssl_prefix_symbols
  [  1%] Building C object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/bcm.c.obj
  [  2%] Building ASM_NASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-xts-avx512.asm.obj
  [  2%] Building C object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/fips_shared_support.c.obj
  [  2%] Building C object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/cpucap/cpucap.c.obj
  [  2%] Building ASM_NASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/ghash-ssse3-x86_64.asm.obj
  [  2%] Building ASM_NASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-gcm-x86_64.asm.obj
  [  3%] Building ASM_NASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/ghash-x86_64.asm.obj
  [  3%] Building ASM_NASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-x86_64.asm.obj
  [  3%] Building ASM_NASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p256-x86_64-asm.asm.obj
  [  4%] Building ASM_NASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-gcm-avx512.asm.obj
  [  4%] Building ASM_NASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/md5-x86_64.asm.obj
  aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:132: recipe for target 'aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-xts-avx512.asm.obj' failed
  [  4%] Building C object aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_bitstr.c.obj
  aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:138: recipe for target 'aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-x86_64.asm.obj' failed
  aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:144: recipe for target 'aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/ghash-ssse3-x86_64.asm.obj' failed
  aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:126: recipe for target 'aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-gcm-x86_64.asm.obj' failed
  aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:150: recipe for target 'aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/ghash-x86_64.asm.obj' failed
  aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:120: recipe for target 'aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-gcm-avx512.asm.obj' failed
  aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:156: recipe for target 'aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/md5-x86_64.asm.obj' failed
  aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:162: recipe for target 'aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p256-x86_64-asm.asm.obj' failed
  [  5%] Building C object aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_bool.c.obj
  [  5%] Building C object aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_d2i_fp.c.obj
  [  6%] Building C object aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_gentm.c.obj
  [  6%] Building C object aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_dup.c.obj
  [  6%] Building C object aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_i2d_fp.c.obj
  [  6%] Building C object aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_int.c.obj
  [  6%] Building C object aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_object.c.obj
  [  7%] Building C object aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_mbstr.c.obj
  [  7%] Building C object aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_strex.c.obj
  [  8%] Building C object aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_octet.c.obj
  [  8%] Building C object aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_strnid.c.obj
  aws-lc/crypto/CMakeFiles/crypto_objects.dir/build.make:181: recipe for target 'aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_mbstr.c.obj' failed
  [  9%] Building C object aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_time.c.obj
  [  9%] Building C object aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_utctm.c.obj
  [  9%] Building C object aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_type.c.obj
  CMakeFiles/Makefile2:203: recipe for target 'aws-lc/crypto/CMakeFiles/crypto_objects.dir/all' failed
  CMakeFiles/Makefile2:257: recipe for target 'aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/all' failed
  Makefile:135: recipe for target 'all' failed

  --- stderr
  clang diag: /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/mem.h:174:5: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  clang diag: /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/mem.h:178:48: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  clang diag: /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/mem.h:184:5: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  clang diag: /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/mem.h:189:5: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  clang diag: /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/err.h:474:5: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  clang diag: /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/include/openssl/bio.h:351:5: warning: '__format__' attribute argument not supported: ms_printf [-Wignored-attributes]
  Copying platform assembly files from /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/generated-src/win-x86_64/crypto/ to /target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-6eb105538bbd3bf5/out/build/aws-lc/crypto
  /target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-6eb105538bbd3bf5/out/build/aws-lc/crypto/fipsmodule/aesni-xts-avx512.asm:10: fatal: unable to open include file `openssl/boringssl_prefix_symbols_nasm.inc'
  make[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-xts-avx512.asm.obj] Error 1
  make[2]: *** Waiting for unfinished jobs....
  /target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-6eb105538bbd3bf5/out/build/aws-lc/crypto/fipsmodule/aesni-x86_64.asm:10: fatal: unable to open include file `openssl/boringssl_prefix_symbols_nasm.inc'
  make[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-x86_64.asm.obj] Error 1
  /target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-6eb105538bbd3bf5/out/build/aws-lc/crypto/fipsmodule/ghash-ssse3-x86_64.asm:10: fatal: unable to open include file `openssl/boringssl_prefix_symbols_nasm.inc'
  make[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/ghash-ssse3-x86_64.asm.obj] Error 1
  /target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-6eb105538bbd3bf5/out/build/aws-lc/crypto/fipsmodule/aesni-gcm-x86_64.asm:10: fatal: unable to open include file `openssl/boringssl_prefix_symbols_nasm.inc'
  make[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-gcm-x86_64.asm.obj] Error 1
  /target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-6eb105538bbd3bf5/out/build/aws-lc/crypto/fipsmodule/ghash-x86_64.asm:10: fatal: unable to open include file `openssl/boringssl_prefix_symbols_nasm.inc'
  make[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/ghash-x86_64.asm.obj] Error 1
  /target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-6eb105538bbd3bf5/out/build/aws-lc/crypto/fipsmodule/aesni-gcm-avx512.asm:10: fatal: unable to open include file `openssl/boringssl_prefix_symbols_nasm.inc'
  make[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-gcm-avx512.asm.obj] Error 1
  /target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-6eb105538bbd3bf5/out/build/aws-lc/crypto/fipsmodule/md5-x86_64.asm:10: fatal: unable to open include file `openssl/boringssl_prefix_symbols_nasm.inc'
  make[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/md5-x86_64.asm.obj] Error 1
  /target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-6eb105538bbd3bf5/out/build/aws-lc/crypto/fipsmodule/p256-x86_64-asm.asm:10: fatal: unable to open include file `openssl/boringssl_prefix_symbols_nasm.inc'
  make[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p256-x86_64-asm.asm.obj] Error 1
  /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/crypto/asn1/a_mbstr.c: In function 'aws_lc_0_15_0_ASN1_mbstring_ncopy':
  /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/crypto/asn1/a_mbstr.c:168:37: error: unknown conversion type character 'z' in format [-Werror=format=]
         ERR_add_error_dataf("maxsize=%zu", (size_t)maxsize);
                                       ^
  /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/crypto/asn1/a_mbstr.c:168:27: error: too many arguments for format [-Werror=format-extra-args]
         ERR_add_error_dataf("maxsize=%zu", (size_t)maxsize);
                             ^~~~~~~~~~~~~
  /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/crypto/asn1/a_mbstr.c:175:35: error: unknown conversion type character 'z' in format [-Werror=format=]
       ERR_add_error_dataf("minsize=%zu", (size_t)minsize);
                                     ^
  /cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/aws-lc/crypto/asn1/a_mbstr.c:175:25: error: too many arguments for format [-Werror=format-extra-args]
       ERR_add_error_dataf("minsize=%zu", (size_t)minsize);
                           ^~~~~~~~~~~~~
  cc1: all warnings being treated as errors
  make[2]: *** [aws-lc/crypto/CMakeFiles/crypto_objects.dir/asn1/a_mbstr.c.obj] Error 1
  make[2]: *** Waiting for unfinished jobs....
  make[1]: *** [aws-lc/crypto/CMakeFiles/crypto_objects.dir/all] Error 2
  make[1]: *** Waiting for unfinished jobs....
  make[1]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/all] Error 2
  make: *** [all] Error 2
  thread 'main' panicked at /cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5:

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

  build script failed, must exit now
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@justsmth justsmth self-assigned this Apr 29, 2024
@justsmth justsmth added the build problem Build failure label Apr 29, 2024
@justsmth
Copy link
Contributor

Thanks for reporting this build failure. I am able to reproduce it locally.

I'm working on diagnosing it now.

@justsmth
Copy link
Contributor

This appears to be related to this issue: https://stackoverflow.com/questions/44382862/how-to-printf-a-size-t-without-warning-in-mingw-w64-gcc-7-1

justsmth added a commit to aws/aws-lc that referenced this issue Apr 29, 2024
### Issues:
* aws/aws-lc-rs#413

### Description of changes: 
* Some versions of MinGW complain about use of `z` in a format
specification:
https://stackoverflow.com/questions/44382862/how-to-printf-a-size-t-without-warning-in-mingw-w64-gcc-7-1
* This problem relates to a claim that the Windows C-Runtime ("msvcrt")
only supports C89 format strings. However, this appears to have been
addressed by (or before) MSVC 2015:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-140#size-prefixes-for-printf-and-wprintf-format-type-specifiers

### Testing:
With this change I was able to successfully cross-compile to
x86_64-pc-windows-gnu:
```
❯ cross build -p aws-lc-rs --features bindgen --target x86_64-pc-windows-gnu
...
   Compiling aws-lc-sys v0.16.0 (/Users/justsmth/repos/aws-lc-rs/aws-lc-sys)
warning: aws-lc-sys@0.16.0: Generating bindings - internal bindgen. Platform: x86_64-pc-windows-gnu
   Compiling aws-lc-rs v1.7.1 (/Users/justsmth/repos/aws-lc-rs/aws-lc-rs)
    Finished dev [unoptimized + debuginfo] target(s) in 29.94s
```

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and the ISC license.
@justsmth
Copy link
Contributor

justsmth commented May 3, 2024

As of our v1.7.1 release, the cross build for x86_64-pc-windows-gnu should succeed. Although, I'm still investigating a runtime linking error that arises when attempting to run our tests for the x86_64-pc-windows-gnu platform via cross-rs.

@justsmth
Copy link
Contributor

justsmth commented May 6, 2024

I fixed the runtime issue by using the latest version of Wine (9.0) into the container: https://github.com/aws/aws-lc-rs/actions/runs/8971663108/job/24637916198. See PR: #414.

Please let us know about any other build issues you find. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build problem Build failure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants