Ошибка построения CXX-объекта gnuradio-runtime - PullRequest
1 голос
/ 10 февраля 2020

Я пытаюсь установить указанную c версию gnuradio (3.7.10.1). Для этого я не использую Pybombs, но я пытаюсь сделать это из исходного кода (я слежу за this ).

Сначала я клонировал репозиторий github, затем извлекаю соответствующую версию , Он работал нормально, пока я не попытался вызвать CMake и собрать GNU Radio:

mkdir build
cd build
cmake ../
make

Во время make , после 6% выполнения, у меня появляется следующая ошибка:

In file included from /usr/include/c++/7/type_traits:35:0,
                 from /usr/include/cppunit/tools/StringHelper.h:7,
                 from /usr/include/cppunit/TestAssert.h:8,
                 from /usr/include/cppunit/TestCase.h:6,
                 from /usr/include/cppunit/TestCaller.h:5,
                 from /usr/include/cppunit/extensions/HelperMacros.h:9,
                 from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:26,
                 from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.cc:27:
/usr/include/c++/7/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^~~~~
In file included from /usr/include/cppunit/TestAssert.h:8:0,
                 from /usr/include/cppunit/TestCase.h:6,
                 from /usr/include/cppunit/TestCaller.h:5,
                 from /usr/include/cppunit/extensions/HelperMacros.h:9,
                 from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:26,
                 from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.cc:27:
/usr/include/cppunit/tools/StringHelper.h:22:15: error: ‘enable_if’ in namespace ‘std’ does not name a template type
 typename std::enable_if<!std::is_enum<T>::value, std::string>::type toString(const T& x)
               ^~~~~~~~~
/usr/include/cppunit/tools/StringHelper.h:22:24: error: expected unqualified-id before ‘<’ token
 typename std::enable_if<!std::is_enum<T>::value, std::string>::type toString(const T& x)
                        ^
/usr/include/cppunit/tools/StringHelper.h:31:15: error: ‘enable_if’ in namespace ‘std’ does not name a template type
 typename std::enable_if<std::is_enum<T>::value, std::string>::type toString(const T& x)
               ^~~~~~~~~
/usr/include/cppunit/tools/StringHelper.h:31:24: error: expected unqualified-id before ‘<’ token
 typename std::enable_if<std::is_enum<T>::value, std::string>::type toString(const T& x)

In file included from /usr/include/cppunit/TestCase.h:6:0,
                 from /usr/include/cppunit/TestCaller.h:5,
                 from /usr/include/cppunit/extensions/HelperMacros.h:9,
                 from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:26,
                 from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.cc:27:
/usr/include/cppunit/TestAssert.h: In static member function ‘static std::__cxx11::string CppUnit::assertion_traits<T>::toString(const T&)’:
/usr/include/cppunit/TestAssert.h:74:42: error: ‘toString’ is not a member of ‘CppUnit::StringHelper’
         return CPPUNIT_NS::StringHelper::toString(x);
                                          ^~~~~~~~
In file included from /usr/include/cppunit/extensions/HelperMacros.h:9:0,
                 from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:26,
                 from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.cc:27:
/usr/include/cppunit/TestCaller.h: At global scope:
/usr/include/cppunit/TestCaller.h:159:37: error: ‘std::function’ has not been declared
   TestCaller(std::string name, std::function<void()> test_function, Fixture* fixture):
                                     ^~~~~~~~
/usr/include/cppunit/TestCaller.h:159:45: error: expected ‘,’ or ‘...’ before ‘<’ token
   TestCaller(std::string name, std::function<void()> test_function, Fixture* fixture):
                                             ^
/usr/include/cppunit/TestCaller.h:200:8: error: ‘function’ in namespace ‘std’ does not name a template type
   std::function<void()> m_test_function;
        ^~~~~~~~
/usr/include/cppunit/TestCaller.h: In constructor ‘CppUnit::TestCaller<Fixture>::TestCaller(std::__cxx11::string, CppUnit::TestCaller<Fixture>::TestMethod)’:
/usr/include/cppunit/TestCaller.h:121:6: error: class ‘CppUnit::TestCaller<Fixture>’ does not have any field named ‘m_test_function’
      m_test_function( std::bind(test, m_fixture) )
      ^~~~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h:121:28: error: ‘bind’ is not a member of ‘std’
      m_test_function( std::bind(test, m_fixture) )
                            ^~~~
/usr/include/cppunit/TestCaller.h:121:28: note: suggested alternative: ‘find’
      m_test_function( std::bind(test, m_fixture) )
                            ^~~~
                            find
/usr/include/cppunit/TestCaller.h: In constructor ‘CppUnit::TestCaller<Fixture>::TestCaller(std::__cxx11::string, CppUnit::TestCaller<Fixture>::TestMethod, Fixture&)’:
/usr/include/cppunit/TestCaller.h:138:6: error: class ‘CppUnit::TestCaller<Fixture>’ does not have any field named ‘m_test_function’
      m_test_function( std::bind(test, &fixture) )
      ^~~~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h:138:28: error: ‘bind’ is not a member of ‘std’
      m_test_function( std::bind(test, &fixture) )
                            ^~~~
/usr/include/cppunit/TestCaller.h:138:28: note: suggested alternative: ‘find’
      m_test_function( std::bind(test, &fixture) )
                            ^~~~
                            find
/usr/include/cppunit/TestCaller.h: In constructor ‘CppUnit::TestCaller<Fixture>::TestCaller(std::__cxx11::string, CppUnit::TestCaller<Fixture>::TestMethod, Fixture*)’:
/usr/include/cppunit/TestCaller.h:155:6: error: class ‘CppUnit::TestCaller<Fixture>’ does not have any field named ‘m_test_function’
      m_test_function( std::bind(test, fixture) )
      ^~~~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h:155:28: error: ‘bind’ is not a member of ‘std’
      m_test_function( std::bind(test, fixture) )
                            ^~~~
/usr/include/cppunit/TestCaller.h:155:28: note: suggested alternative: ‘find’
      m_test_function( std::bind(test, fixture) )
                            ^~~~
                            find
/usr/include/cppunit/TestCaller.h: In constructor ‘CppUnit::TestCaller<Fixture>::TestCaller(std::__cxx11::string, int)’:
/usr/include/cppunit/TestCaller.h:162:17: error: ‘fixture’ was not declared in this scope
       m_fixture(fixture),
                 ^~~~~~~
/usr/include/cppunit/TestCaller.h:162:17: note: suggested alternative: ‘Fixture’
       m_fixture(fixture),
                 ^~~~~~~
                 Fixture
/usr/include/cppunit/TestCaller.h:163:7: error: class ‘CppUnit::TestCaller<Fixture>’ does not have any field named ‘m_test_function’
       m_test_function(test_function)
       ^~~~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h:163:23: error: ‘test_function’ was not declared in this scope
       m_test_function(test_function)
                       ^~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h: In member function ‘void CppUnit::TestCaller<Fixture>::runTest()’:
/usr/include/cppunit/TestCaller.h:175:7: error: there are no arguments to ‘m_test_function’ that depend on a template parameter, so a declaration of ‘m_test_function’ must be available [-fpermissive]
       m_test_function();
       ^~~~~~~~~~~~~~~
/usr/include/cppunit/TestCaller.h:175:7: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
In file included from /usr/include/cppunit/extensions/HelperMacros.h:14:0,
                 from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:26,
                 from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.cc:27:
/usr/include/cppunit/extensions/TestNamer.h: In member function ‘std::__cxx11::string CppUnit::TestNamer::getTestNameFor(const string&, const E&) const’:
/usr/include/cppunit/extensions/TestNamer.h:70:95: error: ‘toString’ is not a member of ‘CppUnit::StringHelper’
  return getTestNameFor(testMethodName) + " with parameter: " + CPPUNIT_NS::StringHelper::toString(val);
                                                                                          ^~~~~~~~
In file included from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:26:0,
                 from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.cc:27:
/home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h: In static member function ‘static CppUnit::TestSuite* qa_fxpt::suite()’:
/home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:36:3: error: ‘unique_ptr’ is not a member of ‘std’
   CPPUNIT_TEST_SUITE_END();
   ^
/home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:36:3: error: expected primary-expression before ‘>’ token
   CPPUNIT_TEST_SUITE_END();
   ^
/home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:36:3: error: ‘guard’ was not declared in this scope
   CPPUNIT_TEST_SUITE_END();
   ^
In file included from /usr/include/cppunit/extensions/HelperMacros.h:9:0,
                 from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.h:26,
                 from /home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.cc:27:
/usr/include/cppunit/TestCaller.h: In instantiation of ‘void CppUnit::TestCaller<Fixture>::runTest() [with Fixture = qa_fxpt]’:
/home/cofex/workarea/gnuradio/gnuradio-runtime/lib/math/qa_fxpt.cc:102:1:   required from here
/usr/include/cppunit/TestCaller.h:175:22: error: ‘m_test_function’ was not declared in this scope
       m_test_function();
       ~~~~~~~~~~~~~~~^~
/usr/include/cppunit/TestCaller.h:175:22: note: suggested alternative: ‘__fortify_function’
       m_test_function();
       ~~~~~~~~~~~~~~~^~
       __fortify_function
gnuradio-runtime/lib/CMakeFiles/test-gnuradio-runtime.dir/build.make:62: recipe for target 'gnuradio-runtime/lib/CMakeFiles/test-gnuradio-runtime.dir/math/qa_fxpt.cc.o' failed
make[2]: *** [gnuradio-runtime/lib/CMakeFiles/test-gnuradio-runtime.dir/math/qa_fxpt.cc.o] Error 1
CMakeFiles/Makefile2:726: recipe for target 'gnuradio-runtime/lib/CMakeFiles/test-gnuradio-runtime.dir/all' failed
make[1]: *** [gnuradio-runtime/lib/CMakeFiles/test-gnuradio-runtime.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

Я не эксперт Linux, и я не очень знаком с этой поддержкой компилятора / библиотеки. Я не очень понимаю, откуда возникла ошибка и как ее исправить. Я пользуюсь Ubuntu 18.04.

Пожалуйста, помогите мне? Любая помощь будет принята с благодарностью. Большое спасибо.

1 Ответ

1 голос
/ 10 февраля 2020

/ usr / include / c ++ / 7 / bits / c ++ 0x_warning.h: 32: 2: error: #error Этот файл требует поддержки компилятора и библиотеки для стандарта ISO C ++ 2011. Эта поддержка должна быть включена с помощью параметров компилятора -std = c ++ 11 или -std = gnu ++ 11.

Чтобы устранить вышеуказанную ошибку, необходимо скомпилировать с флагом -std=c++11. Откройте CMakeLists.txt, найдите все вхождения или -std=c++98 и измените их на -std=c++11. Затем go в каталог build, удалите CMakeCache.txt и пересоберите

sed -i 's/-std=c++98/-std=c++11/g' CMakeLists.txt
cd build
rm CMakeCache.txt
cmake ..
make

Также, поскольку ошибка в cppunit и она используется для тестирования, вы можете попробовать отключить все тесты

cd build
rm CMakeCache.txt
cmake -DENABLE_TESTING=OFF ..
make
...