Skip to content

When building on Windows w/swiftc, can accidently include both msvc and gcc math.inls. #1155

@jeffdav

Description

@jeffdav

Describe the bug

On Windows, I'm building aws-sdk-swift using CMake. I build aws-c-* using ExternalProject_Add().
(Thank you for providing CMakeLists.txt for your projects!)

The issue is when building aws-sdk-swift, we end up using clang, which causes math.h include both math.msvc.inl and math.gcc_builtin.inl during module import, leading to duplicate symbols.

Expected Behavior

We should only include one or the other.

Current Behavior

We include both.

Reproduction Steps

Build aws-sdk-swift using CMake on Windows. I'm happy to share my CMakeLists.txt for doing this if it is helpful.

Possible Solution

Currently I'm patching:

#if defined(__clang__) || defined(__GNUC__)

To:

#if (defined(__clang__) || defined(__GNUC__)) && !defined(AWS_HAVE_MSVC_INTRINSICS_X64)
#    include <aws/common/math.gcc_builtin.inl>
#endif

I'm not 100% certain this is the most correct, but it works.

Additional Information/Context

No response

aws-c-common version used

commit 6978946 (origin/main, origin/HEAD, main)

Compiler and version used

swiftc: compnerd.org Swift version 6.0-dev (LLVM a527f49f462b0d7, Swift eef85a7be270421), clang: compnerd.org clang version 17.0.6, cl: Microsoft (R) C/C++ Optimizing Compiler Version 19.41.34120 for x64

Operating System and version

Windows 11 23H2

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-for-stalenessfeature-requestA feature should be added or improved.p2This is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to 'closing-soon' in 2 days.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions