offa / influxdb-cxx

InfluxDB C++ client library.
MIT License
117 stars 45 forks source link

Building Library on Raspberry pi #111

Closed Un-ka closed 2 years ago

Un-ka commented 2 years ago

I tried to build this library on Raspberry pi 4 with 1Gb RAM. But the compiler is being killed due to consuming all the memory during test builds. Message

c++: fatal error: Убито signal terminated program cc1plus
compilation terminated.
make[2]: *** [test/CMakeFiles/TestMain.dir/build.make:63: test/CMakeFiles/TestMain.dir/TestMain.cxx.o] Ошибка 1
make[1]: *** [CMakeFiles/Makefile2:533: test/CMakeFiles/TestMain.dir/all] Ошибка 2
make: *** [Makefile:141: all] Ошибка 2

previous

[  3%] Built target InfluxDB-Http
[  6%] Built target InfluxDB-Internal
[ 16%] Built target InfluxDB-BoostSupport
[ 30%] Built target InfluxDB
[ 33%] Building CXX object test/CMakeFiles/TestMain.dir/TestMain.cxx.o
In file included from /usr/include/c++/8/functional:65,
                 from /usr/local/include/catch2/catch.hpp:3478,
                 from /home/pi/Downloads/influxdb-cxx-0.6.7/test/TestMain.cxx:2 :
/usr/include/c++/8/bits/stl_algo.h: In function ‘void std::__unguarded_linear_insert(_RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<std::pair<long long unsigned int, const Catch::TestCase*>*, std::vector<std::pair<long long unsigned int, const Catch::TestCase*> > >; _Compare = __gnu_cxx::__ops::_Val_comp_iter<Catch::sortTests(const Catch::IConfig&, const std::vector<Catch::TestCase>&)::<lambda(const hashedTest&, const hashedTest&)> >]’:
/usr/include/c++/8/bits/stl_algo.h:1821:5: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<std::pair<long long unsigned int, const Catch::TestCase*>*, std::vector<std::pair<long long unsigned int, const Catch::TestCase*> > >’ changed in GCC 7.1
     __unguarded_linear_insert(_RandomAccessIterator __last,
     ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/8/vector:69,
                 from /usr/local/include/catch2/catch.hpp:561,
                 from /home/pi/Downloads/influxdb-cxx-0.6.7/test/TestMain.cxx:2 :
/usr/include/c++/8/bits/vector.tcc: In member function ‘void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {const Catch::SectionEndInfo&}; _Tp = Catch::SectionEndInfo; _Alloc = std::allocator<Catch::SectionEndInfo>]’:
/usr/include/c++/8/bits/vector.tcc:413:7: note: parameter passing for argument of type ‘std::vector<Catch::SectionEndInfo>::iterator’ {aka ‘__gnu_cxx::__normal_iterator<Catch::SectionEndInfo*, std::vector<Catch::SectionEndInfo> >’} changed in GCC 7.1
       vector<_Tp, _Alloc>::
       ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/8/vector:64,
                 from /usr/local/include/catch2/catch.hpp:561,
                 from /home/pi/Downloads/influxdb-cxx-0.6.7/test/TestMain.cxx:2 :
/usr/include/c++/8/bits/stl_vector.h: In member function ‘virtual void Catch::RunContext::sectionEndedEarly(const Catch::SectionEndInfo&)’:
/usr/include/c++/8/bits/stl_vector.h:1085:4: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<Catch::SectionEndInfo*, std::vector<Catch::SectionEndInfo> >’ changed in GCC 7.1    _M_realloc_insert(end(), __x);
    ^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/8/functional:65,
                 from /usr/local/include/catch2/catch.hpp:3478,
                 from /home/pi/Downloads/influxdb-cxx-0.6.7/test/TestMain.cxx:2 :
