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

Compilation Failure on macOS Catalina #2581

Closed
mdavis-coder opened this issue Jul 16, 2023 · 4 comments
Closed

Compilation Failure on macOS Catalina #2581

mdavis-coder opened this issue Jul 16, 2023 · 4 comments
Assignees
Labels
bug This issue is a bug. p2 This is a standard priority issue pending-release This issue will be fixed by an approved PR that hasn't been released yet.

Comments

@mdavis-coder
Copy link

mdavis-coder commented Jul 16, 2023

Describe the bug

The SDK doesn't build out of the box on Catalina.

The source file, aws-sdk-cpp/src/aws-cpp-sdk-core/source/utils/component-registry/ComponentRegistry.cpp, fails to compile.

Expected Behavior

The compilation should not fail with:

cmake -DBUILD_ONLY="s3" -DBUILD_SHARED_LIBS=OFF

Current Behavior


[ 66%] Building CXX object src/aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/ub_core.cpp.o
In file included from /Users/mdavis/workspace/aws/aws-sdk-cpp/src/aws-cpp-sdk-core/ub_core.cpp:55:
/Users/mdavis/workspace/aws/aws-sdk-cpp/src/aws-cpp-sdk-core/source/utils/component-registry/ComponentRegistry.cpp:88:32: error: 
      loop variable 'it' of type 'const std::__1::pair<void *const,
      Aws::Utils::ComponentRegistry::ComponentDescriptor>' creates a copy from type 'const std::__1::pair<void
      *const, Aws::Utils::ComponentRegistry::ComponentDescriptor>' [-Werror,-Wrange-loop-analysis]
                for(const auto it : *s_registry)
                               ^
/Users/mdavis/workspace/aws/aws-sdk-cpp/src/aws-cpp-sdk-core/source/utils/component-registry/ComponentRegistry.cpp:88:21: note: 
      use reference type 'const std::__1::pair<void *const, Aws::Utils::ComponentRegistry::ComponentDescriptor> &'
      to prevent copying
                for(const auto it : *s_registry)
                    ^~~~~~~~~~~~~~~
                               &
1 error generated.
make[2]: *** [src/aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/ub_core.cpp.o] Error 1
make[1]: *** [src/aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/all] Error 2
make: *** [all] Error 2

Reproduction Steps

macOS 10.15.7 (Intel)

Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Possible Solution

The value of the for loop should use a reference and not make a copy:

            for(const auto& it : *s_registry)
            {
                if (it.second.TerminateFn) {
                    it.second.TerminateFn(it.first, -1);
                }
            }

Additional Information/Context

No response

AWS CPP SDK version used

a4fccfa

Compiler and Version used

Apple clang version 12.0.0 (clang-1200.0.32.29)

Operating System and version

macOS 10.15.7

@mdavis-coder mdavis-coder added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 16, 2023
@yasminetalby yasminetalby self-assigned this Jul 17, 2023
@yasminetalby yasminetalby added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Jul 17, 2023
@yasminetalby
Copy link
Contributor

Hello @mdavis-coder ,

Thank you very much for your submission. I am unable to reproduce this behavior but from a first glance, this seems to be an issue with your environment. Could you please provide all your set up and building steps?

As a side note, as documented in the readme if you would like to build with macOS - Xcode:

cmake <path-to-root-of-this-source-code> -G Xcode -DTARGET_ARCH="APPLE" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=<path-to-install>
xcodebuild -target ALL_BUILD

Thank you very much for your time and collaboration.

Sincerely,

Yasmine

@yasminetalby yasminetalby added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Jul 18, 2023
@yasminetalby
Copy link
Contributor

Hello @mdavis-coder ,

My apologies, I did not catch that you had the following flag -Wrange-loop-analysis set. This might be causing the build to fail.

I'll try to reproduce it and submit a fix for it.

Thank you very much for your time and collaboration,

Sincerely,

Yasmine

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. label Jul 19, 2023
@yasminetalby yasminetalby added the p2 This is a standard priority issue label Jul 19, 2023
yasminetalby pushed a commit that referenced this issue Jul 19, 2023
@yasminetalby yasminetalby mentioned this issue Jul 19, 2023
11 tasks
sbiscigl pushed a commit that referenced this issue Jul 21, 2023
@yasminetalby yasminetalby added the pending-release This issue will be fixed by an approved PR that hasn't been released yet. label Jul 21, 2023
@sbiscigl
Copy link
Contributor

sbiscigl commented Jul 26, 2023

This should be released, give a shout if you see anymore errors

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

jmklix pushed a commit that referenced this issue Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 This is a standard priority issue pending-release This issue will be fixed by an approved PR that hasn't been released yet.
Projects
None yet
Development

No branches or pull requests

3 participants