Skip to contentSkip to conversation

package/assimp: disable -Werror compile flag

PATCH In review Peter Seiderer 3 participants 4 messages Dec 10, 2021 – Dec 27, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/assimp: disable -Werror compile flag

Add patch to disable -Werror compile flag.

Fixes:

- http://autobuild.buildroot.net/results/49beb264b8454b9af092278074c4087013692052/

.../build/assimp-5.1.3/code/PostProcessing/TriangulateProcess.cpp:285:50: error: argument 1 value ‘4294967294’ exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=]

    285 |     std::unique_ptr<bool[]> done(new bool[max_out]);
        |                                                  ^
  [...]
  .../host/opt/ext-toolchain/powerpc-buildroot-linux-uclibc/include/c++/9.3.0/new:127:26: note: in a call to allocation function ‘void* operator new [](std::size_t)’ declared here
    127 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
        |                          ^~~~~~~~
---
 package/assimp/0001-code-disable-Werror.patch | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 package/assimp/0001-code-disable-Werror.patch
package/assimp/0001-code-disable-Werror.patch new file +39 -0
new file mode 100644
index 0000000000..33867e61c3
@@ -0,0 +1,39 @@
+From 5146e1c4d58174e302dbdcf2a85c2023be1cffc6 Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <[email protected]>
+Date: Fri, 10 Dec 2021 15:15:30 +0100
+Subject: [PATCH] code: disable -Werror
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixes:
+
+  .../build/assimp-5.1.3/code/PostProcessing/TriangulateProcess.cpp:285:50: error: argument 1 value ‘4294967294’ exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=]
+    285 |     std::unique_ptr<bool[]> done(new bool[max_out]);
+        |                                                  ^
+  [...]
+  .../host/opt/ext-toolchain/powerpc-buildroot-linux-uclibc/include/c++/9.3.0/new:127:26: note: in a call to allocation function ‘void* operator new [](std::size_t)’ declared here
+    127 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
+        |                          ^~~~~~~~
+
+Signed-off-by: Peter Seiderer <[email protected]>
+---
+ code/CMakeLists.txt | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt
+index e45bf8a2a..f71b6583d 100644
+--- a/code/CMakeLists.txt
++++ b/code/CMakeLists.txt
+@@ -1167,8 +1167,6 @@ TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp)
+ # enable warnings as errors ########################################
+ IF (MSVC)
+   TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX)
+-ELSE()
+-  TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror)
+ ENDIF()
+ 
+ # adds C_FLAGS required to compile zip.c on old GCC 4.x compiler
+-- 
+2.34.1
+
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 49 lines · Peter Seiderer

Add patch to disable -Werror compile flag.

Fixes:

   - http://autobuild.buildroot.net/results/49beb264b8454b9af092278074c4087013692052/

   .../build/assimp-5.1.3/code/PostProcessing/TriangulateProcess.cpp:285:50: error: argument 1 value ‘4294967294’ exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=]
     285 |     std::unique_ptr<bool[]> done(new bool[max_out]);
         |                                                  ^
   [...]
   .../host/opt/ext-toolchain/powerpc-buildroot-linux-uclibc/include/c++/9.3.0/new:127:26: note: in a call to allocation function ‘void* operator new [](std::size_t)’ declared here
     127 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^~~~~~~~
---
  package/assimp/0001-code-disable-Werror.patch | 39 +++++++++++++++++++
  1 file changed, 39 insertions(+)

create mode 100644 package/assimp/0001-code-disable-Werror.patch

package/assimp/0001-code-disable-Werror.patch new file +23 -0
new file mode 100644
index 0000000000..33867e61c3
@@ -0,0 +1,39 @@
+From 5146e1c4d58174e302dbdcf2a85c2023be1cffc6 Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <[email protected]>
+Date: Fri, 10 Dec 2021 15:15:30 +0100
+Subject: [PATCH] code: disable -Werror
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixes:
+
+  .../build/assimp-5.1.3/code/PostProcessing/TriangulateProcess.cpp:285:50: error: argument 1 value ‘4294967294’ exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=]
+    285 |     std::unique_ptr<bool[]> done(new bool[max_out]);
+        |                                                  ^
+  [...]
+  .../host/opt/ext-toolchain/powerpc-buildroot-linux-uclibc/include/c++/9.3.0/new:127:26: note: in a call to allocation function ‘void* operator new [](std::size_t)’ declared here
+    127 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
+        |                          ^~~~~~~~
+
+Signed-off-by: Peter Seiderer <[email protected]>
+---
+ code/CMakeLists.txt | 2 --
+ 1 file changed, 2 deletions(-)
+

package/assimp/0001-code-disable-Werror.patch line 33

Quoted 10 lines
package/assimp/0001-code-disable-Werror.patch new file +10 -0
+diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt
+index e45bf8a2a..f71b6583d 100644
+--- a/code/CMakeLists.txt
++++ b/code/CMakeLists.txt
+@@ -1167,8 +1167,6 @@ TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp)
+ # enable warnings as errors ########################################
+ IF (MSVC)
+   TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX)
+-ELSE()
+-  TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror)

This looks like a patch that is not upstreamable, so not so nice.

Worse though: it seems that the issue raised by Werror could be an actual bug.
Allocting 4GB doesn't sound like a good idea, does it?

So perhaps it would be better to create an upstream issue for this? It should
be relatively easy to reproduce, any 32-bit target should be sufficient, no?

Regards,
Arnout

package/assimp/0001-code-disable-Werror.patch line 39

Quoted 7 lines
package/assimp/0001-code-disable-Werror.patch new file +6 -0
+ ENDIF()
+
+ # adds C_FLAGS required to compile zip.c on old GCC 4.x compiler
+--
+2.34.1
+

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Hello Arnout,

Quoted 63 lines · Arnout Vandecappelle
Quoted 49 lines · Peter Seiderer

Add patch to disable -Werror compile flag.

Fixes:

   - http://autobuild.buildroot.net/results/49beb264b8454b9af092278074c4087013692052/

   .../build/assimp-5.1.3/code/PostProcessing/TriangulateProcess.cpp:285:50: error: argument 1 value ‘4294967294’ exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=]
     285 |     std::unique_ptr<bool[]> done(new bool[max_out]);
         |                                                  ^
   [...]
   .../host/opt/ext-toolchain/powerpc-buildroot-linux-uclibc/include/c++/9.3.0/new:127:26: note: in a call to allocation function ‘void* operator new [](std::size_t)’ declared here
     127 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^~~~~~~~
---
  package/assimp/0001-code-disable-Werror.patch | 39 +++++++++++++++++++
  1 file changed, 39 insertions(+)

create mode 100644 package/assimp/0001-code-disable-Werror.patch

package/assimp/0001-code-disable-Werror.patch new file +23 -0
new file mode 100644
index 0000000000..33867e61c3
@@ -0,0 +1,39 @@
+From 5146e1c4d58174e302dbdcf2a85c2023be1cffc6 Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <[email protected]>
+Date: Fri, 10 Dec 2021 15:15:30 +0100
+Subject: [PATCH] code: disable -Werror
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixes:
+
+  .../build/assimp-5.1.3/code/PostProcessing/TriangulateProcess.cpp:285:50: error: argument 1 value ‘4294967294’ exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=]
+    285 |     std::unique_ptr<bool[]> done(new bool[max_out]);
+        |                                                  ^
+  [...]
+  .../host/opt/ext-toolchain/powerpc-buildroot-linux-uclibc/include/c++/9.3.0/new:127:26: note: in a call to allocation function ‘void* operator new [](std::size_t)’ declared here
+    127 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
+        |                          ^~~~~~~~
+
+Signed-off-by: Peter Seiderer <[email protected]>
+---
+ code/CMakeLists.txt | 2 --
+ 1 file changed, 2 deletions(-)
+

package/assimp/0001-code-disable-Werror.patch line 33

Quoted 10 lines
package/assimp/0001-code-disable-Werror.patch new file +10 -0
+diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt
+index e45bf8a2a..f71b6583d 100644
+--- a/code/CMakeLists.txt
++++ b/code/CMakeLists.txt
+@@ -1167,8 +1167,6 @@ TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp)
+ # enable warnings as errors ########################################
+ IF (MSVC)
+   TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX)
+-ELSE()
+-  TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror)  

This looks like a patch that is not upstreamable, so not so nice.

Quoted 5 lines

Worse though: it seems that the issue raised by Werror could be an actual bug.
Allocting 4GB doesn't sound like a good idea, does it?

So perhaps it would be better to create an upstream issue for this? It should
be relatively easy to reproduce, any 32-bit target should be sufficient, no?

Thanks for review and sorry for being to short in the commit message, the code in question is from build/assimp-5.1.0/code/PostProcessing/TriangulateProcess.cpp is:

225     // Find out how many output faces we'll get
226     uint32_t numOut = 0, max_out = 0;
227     bool get_normals = true;
228     for( unsigned int a = 0; a < pMesh->mNumFaces; a++) {

229 aiFace& face = pMesh->mFaces[a];
230 if (face.mNumIndices <= 4) {
231 get_normals = false;
232 }
233 if( face.mNumIndices <= 3) {
234 numOut++;
235
236 }
237 else {
238 numOut += face.mNumIndices-2;
239 max_out = std::max(max_out,face.mNumIndices);
240 }
241 }
[...]
284 // use std::unique_ptr to avoid slow std::vector<bool> specialiations
285 std::unique_ptr<bool[]> done(new bool[max_out]);

The warning creeped in most likely with upstream commit [1] and I believe is a false positive a la [2]..., it is not a real overflow but a warning about a possible/theoretically overflow....

Regards,
Peter

[1] https://github.com/assimp/assimp/commit/b94183376ced40aecab78b5b5893dca8277542b9
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85783

Quoted 4 lines

Regards,
Arnout

Quoted 11 lines

package/assimp/0001-code-disable-Werror.patch line 39

Quoted 7 lines
package/assimp/0001-code-disable-Werror.patch new file +6 -0
+ ENDIF()
+
+ # adds C_FLAGS required to compile zip.c on old GCC 4.x compiler
+--
+2.34.1
+

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
In reply to Peter Seiderer
Quoted 14 lines · On Fri, 10 Dec 2021 15:25:31 +0100 Peter Seiderer <[email protected]> wrote:

Add patch to disable -Werror compile flag.

Fixes:

- http://autobuild.buildroot.net/results/49beb264b8454b9af092278074c4087013692052/

.../build/assimp-5.1.3/code/PostProcessing/TriangulateProcess.cpp:285:50: error: argument 1 value ‘4294967294’ exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=]

    285 |     std::unique_ptr<bool[]> done(new bool[max_out]);
        |                                                  ^
  [...]
  .../host/opt/ext-toolchain/powerpc-buildroot-linux-uclibc/include/c++/9.3.0/new:127:26: note: in a call to allocation function ‘void* operator new [](std::size_t)’ declared here
    127 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
        |                          ^~~~~~~~
Quoted 5 lines
---
 package/assimp/0001-code-disable-Werror.patch | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 package/assimp/0001-code-disable-Werror.patch

Even though Arnout had objections, this patch is reasonable, it's obviously just dropping -Werror, and we indeed try to not build packages with -Werror in general. So I've applied.

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot