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

Build fails due to warnings turned into errors by passing -Werror #65

Open
glaubitz opened this issue Apr 1, 2019 · 2 comments
Open

Comments

@glaubitz
Copy link

glaubitz commented Apr 1, 2019

The build currently fails with gcc-8 on openSUSE Tumbleweed with:

[   34s] /home/abuild/rpmbuild/BUILD/uamqp-1.1.0/src/vendor/azure-uamqp-c/src/amqpvalue.c: In function 'encode_float_value':
[   34s] /home/abuild/rpmbuild/BUILD/uamqp-1.1.0/src/vendor/azure-uamqp-c/src/amqpvalue.c:3132:34: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
[   34s]      uint32_t value_as_uint32 = *((uint32_t*)(void*)&value);
[   34s]                                  ~^~~~~~~~~~~~~~~~~~~~~~~~~
[   34s] /home/abuild/rpmbuild/BUILD/uamqp-1.1.0/src/vendor/azure-uamqp-c/src/amqpvalue.c: In function 'encode_double_value':
[   34s] /home/abuild/rpmbuild/BUILD/uamqp-1.1.0/src/vendor/azure-uamqp-c/src/amqpvalue.c:3196:34: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
[   34s]      uint64_t value_as_uint64 = *((uint64_t*)(void*)&value);
[   34s]                                  ~^~~~~~~~~~~~~~~~~~~~~~~~~
[   34s] /home/abuild/rpmbuild/BUILD/uamqp-1.1.0/src/vendor/azure-uamqp-c/src/amqpvalue.c: In function 'internal_decoder_decode_bytes':
[   34s] /home/abuild/rpmbuild/BUILD/uamqp-1.1.0/src/vendor/azure-uamqp-c/src/amqpvalue.c:5226:23: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
[   34s]                      *((uint32_t*)&internal_decoder_data->decode_to_value->value.float_value) = 0;
[   34s]                       ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[   34s] /home/abuild/rpmbuild/BUILD/uamqp-1.1.0/src/vendor/azure-uamqp-c/src/amqpvalue.c:5239:23: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
[   34s]                      *((uint64_t*)&internal_decoder_data->decode_to_value->value.double_value) = 0;
[   34s]                       ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[   34s] /home/abuild/rpmbuild/BUILD/uamqp-1.1.0/src/vendor/azure-uamqp-c/src/amqpvalue.c:5723:23: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
[   34s]                      *((uint32_t*)&internal_decoder_data->decode_to_value->value.float_value) += ((uint32_t)buffer[0]) << ((3 - internal_decoder_data->bytes_decoded) * 8);
[   34s]                       ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[   34s] /home/abuild/rpmbuild/BUILD/uamqp-1.1.0/src/vendor/azure-uamqp-c/src/amqpvalue.c:5745:23: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
[   34s]                      *((uint64_t*)&internal_decoder_data->decode_to_value->value.double_value) += ((uint64_t)buffer[0]) << ((7 - internal_decoder_data->bytes_decoded) * 8);
[   34s]                       ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[   36s] cc1: all warnings being treated as errors
[   36s] gmake[2]: *** [CMakeFiles/uamqp.dir/build.make:102: CMakeFiles/uamqp.dir/src/amqpvalue.c.o] Error 1
[   36s] gmake[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/uamqp.dir/all] Error 2
[   36s] gmake: *** [Makefile:141: all] Error 2

This is because multiple cmake files pass -Werror to the compiler:

glaubitz@suse-laptop:~/suse/home:glaubitz:branches:devel:languages:python:azure3/python-uamqp> grep -R Werror *
uamqp-1.1.0/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/configs/azure_iot_build_rules.cmake:    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
uamqp-1.1.0/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/configs/azure_iot_build_rules.cmake:    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
uamqp-1.1.0/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/configs/azure_iot_build_rules.cmake:    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
uamqp-1.1.0/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/configs/azure_iot_build_rules.cmake:    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
uamqp-1.1.0/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/testtools/umock-c/CMakeLists.txt:# Build with -Werror
uamqp-1.1.0/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/testtools/umock-c/CMakeLists.txt:    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
uamqp-1.1.0/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/testtools/umock-c/CMakeLists.txt:    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
uamqp-1.1.0/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/testtools/umock-c/deps/ctest/CMakeLists.txt:    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
uamqp-1.1.0/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/testtools/umock-c/deps/ctest/CMakeLists.txt:    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
uamqp-1.1.0/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/testtools/ctest/CMakeLists.txt:    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
uamqp-1.1.0/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/testtools/ctest/CMakeLists.txt:    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
glaubitz@suse-laptop:~/suse/home:glaubitz:branches:devel:languages:python:azure3/python-uamqp>

At the time, gcc generates warnings for the code. Thus, in order to fix this, either drop -Werror from the C/CXXFLAGS or fix the warnings.

@thatch
Copy link

thatch commented Mar 2, 2020

I'm seeing this as well.

@thatch
Copy link

thatch commented Mar 2, 2020

Looks like -Werror is coming from one of the cmake files, I dropped the lines that reference it from these three files and have a successful build:

src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/testtools/ctest/CMakeLists.txt
src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/testtools/umock-c/CMakeLists.txt
src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/configs/azure_iot_build_rules.cmake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants