Skip to content

Compilation failure with Clang on Windows #1031

@aminya

Description

@aminya

Problem:

When building with Clang on Windows, the compilation first fails with the following error

  exit code: 1
  cargo:warning=ToolExecError: command did not execute successfully (status code exit code: 1): "C:/ProgramData/chocolatey/bin/sccache.exe" "C:\\Users\\aminya\\llvm/bin/clang.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "--target=x86_64-pc-windows-msvc" "-I" "O:\\GitHub\\aws-lc-rs\\aws-lc-sys\\generated-include" "-I" "O:\\GitHub\\aws-lc-rs\\aws-lc-sys\\include" "-I" "O:\\GitHub\\aws-lc-rs\\aws-lc-sys\\aws-lc\\include" "-I" "O:\\GitHub\\aws-lc-rs\\aws-lc-sys\\aws-lc\\third_party\\s2n-bignum\\include" "-I" "O:\\GitHub\\aws-lc-rs\\aws-lc-sys\\aws-lc\\third_party\\s2n-bignum\\s2n-bignum-imported\\include" "-I" "O:\\GitHub\\aws-lc-rs\\aws-lc-sys\\aws-lc\\third_party\\jitterentropy\\jitterentropy-library" "-Wall" "-Wextra" "-fwrapv" "--param" "ssp-buffer-size=4" "-fvisibility=hidden" "-Wcast-align" "-Wmissing-field-initializers" "-Wshadow" "-Wswitch-enum" "-Wextra" "-Wall" "-pedantic" "-O0" "-fwrapv" "-Wconversion" "--include=O:\\GitHub\\aws-lc-rs\\aws-lc-sys\\generated-include\\openssl\\boringssl_prefix_symbols.h" "-DBORINGSSL_IMPLEMENTATION=1" "-DBORINGSSL_PREFIX=aws_lc_0_37_0" "-DWIN32_LEAN_AND_MEAN=" "-DNOMINMAX=" "-DAWSLC=1" "-o" "O:\\GitHub\\aws-lc-rs\\target\\debug\\build\\aws-lc-sys-6f422e044d29205d\\out\\307a1cf338c197ca-jitterentropy-gcd.o" "-c" "O:\\GitHub\\aws-lc-rs\\aws-lc-sys\\aws-lc\\third_party/jitterentropy/jitterentropy-library/src/jitterentropy-gcd.c"cargo:warning=clang: error: unsupported option '-fPIC' for target 'x86_64-pc-windows-msvc'
  cargo:warning=clang: error: unsupported option '-fPIC' for target 'x86_64-pc-windows-msvc'

If that is fixed, then the following upstream error happens

aws/aws-lc#2981

FAILED: aws-lc/crypto/fipsmodule/bcm.o O:/GitHub/aws-lc-rs/target/debug/build/aws-lc-fips-sys-dc904e8765dea6e9/out/build/aws-lc/crypto/fipsmodule/bcm.o 
C:\Windows\System32\cmd.exe /C "cd /D O:\GitHub\aws-lc-rs\target\debug\build\aws-lc-fips-sys-dc904e8765dea6e9\out\build\aws-lc\crypto\fipsmodule && C:\Users\aminya\llvm\bin\lld-link.exe -r -T O:/GitHub/aws-lc-rs/aws-lc-fips-sys/aws-lc/crypto/fipsmodule/fips_shared.lds -o bcm.o --whole-archive O:/GitHub/aws-lc-rs/target/debug/build/aws-lc-fips-sys-dc904e8765dea6e9/out/build/aws-lc/crypto/fipsmodule/bcm_library.lib"
lld-link: warning: ignoring unknown argument '-r'
lld-link: warning: ignoring unknown argument '-T'
lld-link: warning: ignoring unknown argument '-o'
lld-link: warning: ignoring unknown argument '--whole-archive'
lld-link: error: O:/GitHub/aws-lc-rs/aws-lc-fips-sys/aws-lc/crypto/fipsmodule/fips_shared.lds: unknown file type
lld-link: error: could not open 'bcm.o': no such file or directory
ninja: build stopped: subcommand failed.

Relevant details

AWS-LC-RS commit: 7501783

System information:

  • CPU architecture: x86
  • CPU name: AMD
  • OS: Windows 11

Build log:

  • The log tells compiler and version. It's available when building awslc with CMake.
> cmake "--build" "O:\\GitHub\\aws-lc-rs\\target\\debug\\build\\aws-lc-fips-sys-dc904e8765dea6e9\\out\\build" "--target" "install" "--config" "Debug" "--parallel" "32"

[0/1] Re-running CMake...CMake Deprecation Warning at CMakeLists.txt:10 (cmake_policy):
  The OLD behavior for policy CMP0091 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- Go compiler 1.25.6 found
-- ENABLE_PRE_SONAME_BUILD: ON
-- PERFORM_SONAME_BUILD: 0
-- Entropy source configured: Dynamic (default: CPU Jitter)
-- Prefix build configured: performing build using prefix "aws_lc_fips_0_13_11_" and headers path "O:\GitHub\aws-lc-rs\aws-lc-fips-sys\generated-include"
-- Setting CMAKE_C_STANDARD=11
-- Performing Test HAVE_C_FLAG__Wno_cast_function_type
-- Performing Test HAVE_C_FLAG__Wno_cast_function_type - Success
-- Compiler supports '-Wno-cast-function-type', adding to CMAKE_C_FLAGS
-- Performing Test HAVE_C_FLAG__Wstring_concatenation
-- Performing Test HAVE_C_FLAG__Wstring_concatenation - Success
-- Compiler supports '-Wstring-concatenation', adding to C_CXX_FLAGS
-- Performing Test HAVE_C_FLAG__Wimplicit_fallthrough
-- Performing Test HAVE_C_FLAG__Wimplicit_fallthrough - Success
-- Compiler supports '-Wimplicit-fallthrough', adding to C_CXX_FLAGS
-- linux_random_h.c probe is negative, NOT enabling HAVE_LINUX_RANDOM_H:
-- Use -DFEATURE_PROBE_VERBOSE=ON to view feature probe error output.
-- linux_random_h.c probe is negative, NOT enabling AWS_LC_URANDOM_NEEDS_U32:
-- Use -DFEATURE_PROBE_VERBOSE=ON to view feature probe error output.
-- stdalign_check.c probe is positive, enabling AWS_LC_STDALIGN_AVAILABLE
-- builtin_swap_check.c probe is positive, enabling AWS_LC_BUILTIN_SWAP_SUPPORTED
-- Performing Test HAVE_C_FLAG__Wshadow
-- Performing Test HAVE_C_FLAG__Wshadow - Success
-- Compiler supports '-Wshadow', adding to C_CXX_FLAGS
-- Configuring done (2.0s)
-- Generating done (0.1s)

...

FAILED: aws-lc/crypto/fipsmodule/bcm.o O:/GitHub/aws-lc-rs/target/debug/build/aws-lc-fips-sys-dc904e8765dea6e9/out/build/aws-lc/crypto/fipsmodule/bcm.o 
C:\Windows\System32\cmd.exe /C "cd /D O:\GitHub\aws-lc-rs\target\debug\build\aws-lc-fips-sys-dc904e8765dea6e9\out\build\aws-lc\crypto\fipsmodule && C:\Users\aminya\llvm\bin\lld-link.exe -r -T O:/GitHub/aws-lc-rs/aws-lc-fips-sys/aws-lc/crypto/fipsmodule/fips_shared.lds -o bcm.o --whole-archive O:/GitHub/aws-lc-rs/target/debug/build/aws-lc-fips-sys-dc904e8765dea6e9/out/build/aws-lc/crypto/fipsmodule/bcm_library.lib"
lld-link: warning: ignoring unknown argument '-r'
lld-link: warning: ignoring unknown argument '-T'
lld-link: warning: ignoring unknown argument '-o'
lld-link: warning: ignoring unknown argument '--whole-archive'
lld-link: error: O:/GitHub/aws-lc-rs/aws-lc-fips-sys/aws-lc/crypto/fipsmodule/fips_shared.lds: unknown file type
lld-link: error: could not open 'bcm.o': no such file or directory
ninja: build stopped: subcommand failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions