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

Visual Studio 2022 STD::Allocator Warning Treated as Error #3001

Closed
AMZN-Gene opened this issue Jun 13, 2024 · 5 comments · Fixed by #3011 or o3de/3p-package-source#256
Closed

Visual Studio 2022 STD::Allocator Warning Treated as Error #3001

AMZN-Gene opened this issue Jun 13, 2024 · 5 comments · Fixed by #3011 or o3de/3p-package-source#256
Labels
bug This issue is a bug. p3 This is a minor priority issue pending-release This issue will be fixed by an approved PR that hasn't been released yet.

Comments

@AMZN-Gene
Copy link

AMZN-Gene commented Jun 13, 2024

Describe the bug

Compiling AWS SDK 1.11.344 results in compiler warnings due to using deprecated std::allocator member variables in C++17

Expected Behavior

Build should succeed

Current Behavior

D:\3p-package-source\package-system\AWSNativeSDK\temp\src\src\aws-cpp-sdk-core\include\aws\core\utils\memory\stl\AWSAll
ocator.h(65,9): error C2220: the following warning is treated as an error [D:\3p-package-source\package-system\AWSNativ
eSDK\temp\build\Debug_Shared\src\aws-cpp-sdk-core\aws-cpp-sdk-core.vcxproj]
D:\3p-package-source\package-system\AWSNativeSDK\temp\src\src\aws-cpp-sdk-core\include\aws\core\utils\memory\stl\AWSAll
ocator.h(65,9): warning C4996: 'std::allocator<_Ty>::pointer': warning STL4010: Various members of std::allocator are d
eprecated in C++17. Use std::allocator_traits instead of accessing these members directly. You can define _SILENCE_CXX1
7_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning. [D:\3p
-package-source\package-system\AWSNativeSDK\temp\build\Debug_Shared\src\aws-cpp-sdk-core\aws-cpp-sdk-core.vcxproj]
D:\3p-package-source\package-system\AWSNativeSDK\temp\src\src\aws-cpp-sdk-core\include\aws\core\utils\memory\stl\AWSAll
ocator.h(72,25): warning C4996: 'std::allocator<_Ty>::pointer': warning STL4010: Various members of std::allocator are
deprecated in C++17. Use std::allocator_traits instead of accessing these members directly. You can define _SILENCE_CXX
17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning. [D:\3
p-package-source\package-system\AWSNativeSDK\temp\build\Debug_Shared\src\aws-cpp-sdk-core\aws-cpp-sdk-core.vcxproj]
D:\3p-package-source\package-system\AWSNativeSDK\temp\src\src\aws-cpp-sdk-core\include\aws\core\utils\memory\stl\AWSAll
ocator.h(65,9): warning C4996: 'std::allocator<T>::pointer': warning STL4010: Various members of std::allocator are dep
recated in C++17. Use std::allocator_traits instead of accessing these members directly. You can define _SILENCE_CXX17_
OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning. [D:\3p-p
ackage-source\package-system\AWSNativeSDK\temp\build\Debug_Shared\src\aws-cpp-sdk-core\aws-cpp-sdk-core.vcxproj]

Reproduction Steps

  1. Build AWS SDK 1.11.344 for Windows using C++17 with latest VS 2022.
    MSVC 19.40.33811.0
    cmake 3.29
cmake -S %SRC_PATH% -B %BLD_PATH%\Debug_Shared ^
           -G "Visual Studio 17 2022" ^
           -A x64 ^
           -DTARGET_ARCH=WINDOWS ^
           -DCMAKE_CXX_STANDARD=17 ^
           -DCPP_STANDARD=17 ^
           -DBUILD_ONLY="access-management;bedrock-runtime;cognito-identity;cognito-idp;core;devicefarm;dynamodb;gamelift;identity-management;kinesis;lambda;queues;s3;sns;sqs;sts;transfer" ^
           -DENABLE_TESTING=OFF ^
           -DENABLE_RTTI=ON ^
           -DCUSTOM_MEMORY_MANAGEMENT=ON ^
           -DFORCE_SHARED_CRT=ON ^
           -DBUILD_SHARED_LIBS=ON ^
           -DCMAKE_BUILD_TYPE="Debug" ^
           -DCMAKE_INSTALL_BINDIR="bin" ^
           -DCMAKE_INSTALL_LIBDIR="lib" ^

Temporary Work Around

Temp workaround is to use -DAWS_SDK_WARNINGS_ARE_ERRORS=OFF

Additional Information/Context

No response

AWS CPP SDK version used

1.11.344

Compiler and Version used

Visual Studio 2022 MSVC 19.40.33811.0

Operating System and version

Windows 10 Enterprise

@AMZN-Gene AMZN-Gene added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 13, 2024
@jmklix
Copy link
Member

jmklix commented Jun 14, 2024

Thanks for pointing this out to us. Can you confirm if your suggested workaround works for you?

@jmklix jmklix added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. p3 This is a minor priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Jun 14, 2024
@laramiel
Copy link

I see this when building on C++20 as well.

If I replace the code in aws-cpp-sdk-core/include/aws/core/utils/memory/stl/AWSAllocator.h

before Base::pointer, after std::allocator_traits<Base>::pointer, then it works.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. label Jun 15, 2024
@AMZN-Gene
Copy link
Author

AMZN-Gene commented Jun 19, 2024

Thanks for pointing this out to us. Can you confirm if your suggested workaround works for you?

-DAWS_SDK_WARNINGS_ARE_ERRORS=OFF works.
Better solution is @laramiel fix (see patch)
AWSNativeSDK-1.11.344-windows.patch

AMZN-Gene added a commit to aws-lumberyard-dev/3p-package-source that referenced this issue Jun 19, 2024
Signed-off-by: AMZN-Gene <genewalt@amazon.com>
@jmklix
Copy link
Member

jmklix commented Jun 21, 2024

I made a PR here to fix this

@jmklix jmklix added the pending-release This issue will be fixed by an approved PR that hasn't been released yet. label Jun 21, 2024
@jmklix jmklix linked a pull request Jun 21, 2024 that will close this issue
11 tasks
Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

AMZN-Gene added a commit to aws-lumberyard-dev/3p-package-source that referenced this issue Jul 5, 2024
AMZN-Gene added a commit to o3de/3p-package-source that referenced this issue Jul 8, 2024
- Upgrading the AWS SDK 11.361 with AWS_APPSTORE_SAFE flag

- 1.11.361 also contains this fix: [Visual Studio 2022 STD::Allocator
Warning Treated as Error · Issue #3001 · aws/aws-sdk-cpp
(github.com)](aws/aws-sdk-cpp#3001)

- 1.11.361 also contains this fix: [1.11.337+ Android cURL Build No
Longer Compiles · Issue #3014 · aws/aws-sdk-cpp
(github.com)](aws/aws-sdk-cpp#3014)

Tested by
1) Grep'ing libraries for non-public api "CryptorGCM" before and after
enabling AWS_APPSTORE_SAFE flag
2) Help from external developer re-submitting to Apple AppStore and
passing

Fixes o3de/o3de#18029

---------

Signed-off-by: Gene Walters <genewalt@amazon.com>
Signed-off-by: Gene Walters <32776221+AMZN-Gene@users.noreply.github.com>
Signed-off-by: AMZN-Gene <genewalt@amazon.com>
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. p3 This is a minor priority issue pending-release This issue will be fixed by an approved PR that hasn't been released yet.
Projects
None yet
3 participants