alandefreitas / matplotplusplus

Matplot++: A C++ Graphics Library for Data Visualization 📊🗾
https://alandefreitas.github.io/matplotplusplus/
MIT License
4.24k stars 325 forks source link

Error building on linux gcc-12 #362

Open suhasghorp opened 1 year ago

suhasghorp commented 1 year ago

Bug category

Describe the bug

Can not build the library Steps to Reproduce

# Your steps go here
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O2" -DMATPLOTPP_BUILD_EXAMPLES=OFF -DMATPLOTPP_BUILD_TESTS=OFF
sudo cmake --build . --parallel 2 --config Release

Output

(base) sghorp@LAPTOP-NPL8D370:~/matplotplusplus/build$ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O2" -DMATPLOTPP_BUILD_EXAMPLES=OFF -DMATPLOTPP_BUILD_TESTS=OFF Setting global options Looking for -fsanitize=address Adding -fsanitize=address Looking for -fsanitize=leak Adding -fsanitize=leak Looking for -fsanitize=undefined Adding -fsanitize=undefined -- Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR) -- Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR) -- Could NOT find FFTW (missing: FFTW_INCLUDE_DIRS) Setting matplotplusplus compiler options CMAKE_INSTALL_PREFIX=/usr/local CMAKE_INSTALL_LIBDIR=lib -- Configuring done -- Generating done -- Build files have been written to: /home/sghorp/matplotplusplus/build

(base) sghorp@LAPTOP-NPL8D370:~/matplotplusplus/build$ sudo cmake --build . --parallel 2 --config Release Consolidate compiler generated dependencies of target nodesoup [ 13%] Built target nodesoup Consolidate compiler generated dependencies of target matplot [ 18%] Building CXX object source/matplot/CMakeFiles/matplot.dir/backend/gnuplot.cpp.o [ 18%] Building CXX object source/matplot/CMakeFiles/matplot.dir/backend/backend_interface.cpp.o [ 20%] Building CXX object source/matplot/CMakeFiles/matplot.dir/backend/backend_registry.cpp.o [ 23%] Building CXX object source/matplot/CMakeFiles/matplot.dir/core/axes_type.cpp.o In file included from /usr/include/c++/12/functional:59, from /home/sghorp/matplotplusplus/source/matplot/util/common.h:12, from /home/sghorp/matplotplusplus/source/matplot/backend/gnuplot.cpp:9: In constructor ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:149:4, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:146:7, inlined from ‘std::detail::_StateIdT std::__detail::_NFA<_TraitsT>::_M_insert_subexpr_end() [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_automaton.h:290:24: /usr/include/c++/12/bits/std_function.h:405:42: error: ‘(std::function<bool(char)>)((char)&tmp + offsetof(std::detail::_StateT, std::detail::_State::.std::detail::_State_base::)).std::function<bool(char)>::_M_invoker’ may be used uninitialized [-Werror=maybe-uninitialized] 405 | : _Function_base(), _M_invoker(x._M_invoker) | ~~^~~~ In file included from /usr/include/c++/12/regex:63, from /home/sghorp/matplotplusplus/source/matplot/backend/gnuplot.cpp:11: /usr/include/c++/12/bits/regex_automaton.h: In member function ‘std::detail::_StateIdT std::detail::_NFA<_TraitsT>::_M_insert_subexpr_end() [with _TraitsT = std::cxx11::regex_traits]’: /usr/include/c++/12/bits/regex_automaton.h:287:17: note: ‘tmp’ declared here 287 | _StateT tmp(_S_opcode_subexpr_end); | ^~~~~ In member function ‘bool std::_Function_base::_M_empty() const’, inlined from ‘std::function<_Res(_ArgTypes ...)>::operator bool() const [with _Res = bool; _ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:574:25, inlined from ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:407:6, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:149:4, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:146:7, inlined from ‘std::detail::_StateIdT std::__detail::_NFA<_TraitsT>::_M_insert_subexpr_end() [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_automaton.h:290:24: /usr/include/c++/12/bits/std_function.h:247:37: error: ‘(const std::_Function_base)((char)&tmp + offsetof(std::detail::_StateT, std::detail::_State::.std::__detail::_State_base::)).std::_Function_base::_M_manager’ may be used uninitialized [-Werror=maybe-uninitialized] 247 | bool _M_empty() const { return !_M_manager; } | ^~~~~~ /usr/include/c++/12/bits/regex_automaton.h: In member function ‘std::detail::_StateIdT std::detail::_NFA<_TraitsT>::_M_insert_subexpr_end() [with _TraitsT = std::cxx11::regex_traits]’: /usr/include/c++/12/bits/regex_automaton.h:287:17: note: ‘tmp’ declared here 287 | _StateT tmp(_S_opcode_subexpr_end); | ^~~~~ In constructor ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:149:4, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:146:7, inlined from ‘std::detail::_StateIdT std::__detail::_NFA<_TraitsT>::_M_insert_subexpr_begin() [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_automaton.h:281:24: /usr/include/c++/12/bits/std_function.h:405:42: error: ‘(std::function<bool(char)>)((char)&tmp + offsetof(std::detail::_StateT, std::detail::_State::.std::detail::_State_base::)).std::function<bool(char)>::_M_invoker’ may be used uninitialized [-Werror=maybe-uninitialized] 405 | : _Function_base(), _M_invoker(x._M_invoker) | ~~^~~~ /usr/include/c++/12/bits/regex_automaton.h: In member function ‘std::detail::_StateIdT std::detail::_NFA<_TraitsT>::_M_insert_subexpr_begin() [with _TraitsT = std::cxx11::regex_traits]’: /usr/include/c++/12/bits/regex_automaton.h:279:17: note: ‘tmp’ declared here 279 | _StateT tmp(_S_opcode_subexpr_begin); | ^~~~~ In member function ‘bool std::_Function_base::_M_empty() const’, inlined from ‘std::function<_Res(_ArgTypes ...)>::operator bool() const [with _Res = bool; _ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:574:25, inlined from ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:407:6, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:149:4, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:146:7, inlined from ‘std::detail::_StateIdT std::__detail::_NFA<_TraitsT>::_M_insert_subexpr_begin() [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_automaton.h:281:24: /usr/include/c++/12/bits/std_function.h:247:37: error: ‘(const std::_Function_base)((char)&tmp + offsetof(std::detail::_StateT, std::detail::_State::.std::__detail::_State_base::)).std::_Function_base::_M_manager’ may be used uninitialized [-Werror=maybe-uninitialized] 247 | bool _M_empty() const { return !_M_manager; } | ^~~~~~ /usr/include/c++/12/bits/regex_automaton.h: In member function ‘std::detail::_StateIdT std::detail::_NFA<_TraitsT>::_M_insert_subexpr_begin() [with _TraitsT = std::cxx11::regex_traits]’: /usr/include/c++/12/bits/regex_automaton.h:279:17: note: ‘tmp’ declared here 279 | _StateT tmp(_S_opcode_subexpr_begin); | ^~~~~ In constructor ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:149:4, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:146:7, inlined from ‘std::detail::_StateIdT std::__detail::_NFA<_TraitsT>::_M_insert_backref(std::size_t) [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_automaton.tcc:173:29: /usr/include/c++/12/bits/std_function.h:405:42: error: ‘(std::function<bool(char)>)((char)&tmp + offsetof(std::detail::_StateT, std::detail::_State::.std::detail::_State_base::)).std::function<bool(char)>::_M_invoker’ may be used uninitialized [-Werror=maybe-uninitialized] 405 | : _Function_base(), _M_invoker(x._M_invoker) | ~~^~~~ In file included from /usr/include/c++/12/bits/regex_automaton.h:400: /usr/include/c++/12/bits/regex_automaton.tcc: In member function ‘std::__detail::_StateIdT std::detail::_NFA<_TraitsT>::_M_insert_backref(std::size_t) [with _TraitsT = std::cxx11::regex_traits]’: /usr/include/c++/12/bits/regex_automaton.tcc:171:15: note: ‘tmp’ declared here 171 | _StateT tmp(_S_opcode_backref); | ^~~~~ In member function ‘bool std::_Function_base::_M_empty() const’, inlined from ‘std::function<_Res(_ArgTypes ...)>::operator bool() const [with _Res = bool; _ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:574:25, inlined from ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:407:6, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:149:4, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:146:7, inlined from ‘std::__detail::_StateIdT std::detail::_NFA<_TraitsT>::_M_insert_backref(std::size_t) [with _TraitsT = std::__cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_automaton.tcc:173:29: /usr/include/c++/12/bits/std_function.h:247:37: error: ‘(const std::_Function_base)((char)&tmp + offsetof(std::detail::_StateT, std::detail::_State::.std::__detail::_State_base::)).std::_Function_base::_M_manager’ may be used uninitialized [-Werror=maybe-uninitialized] 247 | bool _M_empty() const { return !_M_manager; } | ^~~~~~ /usr/include/c++/12/bits/regex_automaton.tcc: In member function ‘std::detail::_StateIdT std::detail::_NFA<_TraitsT>::_M_insert_backref(std::size_t) [with _TraitsT = std::cxx11::regex_traits]’: /usr/include/c++/12/bits/regex_automaton.tcc:171:15: note: ‘tmp’ declared here 171 | _StateT tmp(_S_opcode_backref); | ^~~~~ In constructor ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:149:4, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:146:7, inlined from ‘std::detail::_StateIdT std::__detail::_NFA<_TraitsT>::_M_insert_repeat(std::detail::_StateIdT, std::detail::_StateIdT, bool) [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_automaton.h:263:24: /usr/include/c++/12/bits/std_function.h:405:42: error: ‘(std::function<bool(char)>)((char)&tmp + offsetof(std::detail::_StateT, std::detail::_State::.std::detail::_State_base::)).std::function<bool(char)>::_M_invoker’ may be used uninitialized [-Werror=maybe-uninitialized] 405 | : _Function_base(), _M_invoker(x._M_invoker) | ~~^~~~ /usr/include/c++/12/bits/regex_automaton.h: In member function ‘std::detail::_StateIdT std::detail::_NFA<_TraitsT>::_M_insert_repeat(std::__detail::_StateIdT, std::detail::_StateIdT, bool) [with _TraitsT = std::cxx11::regex_traits]’: /usr/include/c++/12/bits/regex_automaton.h:257:17: note: ‘tmp’ declared here 257 | _StateT tmp(_S_opcode_repeat); | ^~~~~ In member function ‘bool std::_Function_base::_M_empty() const’, inlined from ‘std::function<_Res(_ArgTypes ...)>::operator bool() const [with _Res = bool; _ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:574:25, inlined from ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:407:6, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:149:4, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:146:7, inlined from ‘std::__detail::_StateIdT std::detail::_NFA<_TraitsT>::_M_insert_repeat(std::__detail::_StateIdT, std::detail::_StateIdT, bool) [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_automaton.h:263:24: /usr/include/c++/12/bits/std_function.h:247:37: error: ‘(const std::_Function_base)((char)&tmp + offsetof(std::detail::_StateT, std::detail::_State::.std::__detail::_State_base::)).std::_Function_base::_M_manager’ may be used uninitialized [-Werror=maybe-uninitialized] 247 | bool _M_empty() const { return !_M_manager; } | ^~~~~~ /usr/include/c++/12/bits/regex_automaton.h: In member function ‘std::detail::_StateIdT std::detail::_NFA<_TraitsT>::_M_insert_repeat(std::__detail::_StateIdT, std::detail::_StateIdT, bool) [with _TraitsT = std::cxx11::regex_traits]’: /usr/include/c++/12/bits/regex_automaton.h:257:17: note: ‘tmp’ declared here 257 | _StateT tmp(_S_opcode_repeat); | ^~~~~ In constructor ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:149:4, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:146:7, inlined from ‘std::__detail::_StateIdT std::detail::_NFA<_TraitsT>::_M_insert_alt(std::detail::_StateIdT, std::detail::_StateIdT, bool) [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_automaton.h:251:24, inlined from ‘void std::__detail::_Compiler<_TraitsT>::_M_disjunction() [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_compiler.tcc:103:18: /usr/include/c++/12/bits/std_function.h:405:42: error: ‘(std::function<bool(char)>)((char)&tmp + offsetof(std::detail::_StateT, std::detail::_State::.std::detail::_State_base::)).std::function<bool(char)>::_M_invoker’ may be used uninitialized [-Werror=maybe-uninitialized] 405 | : _Function_base(), _M_invoker(x._M_invoker) | ~~^~~~ /usr/include/c++/12/bits/regex_automaton.h: In member function ‘void std::detail::_Compiler<_TraitsT>::_M_disjunction() [with _TraitsT = std::cxx11::regex_traits]’: /usr/include/c++/12/bits/regex_automaton.h:246:17: note: ‘tmp’ declared here 246 | _StateT tmp(_S_opcode_alternative); | ^~~~~ In member function ‘bool std::_Function_base::_M_empty() const’, inlined from ‘std::function<_Res(_ArgTypes ...)>::operator bool() const [with _Res = bool; _ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:574:25, inlined from ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:407:6, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:149:4, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:146:7, inlined from ‘std::__detail::_StateIdT std::detail::_NFA<_TraitsT>::_M_insert_alt(std::detail::_StateIdT, std::detail::_StateIdT, bool) [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_automaton.h:251:24, inlined from ‘void std::__detail::_Compiler<_TraitsT>::_M_disjunction() [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_compiler.tcc:103:18: /usr/include/c++/12/bits/std_function.h:247:37: error: ‘(const std::_Function_base)((char)&tmp + offsetof(std::detail::_StateT, std::detail::_State::.std::__detail::_State_base::)).std::_Function_base::_M_manager’ may be used uninitialized [-Werror=maybe-uninitialized] 247 | bool _M_empty() const { return !_M_manager; } | ^~~~~~ /usr/include/c++/12/bits/regex_automaton.h: In member function ‘void std::detail::_Compiler<_TraitsT>::_M_disjunction() [with _TraitsT = std::cxx11::regex_traits]’: /usr/include/c++/12/bits/regex_automaton.h:246:17: note: ‘tmp’ declared here 246 | _StateT tmp(_S_opcode_alternative); | ^~~~~ In constructor ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:149:4, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:146:7, inlined from ‘std::__detail::_StateIdT std::detail::_NFA<_TraitsT>::_M_insert_subexpr_begin() [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_automaton.h:281:24, inlined from ‘std::detail::_Compiler<_TraitsT>::_Compiler(const _CharT, const _CharT, const typename _TraitsT::locale_type&, _FlagT) [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_compiler.tcc:75:20: /usr/include/c++/12/bits/std_function.h:405:42: error: ‘(std::function<bool(char)>)((char*)&tmp + offsetof(std::detail::_StateT, std::detail::_State::.std::detail::_State_base::)).std::function<bool(char)>::_M_invoker’ may be used uninitialized [-Werror=maybe-uninitialized] 405 | : _Function_base(), _M_invoker(x._M_invoker) | ~~^~~~ /usr/include/c++/12/bits/regex_automaton.h: In constructor ‘std::detail::_Compiler<_TraitsT>::_Compiler(const _CharT, const _CharT, const typename _TraitsT::locale_type&, _FlagT) [with _TraitsT = std::cxx11::regex_traits]’: /usr/include/c++/12/bits/regex_automaton.h:279:17: note: ‘tmp’ declared here 279 | _StateT tmp(_S_opcode_subexpr_begin); | ^~~~~ In member function ‘bool std::_Function_base::_M_empty() const’, inlined from ‘std::function<_Res(_ArgTypes ...)>::operator bool() const [with _Res = bool; _ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:574:25, inlined from ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:407:6, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:149:4, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:146:7, inlined from ‘std::detail::_StateIdT std::__detail::_NFA<_TraitsT>::_M_insert_subexpr_begin() [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_automaton.h:281:24, inlined from ‘std::detail::_Compiler<_TraitsT>::_Compiler(const _CharT, const _CharT, const typename _TraitsT::locale_type&, _FlagT) [with _TraitsT = std::__cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_compiler.tcc:75:20: /usr/include/c++/12/bits/std_function.h:247:37: error: ‘(const std::_Function_base)((char*)&tmp + offsetof(std::detail::_StateT, std::__detail::_State::.std::detail::_State_base::)).std::_Function_base::_M_manager’ may be used uninitialized [-Werror=maybe-uninitialized] 247 | bool _M_empty() const { return !_M_manager; } | ^~~~~~ /usr/include/c++/12/bits/regex_automaton.h: In constructor ‘std::detail::_Compiler<_TraitsT>::_Compiler(const _CharT, const _CharT, const typename _TraitsT::locale_type&, _FlagT) [with _TraitsT = std::cxx11::regex_traits]’: /usr/include/c++/12/bits/regex_automaton.h:279:17: note: ‘tmp’ declared here 279 | _StateT tmp(_S_opcode_subexpr_begin); | ^~~~~ In constructor ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:149:4, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:146:7, inlined from ‘std::detail::_StateIdT std::__detail::_NFA<_TraitsT>::_M_insert_word_bound(bool) [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_automaton.h:309:24, inlined from ‘bool std::detail::_Compiler<_TraitsT>::_M_assertion() [with _TraitsT = std::__cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_compiler.tcc:153:16: /usr/include/c++/12/bits/std_function.h:405:42: error: ‘(std::function<bool(char)>)((char*)&tmp + offsetof(std::detail::_StateT, std::__detail::_State::.std::detail::_State_base::)).std::function<bool(char)>::_M_invoker’ may be used uninitialized [-Werror=maybe-uninitialized] 405 | : _Function_base(), _M_invoker(x._M_invoker) | ~~^~~~ /usr/include/c++/12/bits/regex_automaton.h: In member function ‘bool std::__detail::_Compiler<_TraitsT>::_M_assertion() [with _TraitsT = std::cxx11::regex_traits]’: /usr/include/c++/12/bits/regex_automaton.h:307:17: note: ‘tmp’ declared here 307 | _StateT tmp(_S_opcode_word_boundary); | ^~~~~ In member function ‘bool std::_Function_base::_M_empty() const’, inlined from ‘std::function<_Res(_ArgTypes ...)>::operator bool() const [with _Res = bool; _ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:574:25, inlined from ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:407:6, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:149:4, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:146:7, inlined from ‘std::detail::_StateIdT std::detail::_NFA<_TraitsT>::_M_insert_word_bound(bool) [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_automaton.h:309:24, inlined from ‘bool std::detail::_Compiler<_TraitsT>::_M_assertion() [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_compiler.tcc:153:16: /usr/include/c++/12/bits/std_function.h:247:37: error: ‘(const std::_Function_base)((char*)&tmp + offsetof(std::detail::_StateT, std::detail::_State::.std::detail::_State_base::)).std::_Function_base::_M_manager’ may be used uninitialized [-Werror=maybe-uninitialized] 247 | bool _M_empty() const { return !_M_manager; } | ^~~~~~ /usr/include/c++/12/bits/regex_automaton.h: In member function ‘bool std::__detail::_Compiler<_TraitsT>::_M_assertion() [with _TraitsT = std::cxx11::regex_traits]’: /usr/include/c++/12/bits/regex_automaton.h:307:17: note: ‘tmp’ declared here 307 | _StateT tmp(_S_opcode_word_boundary); | ^~~~~ In constructor ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:149:4, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:146:7, inlined from ‘std::detail::_StateIdT std::detail::_NFA<_TraitsT>::_M_insert_lookahead(std::detail::_StateIdT, bool) [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_automaton.h:318:24, inlined from ‘bool std::detail::_Compiler<_TraitsT>::_M_assertion() [with _TraitsT = std::__cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_compiler.tcc:164:8: /usr/include/c++/12/bits/std_function.h:405:42: error: ‘(std::function<bool(char)>)((char*)&tmp + offsetof(std::detail::_StateT, std::__detail::_State::.std::detail::_State_base::)).std::function<bool(char)>::_M_invoker’ may be used uninitialized [-Werror=maybe-uninitialized] 405 | : _Function_base(), _M_invoker(x._M_invoker) | ~~^~~~ /usr/include/c++/12/bits/regex_automaton.h: In member function ‘bool std::__detail::_Compiler<_TraitsT>::_M_assertion() [with _TraitsT = std::cxx11::regex_traits]’: /usr/include/c++/12/bits/regex_automaton.h:315:17: note: ‘tmp’ declared here 315 | _StateT tmp(_S_opcode_subexpr_lookahead); | ^~~~~ In member function ‘bool std::_Function_base::_M_empty() const’, inlined from ‘std::function<_Res(_ArgTypes ...)>::operator bool() const [with _Res = bool; _ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:574:25, inlined from ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:407:6, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:149:4, inlined from ‘std::detail::_State<_Char_type>::_State(std::detail::_State<_Char_type>&&) [with _Char_type = char]’ at /usr/include/c++/12/bits/regex_automaton.h:146:7, inlined from ‘std::detail::_StateIdT std::detail::_NFA<_TraitsT>::_M_insert_lookahead(std::detail::_StateIdT, bool) [with _TraitsT = std::cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_automaton.h:318:24, inlined from ‘bool std::detail::_Compiler<_TraitsT>::_M_assertion() [with _TraitsT = std::__cxx11::regex_traits]’ at /usr/include/c++/12/bits/regex_compiler.tcc:164:8: /usr/include/c++/12/bits/std_function.h:247:37: error: ‘(const std::_Function_base)((char*)&tmp + offsetof(std::detail::_StateT, std::__detail::_State::.std::detail::_State_base::)).std::_Function_base::_M_manager’ may be used uninitialized [-Werror=maybe-uninitialized] 247 | bool _M_empty() const { return !_M_manager; } | ^~~~~~ /usr/include/c++/12/bits/regex_automaton.h: In member function ‘bool std::detail::_Compiler<_TraitsT>::_M_assertion() [with _TraitsT = std::cxx11::regex_traits]’: /usr/include/c++/12/bits/regex_automaton.h:315:17: note: ‘tmp’ declared here 315 | _StateT tmp(_S_opcode_subexpr_lookahead); | ^~~~~ cc1plus: all warnings being treated as errors gmake[2]: [source/matplot/CMakeFiles/matplot.dir/build.make:90: source/matplot/CMakeFiles/matplot.dir/backend/gnuplot.cpp.o] Error 1 gmake[2]: Waiting for unfinished jobs.... gmake[1]: [CMakeFiles/Makefile2:157: source/matplot/CMakeFiles/matplot.dir/all] Error 2 gmake: [Makefile:156: all] Error 2

```console # The output you got ``` Output as pasted above

Platform

Environment Details:

Additional context

suhasghorp commented 1 year ago

Compiler : gcc-12 on wsl2 linux on windows

alandefreitas commented 1 year ago

Is that using the master branch? GCC12 is being tested in CI

https://github.com/alandefreitas/matplotplusplus/actions/runs/5318331589/jobs/9629701081

suhasghorp commented 1 year ago

Yes, I am using master branch. When I re-built the package using system build presets, I worked and I have the library successfully built. However, when I try to save a test plot I get following error. I am on Ubuntu 20 on WSL2 (windows subsystem for Linux) which does not have any X windows server running, which is why I am "saving " the plot and not "showing" it.

qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

std::vector<double> x = matplot::linspace(0, 2 * matplot::pi);
std::vector<double> y = matplot::transform(x, [](auto x) { return sin(x); });
matplot::plot(x, y, "-o");
matplot::hold(matplot::on);
matplot::plot(x, matplot::transform(y, [](auto y) { return -y; }), "--xr");
matplot::plot(x, matplot::transform(x, [](auto x) { return x / matplot::pi - 1.; }), "-:gs");
matplot::plot({1.0, 0.7, 0.4, 0.0, -0.4, -0.7, -1}, "k");
matplot::save("./test.png", "png");

I have tried with jpg format as well.

When I was building the package, I got warningd (?) like below, so I am not sure if PNG is even supposed to work in my environment.

Setting global options
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (found version "80")
-- Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR)
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)

Thank you.

alandefreitas commented 1 year ago

Yes. Your error looks problematic because

/usr/include/c++/12/bits/std_function.h:405:42: error: ‘*(std::function<bool(char)>*)((char*)&__tmp + offsetof(std::__detail::_StateT, std::__detail::_State<char>::<unnamed>.std::__detail::_State_base::<unnamed>)).std::function<bool(char)>::_M_invoker’ may be used uninitialized [-Werror=maybe-uninitialized]

is a maybe-uninitialized error inside the STL. That's not supposed to happen unless there's some serious incompatibility between your compiler and the std library you're using.

alandefreitas commented 1 year ago

which is why I am "saving " the plot and not "showing" it.

The library depends on gnuplot for doing that. I don't know how to fix it, but basically if you can ensure gnuplot can save it in the environment you set up, then matplot will be able to save it as well.