Skip to content

Build breaks on TextToSpeechManager.cpp due to set-but-unused-variable while -Werror is turned on. #1816

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

Closed
HFTrader opened this issue Nov 21, 2021 · 4 comments
Labels
bug This issue is a bug. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.

Comments

@HFTrader
Copy link
Contributor

HFTrader commented Nov 21, 2021

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug
The build breaks because one variable is being set but not used. This should be just a warming but it causes the build to break since -Werror is turned on.

SDK version number
1.9.149 compiling with clang 13.0

Platform/OS/Hardware/Device
What are you running the sdk on?
Linux Ubuntu Focal 19.04

To Reproduce (observed behavior)
The only think I needed to do was to checkout the above version and try to build with cmake.

Expected behavior
I expected the build to go through.

Logs/output

/ssd/install-20211120/bin/clang++ -DAWS_MQTT_WITH_WEBSOCKETS -DAWS_SDK_VERSION_MAJOR=1 -DAWS_SDK_VERSION_MINOR=9 -DAWS_SDK_VERSION_PATCH=149 -DAWS_USE_EPOLL -DENABLE_CURL_CLIENT -DENABLE_OPENSSL_ENCRYPTION -DHAS_PATHCONF -DHAS_UMASK -DPLATFORM_LINUX -Daws_cpp_sdk_text_to_speech_EXPORTS -I/ssd/build-deps/aws-sdk-cpp-1.9.149/aws-cpp-sdk-text-to-speech/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/aws-cpp-sdk-polly/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/aws-cpp-sdk-core/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-http/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-io/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/s2n -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/s2n/api -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-common/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/build-tmp/crt/aws-crt-cpp/crt/aws-c-common/generated/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-cal/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-compression/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-mqtt/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-auth/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-checksums/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-event-stream/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-s3/include -isystem /ssd/install-20211120/openssl-1.1.1l/include -Wno-error -I/ssd/install-20211120/openssl-1.1.1l/include/openssl -I/ssd/install-20211120/include -I/ssd/install-20211120/include/openssl -O3 -DNDEBUG -fPIC -fno-exceptions -std=c++11 -Wall -Werror -pedantic -Wextra -DS2N_SIKE_P434_R3_ASM -DS2N_BIKE_R3_AVX2 -DS2N_BIKE_R3_AVX512 -DS2N_BIKE_R3_PCLMUL -DS2N_BIKE_R3_VPCLMUL -DS2N_KYBER512R3_AVX2_BMI2 -DS2N_ADX -DS2N_HAVE_EXECINFO -DS2N_CPUID_AVAILABLE -fPIC -DS2N_FALL_THROUGH_SUPPORTED -DS2N___RESTRICT__SUPPORTED -pthread -MD -MT aws-cpp-sdk-text-to-speech/CMakeFiles/aws-cpp-sdk-text-to-speech.dir/source/text-to-speech/TextToSpeechManager.cpp.o -MF aws-cpp-sdk-text-to-speech/CMakeFiles/aws-cpp-sdk-text-to-speech.dir/source/text-to-speech/TextToSpeechManager.cpp.o.d -o aws-cpp-sdk-text-to-speech/CMakeFiles/aws-cpp-sdk-text-to-speech.dir/source/text-to-speech/TextToSpeechManager.cpp.o -c /ssd/build-deps/aws-sdk-cpp-1.9.149/aws-cpp-sdk-text-to-speech/source/text-to-speech/TextToSpeechManager.cpp
/ssd/build-deps/aws-sdk-cpp-1.9.149/aws-cpp-sdk-text-to-speech/source/text-to-speech/TextToSpeechManager.cpp:149:33: error: variable 'amountRead' set but not used [-Werror,-Wunused-but-set-variable]
                std::streamsize amountRead(0);
                                ^
1 error generated.
[820/1127] Building CXX object aws-cpp-sdk-access-management/CMakeFiles/aws-cpp-sdk-access-management.dir/source/AccessManagementClient.cpp.o
[821/1127] Building CXX object aws-cpp-sdk-s3-encryption/CMakeFiles/aws-cpp-sdk-s3-encryption.dir/source/s3-encryption/modules/CryptoModuleFactory.cpp.o
[822/1127] Building CXX object aws-cpp-sdk-s3-encryption/CMakeFiles/aws-cpp-sdk-s3-encryption.dir/source/s3-encryption/modules/CryptoModule.cpp.o
[823/1127] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/ub_core.cpp.o
[824/1127] Building CXX object aws-cpp-sdk-workspaces/CMakeFiles/aws-cpp-sdk-workspaces.dir/ub_WORKSPACES.cpp.o
[825/1127] Building CXX object aws-cpp-sdk-ssm/CMakeFiles/aws-cpp-sdk-ssm.dir/ub_SSM.cpp.o
[826/1127] Building CXX object aws-cpp-sdk-ec2/CMakeFiles/aws-cpp-sdk-ec2.dir/ub_EC2.cpp.o
[827/1127] Building CXX object aws-cpp-sdk-sagemaker/CMakeFiles/aws-cpp-sdk-sagemaker.dir/ub_SAGEMAKER.cpp.o
ninja: build stopped: subcommand failed.

Additional context

The culprit is this snippet. You see that amountRead is set but never used.

                std::streamsize amountRead(0);
                unsigned char buffer[BUFF_SIZE];

                std::lock_guard<std::mutex> m(m_driverLock);
                m_activeDriver->Prime();
                bool successfullyPlayed(true);
                while (stream && successfullyPlayed)
                {
                    stream.read((char*) buffer, BUFF_SIZE);
                    auto read = stream.gcount();
                    AWS_LOGSTREAM_TRACE(CLASS_TAG, "Writing " << read << " bytes to device.");

                    successfullyPlayed = m_activeDriver->WriteBufferToDevice(buffer, (std::size_t)read);
                    amountRead += read;
                    played = successfullyPlayed;
                }

You can see that I even try to set Wno-error but the next -Werror overrides it.

[819/1127] Building CXX object aws-cpp-sdk-text-to-speech/CMakeFiles/aws-cpp-sdk-text-to-speech.dir/source/text-to-speech/TextToSpeechManager.cpp.o
FAILED: aws-cpp-sdk-text-to-speech/CMakeFiles/aws-cpp-sdk-text-to-speech.dir/source/text-to-speech/TextToSpeechManager.cpp.o
/ssd/install-20211120/bin/clang++ -DAWS_MQTT_WITH_WEBSOCKETS -DAWS_SDK_VERSION_MAJOR=1 -DAWS_SDK_VERSION_MINOR=9 -DAWS_SDK_VERSION_PATCH=149 -DAWS_USE_EPOLL -DENABLE_CURL_CLIENT -DENABLE_OPENSSL_ENCRYPTION -DHAS_PATHCONF -DHAS_UMASK -DPLATFORM_LINUX -Daws_cpp_sdk_text_to_speech_EXPORTS -I/ssd/build-deps/aws-sdk-cpp-1.9.149/aws-cpp-sdk-text-to-speech/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/aws-cpp-sdk-polly/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/aws-cpp-sdk-core/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-http/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-io/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/s2n -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/s2n/api -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-common/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/build-tmp/crt/aws-crt-cpp/crt/aws-c-common/generated/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-cal/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-compression/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-mqtt/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-auth/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-checksums/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-event-stream/include -I/ssd/build-deps/aws-sdk-cpp-1.9.149/crt/aws-crt-cpp/crt/aws-c-s3/include -isystem /ssd/install-20211120/openssl-1.1.1l/include -Wno-error -I/ssd/install-20211120/openssl-1.1.1l/include/openssl -I/ssd/install-20211120/include -I/ssd/install-20211120/include/openssl -O3 -DNDEBUG -fPIC -fno-exceptions -std=c++11 -Wall -Werror -pedantic -Wextra -DS2N_SIKE_P434_R3_ASM -DS2N_BIKE_R3_AVX2 -DS2N_BIKE_R3_AVX512 -DS2N_BIKE_R3_PCLMUL -DS2N_BIKE_R3_VPCLMUL -DS2N_KYBER512R3_AVX2_BMI2 -DS2N_ADX -DS2N_HAVE_EXECINFO -DS2N_CPUID_AVAILABLE -fPIC -DS2N_FALL_THROUGH_SUPPORTED -DS2N___RESTRICT__SUPPORTED -pthread -MD -MT aws-cpp-sdk-text-to-speech/CMakeFiles/aws-cpp-sdk-text-to-speech.dir/source/text-to-speech/TextToSpeechManager.cpp.o -MF aws-cpp-sdk-text-to-speech/CMakeFiles/aws-cpp-sdk-text-to-speech.dir/source/text-to-speech/TextToSpeechManager.cpp.o.d -o aws-cpp-sdk-text-to-speech/CMakeFiles/aws-cpp-sdk-text-to-speech.dir/source/text-to-speech/TextToSpeechManager.cpp.o -c /ssd/build-deps/aws-sdk-cpp-1.9.149/aws-cpp-sdk-text-to-speech/source/text-to-speech/TextToSpeechManager.cpp

I can see Werror being set on aws-sdk-cpp-1.9.149/cmake/compiler_settings.cmake

macro(set_gcc_warnings)
    list(APPEND AWS_COMPILER_WARNINGS "-Wall" "-Werror" "-pedantic" "-Wextra")
    if(COMPILER_CLANG)
        if(PLATFORM_ANDROID)
            # when using clang with libc and API lower than 21 we need to include Android support headers and ignore the gnu-include-next warning.
            if(ANDROID_STL MATCHES "libc" AND ANDROID_NATIVE_API_LEVEL_NUM LESS "21")
                # NDK lower than 12 doesn't support ignoring the gnu-include-next warning so we need to disable pedantic mode.
                if(NDK_RELEASE_NUMBER LESS "12000")
                    string(REGEX REPLACE "-pedantic" "" AWS_COMPILER_WARNINGS "${AWS_COMPILER_WARNINGS}")
                else()
                    list(APPEND AWS_COMPILER_WARNINGS "-Wno-gnu-include-next")
                endif()
            endif()
        endif()
    endif()
endmacro()
@HFTrader HFTrader added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 21, 2021
@KaibaLopez
Copy link
Contributor

Hi @HFTrader ,
Yea that's odd this should have been deactivated... thanks for pointing it out to us we'll look into it.

@KaibaLopez KaibaLopez removed the needs-triage This issue or PR still needs to be triaged. label Nov 23, 2021
OfekShilon added a commit to IstraResearch/aws-sdk-cpp that referenced this issue Apr 10, 2022
sgoth added a commit to sgoth/conan-center-index that referenced this issue May 1, 2022
text-to-speech doesn't compile with clang >= 13
See aws/aws-sdk-cpp#1816
sgoth added a commit to sgoth/conan-center-index that referenced this issue May 2, 2022
sgoth added a commit to sgoth/conan-center-index that referenced this issue May 2, 2022
sgoth added a commit to sgoth/conan-center-index that referenced this issue May 3, 2022
conan-center-bot pushed a commit to conan-io/conan-center-index that referenced this issue May 5, 2022
* aws-sdk-cpp: add version 1.9.247

Implements #10048

* aws-sdk-cpp: Downgrade 1.9.247 -> 1.9.234

Somewhere between 1.9.234 and 1.9.247 builds for Mac broke as the
OpenSSL headers are not found anymore when compiling aws-sdk-cpp-core.

See #10526 (comment)

* aws-sdk-cpp: support clang >= 13 with 1.9.100

Add patch for aws/aws-sdk-cpp#1816

* aws-sdk-cpp: support clang >= 13 with 1.8.130

Add patch for aws/aws-sdk-cpp#1816
@jmklix
Copy link
Member

jmklix commented Mar 8, 2023

We have recently reworking the build process, can you update to the latest version of this sdk and let me know if you are still having trouble building?

@jmklix jmklix added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. p2 This is a standard priority issue labels Mar 8, 2023
@HFTrader
Copy link
Contributor Author

HFTrader commented Mar 9, 2023

@jmklix Compiles clean now. But I am compiling only s3 keep in mind.

@jmklix jmklix closed this as completed Mar 9, 2023
@github-actions
Copy link

github-actions bot commented Mar 9, 2023

⚠️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.

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 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants