ARM-software / armnn

Arm NN ML Software. The code here is a read-only mirror of https://review.mlplatform.org/admin/repos/ml/armnn
https://developer.arm.com/products/processors/machine-learning/arm-nn
MIT License
1.14k stars 307 forks source link

ArmNN 22.11 fails to build with `error: 'istream_iterator' is not a member of 'std'` #711

Closed ggardet closed 1 year ago

ggardet commented 1 year ago

On openSUSE Tumbleweed, ArmNN 22.11 fails to build with error: 'istream_iterator' is not a member of 'std'.

Log:

[ 1382s] /home/abuild/rpmbuild/BUILD/armnn-22.11/tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp: In function 'void CheckAccuracy(std::vector<float>*, std::vector<float>*, std::vector<float>*, std::vector<float>*, const std::vector<yolov3::Detection>&, const std::vector<std::__cxx11::basic_string<char> >&)':
[ 1382s] /home/abuild/rpmbuild/BUILD/armnn-22.11/tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp:252:30: error: 'istream_iterator' is not a member of 'std'
[ 1382s]   252 |         expected.assign(std::istream_iterator<float>(pathStream), {});
[ 1382s]       |                              ^~~~~~~~~~~~~~~~
[ 1382s] /home/abuild/rpmbuild/BUILD/armnn-22.11/tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp:24:1: note: 'std::istream_iterator' is defined in header '<iterator>'; did you forget to '#include <iterator>'?
[ 1382s]    23 | #include <cmath>
[ 1382s]   +++ |+#include <iterator>
[ 1382s]    24 | 
[ 1382s] /home/abuild/rpmbuild/BUILD/armnn-22.11/tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp:252:47: error: expected primary-expression before 'float'
[ 1382s]   252 |         expected.assign(std::istream_iterator<float>(pathStream), {});
[ 1382s]       |                                               ^~~~~
[ 1382s] /home/abuild/rpmbuild/BUILD/armnn-22.11/tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp:288:30: error: 'istream_iterator' is not a member of 'std'
[ 1382s]   288 |         expected.assign(std::istream_iterator<float>(pathStream), {});
[ 1382s]       |                              ^~~~~~~~~~~~~~~~
[ 1382s] /home/abuild/rpmbuild/BUILD/armnn-22.11/tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp:288:30: note: 'std::istream_iterator' is defined in header '<iterator>'; did you forget to '#include <iterator>'?
[ 1382s] /home/abuild/rpmbuild/BUILD/armnn-22.11/tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp:288:47: error: expected primary-expression before 'float'
[ 1382s]   288 |         expected.assign(std::istream_iterator<float>(pathStream), {});
[ 1382s]       |                                               ^~~~~
[ 1382s] make[2]: *** [tests/CMakeFiles/TfLiteYoloV3Big-Armnn.dir/build.make:93: tests/CMakeFiles/TfLiteYoloV3Big-Armnn.dir/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp.o] Error 1

According to GCC hints, armnn-22.11/tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp requires #include <iterator>. (I did not test it yet).

ggardet commented 1 year ago

I confirm that this trivial patch fixes the build:

--- armnn-22.11/tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp.orig  2022-11-29 15:20:31.148251027 +0100
+++ armnn-22.11/tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp   2022-11-29 15:20:52.820459889 +0100
@@ -20,6 +20,7 @@
 #include <chrono>
 #include <fstream>
 #include <iostream>
+#include <iterator>
 #include <cmath>

 using namespace armnnTfLiteParser;
morgolock commented 1 year ago

Hi @ggardet

Thanks for reporting this and providing the fix. I've created a patch fixing the problem: https://review.mlplatform.org/c/ml/armnn/+/8726

Hope this helps

FrancisMurtagh-arm commented 1 year ago

Hi @ggardet,

The above fix has been merged so I'll close this ticket for now.

Please reopen if necessary. Francis.