Skip to content

AWS_LC_SYS_CFLAGS is ignored when using default ccBuilder #965

@Manciukic

Description

@Manciukic

Problem:

When removing the bindgen feature, we realised that AWS_LC_SYS_CFLAGS="-DMY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX" was no longer getting passed through to the compiler.
Diving deeper, we realised it's because the compilation switched from the cmakeBuilder (where the option works fine), to the ccBuilder.

When compiling with default ccBuilder the AWS_LC_SYS_CFLAGS environment variable is ignored. This is because the env::set_var is called after the cc:Build object has been initialized (there is an internal cache for environment variables that gets populated the first time the get_compiler is called).

A workaround we found is to force using the cmakeBuilder we were using before: AWS_LC_SYS_CMAKE_BUILDER="1"

Relevant details

AWS-LC for Rust versions or commit: tip (93f8b32)

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

  • CPU architecture: x86-64
  • CPU name: 13th Gen Intel(R) Core(TM) i7-1365U
  • OS: Ubuntu 22.04

Build log:
I have added a log line to print the final compiler before the .compile call:

I have set AWS_LC_SYS_CFLAGS="-DMY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX=1", but it doesn't appear in the final compiler:

[aws-lc-sys 0.34.0] cargo:warning=Tool { path: "cc", cc_wrapper_path: None, cc_wrapper_args: [], args: ["-O3", "-ffunction-sections", "-fdata-sections", "-fPIC", "-m64", "-std=c11", "-I", "/home/ANT.AMAZON.COM/mancio/workplace/aws-lc-rs/aws-lc-sys/generated-include", "-I", "/home/ANT.AMAZON.COM/mancio/workplace/aws-lc-rs/aws-lc-sys/include", "-I", "/home/ANT.AMAZON.COM/mancio/workplace/aws-lc-rs/aws-lc-sys/aws-lc/include", "-I", "/home/ANT.AMAZON.COM/mancio/workplace/aws-lc-rs/aws-lc-sys/aws-lc/third_party/s2n-bignum/include", "-I", "/home/ANT.AMAZON.COM/mancio/workplace/aws-lc-rs/aws-lc-sys/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/include", "-Wno-unused-parameter", "-pthread", "-ffile-prefix-map=/home/ANT.AMAZON.COM/mancio/workplace/aws-lc-rs/aws-lc-sys=", "-D_XOPEN_SOURCE=700", "-DDISABLE_CPU_JITTER_ENTROPY=1", "-DBORINGSSL_IMPLEMENTATION=1", "-DBORINGSSL_PREFIX=aws_lc_0_34_0", "-DAWS_LC_STDALIGN_AVAILABLE=1", "-DAWS_LC_BUILTIN_SWAP_SUPPORTED=1", "-DHAVE_LINUX_RANDOM_H=1"], env: [("LC_ALL", "C")], family: Gnu, cuda: false, removed_args: [], has_internal_target_arg: false }

If I set CFLAGS="-DMY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX=1" then it appears, showing it's an issue on how the AWS_LC_SYS_CFLAGS env var is handled:

[aws-lc-sys 0.34.0] cargo:warning=Tool { path: "cc", cc_wrapper_path: None, cc_wrapper_args: [], args: ["-O3", "-ffunction-sections", "-fdata-sections", "-fPIC", "-m64", "-std=c11", "-I", "/home/ANT.AMAZON.COM/mancio/workplace/aws-lc-rs/aws-lc-sys/generated-include", "-I", "/home/ANT.AMAZON.COM/mancio/workplace/aws-lc-rs/aws-lc-sys/include", "-I", "/home/ANT.AMAZON.COM/mancio/workplace/aws-lc-rs/aws-lc-sys/aws-lc/include", "-I", "/home/ANT.AMAZON.COM/mancio/workplace/aws-lc-rs/aws-lc-sys/aws-lc/third_party/s2n-bignum/include", "-I", "/home/ANT.AMAZON.COM/mancio/workplace/aws-lc-rs/aws-lc-sys/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/include", "-Wno-unused-parameter", "-pthread", "-ffile-prefix-map=/home/ANT.AMAZON.COM/mancio/workplace/aws-lc-rs/aws-lc-sys=", "-D_XOPEN_SOURCE=700", "-DDISABLE_CPU_JITTER_ENTROPY=1", "-DBORINGSSL_IMPLEMENTATION=1", "-DBORINGSSL_PREFIX=aws_lc_0_34_0", "-DAWS_LC_STDALIGN_AVAILABLE=1", "-DAWS_LC_BUILTIN_SWAP_SUPPORTED=1", "-DHAVE_LINUX_RANDOM_H=1", "-DMY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX=1"], env: [("LC_ALL", "C")], family: Gnu, cuda: false, removed_args: [], has_internal_target_arg: false }

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