/usr/include/c++/8/bits/stl_algo.h: In function ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<std::pair<long long unsigned int, const Catch::TestCase*>*, std::vector<std::pair<long long unsigned int, const Catch::TestCase*> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<Catch::sortTests(const Catch::IConfig&, const std::vector<Catch::TestCase>&)::<lambda(const hashedTest&, const hashedTest&)> >]’:
/usr/include/c++/8/bits/stl_algo.h:1840:5: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<std::pair<long long unsigned int, const Catch::TestCase*>*, std::vector<std::pair<long long unsigned int, const Catch::TestCase*> > >’ changed in GCC 7.1
     __insertion_sort(_RandomAccessIterator __first,
     ^~~~~~~~~~~~~~~~
/usr/include/c++/8/bits/stl_algo.h:1840:5: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<std::pair<long long unsigned int, const Catch::TestCase*>*, std::vector<std::pair<long long unsigned int, const Catch::TestCase*> > >’ changed in GCC 7.1
In file included from /usr/include/c++/8/bits/stl_algo.h:61,
                 from /usr/include/c++/8/functional:65,
                 from /usr/local/include/catch2/catch.hpp:3478,
                 from /home/pi/Downloads/influxdb-cxx-0.6.7/test/TestMain.cxx:2 :
/usr/include/c++/8/bits/stl_heap.h: In function ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<std::pair<long long unsigned int, const Catch::TestCase*>*, std::vector<std::pair<long long unsigned int, const Catch::TestCase*> > >; _Distance = int; _Tp = std::pair<long long unsigned int, const Catch::TestCase*>; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<Catch::sortTests(const Catch::IConfig&, const std::vector<Catch::TestCase>&)::<lambda(const hashedTest&, const hashedTest&)> >]’:
/usr/include/c++/8/bits/stl_heap.h:214:5: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<std::pair<long long unsigned int, const Catch::TestCase*>*, std::vector<std::pair<long long unsigned int, const Catch::TestCase*> > >’ changed in GCC 7.1
     __adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
     ^~~~~~~~~~~~~
In file included from /usr/include/c++/8/functional:65,
                 from /usr/local/include/catch2/catch.hpp:3478,
                 from /home/pi/Downloads/influxdb-cxx-0.6.7/test/TestMain.cxx:2 :
/usr/include/c++/8/bits/stl_algo.h: In function ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<std::pair<long long unsigned int, const Catch::TestCase*>*, std::vector<std::pair<long long unsigned int, const Catch::TestCase*> > >; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<Catch::sortTests(const Catch::IConfig&, const std::vector<Catch::TestCase>&)::<lambda(const hashedTest&, const hashedTest&)> >]’:/usr/include/c++/8/bits/stl_algo.h:1940:5: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<std::pair<long long unsigned int, const Catch::TestCase*>*, std::vector<std::pair<long long unsigned int, const Catch::TestCase*> > >’ changed in GCC 7.1
     __introsort_loop(_RandomAccessIterator __first,
     ^~~~~~~~~~~~~~~~
/usr/include/c++/8/bits/stl_algo.h:1940:5: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<std::pair<long long unsigned int, const Catch::TestCase*>*, std::vector<std::pair<long long unsigned int, const Catch::TestCase*> > >’ changed in GCC 7.1
/usr/include/c++/8/bits/stl_algo.h:1940:5: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<std::pair<long long unsigned int, const Catch::TestCase*>*, std::vector<std::pair<long long unsigned int, const Catch::TestCase*> > >’ changed in GCC 7.1
/usr/include/c++/8/bits/stl_algo.h:1954:25: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<std::pair<long long unsigned int, const Catch::TestCase*>*, std::vector<std::pair<long long unsigned int, const Catch::TestCase*> > >’ changed in GCC 7.1
    std::__introsort_loop(__cut, __last, __depth_limit, __comp);
    ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

dmesg

[ 4735.646453] Out of memory: Kill process 12949 (cc1plus) score 445 or sacrifice child
[ 4735.646475] Killed process 12949 (cc1plus) total-vm:477084kB, anon-rss:426860kB, file-rss:14920kB, shmem-rss:0kB
Un-ka commented 2 years ago

I increased the size of the swap by one gigabyte. Compilation has moved on. But there was an error:

[ 36%] Linking CXX static library libTestMain.a
[ 36%] Built target TestMain
Scanning dependencies of target BoostSupportTest
[ 40%] Building CXX object test/CMakeFiles/BoostSupportTest.dir/BoostSupportTest.cxx.o
[ 43%] Linking CXX executable BoostSupportTest
/usr/bin/ld: cannot find -ltrompeloeil::trompeloeil
collect2: error: ld returned 1 exit status
make[2]: *** [test/CMakeFiles/BoostSupportTest.dir/build.make:93: test/BoostSupportTest] Ошибка 1
make[1]: *** [CMakeFiles/Makefile2:343: test/CMakeFiles/BoostSupportTest.dir/all] Ошибка 2
make: *** [Makefile:141: all] Ошибка 2
offa commented 2 years ago

The test framework libraries are both header-only, thus may require quite some memory.

In case you don't wont to develop, but rather only use the library on your device you can disable tests by the INFLUXCXX_TESTING option – eg. pass -DINFLUXCXX_TESTING=OFF on CLI. In that case you don't even need to provide catch and trompeloeil.

offa commented 2 years ago

@Un-ka Were you able to solve the issue?

offa commented 2 years ago

ping @Un-ka