avro-c++: Fix build for 32-bit targets
PATCH 1/1 avro-c++: Fix build for 32-bit targets
Building avro-c++ for 32-bit targets currently fails due to the following warnings being treated as errors:
- useless-cast in Symbol.cc
- conversion in FileStream.cc
These are promoted to errors because of -Werror in the project's build flags.
Fix:
lib32-avro-c++/1.12/sources/avro-c++-1.12/lang/c++/impl/parsing/Symbol.cc:91:27:
error: useless cast to type 'int' [-Werror=useless-cast]
91 | adj.push_back(static_cast(it - rs.begin()));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
lib32-avro-c++/1.12/sources/avro-c++-1.12/lang/c++/impl/FileStream.cc:208:41:
error: conversion from 'int64_t' {aka 'long long int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion] 208 | in_->seek(position - byteCount_ - available_);
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
lib32-avro-c++/1.12/sources/avro-c++-1.12/lang/c++/impl/FileStream.cc:209:22:
error: conversion from 'int64_t' {aka 'long long int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
209 | byteCount_ = position;
| ^~~~~~~~
cc1plus: all warnings being treated as errors
--- meta-oe/recipes-support/avro/avro-c++_1.12.bb | 7 +++++++ 1 file changed, 7 insertions(+)
meta-oe/recipes-support/avro/avro-c++_1.12.bb +7 -0
@@ -26,4 +26,11 @@ do_configure:prepend() { cp -r ${UNPACKDIR}/_deps/fmt-src ${B}/_deps/ } +# Temporary workaround for 32-bit build failures due to -Werror: +# 'useless-cast' in Symbol.cc and 'conversion' in FileStream.cc +# +# A patch has been submitted upstream: https://github.com/apache/avro/pull/3433 +# Once this or an equivalent fix is merged and the recipe upgraded, this can be removed. +CXXFLAGS:append = " -Wno-error=useless-cast -Wno-error=conversion" + BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.43.0
Quoted 38 lines · Alper Ak via lists.openembedded.org
Building avro-c++ for 32-bit targets currently fails due to the following warnings being treated as errors:
-
useless-castin Symbol.cc
-conversionin FileStream.ccThese are promoted to errors because of
-Werrorin the project's build flags.Fix:
lib32-avro-c++/1.12/sources/avro-c++-1.12/lang/c++/impl/parsing/Symbol.cc:91:27:
error: useless cast to type 'int' [-Werror=useless-cast]
91 |adj.push_back(static_cast(it - rs.begin()));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errorslib32-avro-c++/1.12/sources/avro-c++-1.12/lang/c++/impl/FileStream.cc:208:41:
error: conversion from 'int64_t' {aka 'long long int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion] 208 |in_->seek(position - byteCount_ - available_);
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~lib32-avro-c++/1.12/sources/avro-c++-1.12/lang/c++/impl/FileStream.cc:209:22:
error: conversion from 'int64_t' {aka 'long long int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
209 |byteCount_= position;
| ^~~~~~~~
cc1plus: all warnings being treated as errorsSigned-off-by Alper Ak <[email protected]>--- meta-oe/recipes-support/avro/avro-c++_1.12.bb | 7 +++++++ 1 file changed, 7 insertions(+)meta-oe/recipes-support/avro/avro-c++_1.12.bb +0
-0
meta-oe/recipes-support/avro/avro-c++_1.12.bb do_configure:prepend() { · line 34
Quoted 9 lines
meta-oe/recipes-support/avro/avro-c++_1.12.bb +6
-0@@ -26,4 +26,11 @@ do_configure:prepend() { cp -r ${UNPACKDIR}/_deps/fmt-src ${B}/_deps/ } +# Temporary workaround for 32-bit build failures due to -Werror: +# 'useless-cast' in Symbol.cc and 'conversion' in FileStream.cc +# +# A patch has been submitted upstream: https://github.com/apache/avro/pull/3433 +# Once this or an equivalent fix is merged and the recipe upgraded, this can be removed. +CXXFLAGS:append = " -Wno-error=useless-cast -Wno-error=conversion"
useless-cast warning option does not exist in clang, so it will break clang builds.may be enable -Qunused-arguments CCARGS:append:toolchain-clang along with this will make it work across both compilers.
Quoted 14 lines
meta-oe/recipes-support/avro/avro-c++_1.12.bb +1
-1+ BBCLASSEXTEND = "native nativesdk" --2.43.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#118636): https://lists.openembedded.org/g/openembedded-devel/message/118636
Mute This Topic: https://lists.openembedded.org/mt/114250491/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 4 lines
useless-cast warning option does not exist in clang, so it will break clang builds.may be enable -Qunused-arguments CCARGS:append:toolchain-clang along with this will make it work across both compilers.
I configured the recipe to be built with Clang by adding TOOLCHAIN = "clang". Tried building both with and without the CXXFLAGS:append = " -Wno-error=useless-cast -Wno-error=conversion" line and Clang didn't return any failure/error in either case.
Khem Raj <[email protected]>, 20 Tem 2025 Paz, 22:01 tarihinde şunu yazdı:
Quoted 69 lines
Quoted 38 lines · Alper Ak via lists.openembedded.org
Building avro-c++ for 32-bit targets currently fails due to the following warnings being treated as errors:
-
useless-castin Symbol.cc
-conversionin FileStream.ccThese are promoted to errors because of
-Werrorin the project's build flags.Fix:
lib32-avro-c++/1.12/sources/avro-c++-1.12/lang/c++/impl/parsing/Symbol.cc:91:27:
error: useless cast to type 'int' [-Werror=useless-cast]
91 |adj.push_back(static_cast(it - rs.begin()));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errorslib32-avro-c++/1.12/sources/avro-c++-1.12/lang/c++/impl/FileStream.cc:208:41:
error: conversion from 'int64_t' {aka 'long long int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion] 208 |in_->seek(position - byteCount_ - available_);
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~lib32-avro-c++/1.12/sources/avro-c++-1.12/lang/c++/impl/FileStream.cc:209:22:
error: conversion from 'int64_t' {aka 'long long int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
209 |byteCount_= position;
| ^~~~~~~~
cc1plus: all warnings being treated as errorsSigned-off-by Alper Ak <[email protected]>--- meta-oe/recipes-support/avro/avro-c++_1.12.bb | 7 +++++++ 1 file changed, 7 insertions(+)meta-oe/recipes-support/avro/avro-c++_1.12.bb +0
-0meta-oe/recipes-support/avro/avro-c++_1.12.bb do_configure:prepend() { · line 34
Quoted 9 lines
meta-oe/recipes-support/avro/avro-c++_1.12.bb +6
-0@@ -26,4 +26,11 @@ do_configure:prepend() { cp -r ${UNPACKDIR}/_deps/fmt-src ${B}/_deps/ } +# Temporary workaround for 32-bit build failures due to -Werror: +# 'useless-cast' in Symbol.cc and 'conversion' in FileStream.cc +# +# A patch has been submitted upstream: https://github.com/apache/avro/pull/3433 +# Once this or an equivalent fix is merged and the recipe upgraded, this can be removed. +CXXFLAGS:append = " -Wno-error=useless-cast -Wno-error=conversion"useless-cast warning option does not exist in clang, so it will break clang builds.may be enable -Qunused-arguments CCARGS:append:toolchain-clang along with this will make it work across both compilers.
Quoted 14 lines
meta-oe/recipes-support/avro/avro-c++_1.12.bb +1
-1+ BBCLASSEXTEND = "native nativesdk" --2.43.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#118636): https://lists.openembedded.org/g/openembedded-devel/message/118636
Mute This Topic: https://lists.openembedded.org/mt/114250491/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-