ircam-ismm / pipo

pipo modules library
https://ircam-ismm.github.io/pipo
27 stars 2 forks source link

Build errors in PipoCollection.cpp and PipoGraph.h #9

Closed sensestage closed 5 years ago

sensestage commented 5 years ago

I'm building from the rapidmixapi library with the cmake build setup from there. I'm getting the errors below, caused by the pipo library.

Building CXX object CMakeFiles/RAPID-MIX_API.dir/dependencies/pipo/modules/collection/PiPoCollection.cpp.o
In file included from RAPID-MIX_API/dependencies/pipo/modules/collection/PiPoCollection.cpp:42:0:
RAPID-MIX_API/dependencies/pipo/sdk/src/host/PiPoGraph.h: In member function ‘bool PiPoGraph::parse(std::__cxx11::string)’:
RAPID-MIX_API/dependencies/pipo/sdk/src/host/PiPoGraph.h:217:84: error: cannot convert ‘std::__cxx11::basic_string<char>::iterator {aka __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >}’ to ‘const char*’ for argument ‘1’ to ‘int remove(const char*)’
           std::remove(this->representation.begin(), this->representation.end(), ' '),
                                                                                    ^
In file included from RAPID-MIX_API/dependencies/pipo/modules/PiPoBands.h:48:0,
                 from RAPID-MIX_API/dependencies/pipo/modules/collection/PiPoCollection.cpp:45:
RAPID-MIX_API/dependencies/pipo/modules/rta/src/util/rta_complex.h: At global scope:
RAPID-MIX_API/dependencies/pipo/modules/rta/src/util/rta_complex.h:284:29: error: expected initializer before ‘rta_make_complex’
 static inline rta_complex_t rta_make_complex(float real, float imag)
                             ^
RAPID-MIX_API/dependencies/pipo/modules/PiPoBands.h: In member function ‘virtual int PiPoBands::frames(double, double, PiPoValue*, unsigned int, unsigned int)’:
RAPID-MIX_API/dependencies/pipo/modules/rta/src/util/rta_complex.h:283:23: error: expected primary-expression before ‘float’
 #define rta_complex_t float complex
                       ^
RAPID-MIX_API/dependencies/pipo/modules/PiPoBands.h:261:33: note: in expansion of macro ‘rta_complex_t’
           spectrum[i] = cabsf(((rta_complex_t *) values)[i]);
                                 ^
RAPID-MIX_API/dependencies/pipo/modules/rta/src/util/rta_complex.h:283:23: error: expected ‘)’ before ‘float’
 #define rta_complex_t float complex
                       ^
RAPID-MIX_API/dependencies/pipo/modules/PiPoBands.h:261:33: note: in expansion of macro ‘rta_complex_t’
           spectrum[i] = cabsf(((rta_complex_t *) values)[i]);
                                 ^
In file included from RAPID-MIX_API/dependencies/pipo/modules/collection/PiPoCollection.cpp:45:0:
RAPID-MIX_API/dependencies/pipo/modules/PiPoBands.h:261:61: error: expected ‘)’ before ‘;’ token
           spectrum[i] = cabsf(((rta_complex_t *) values)[i]);
                                                             ^
In file included from RAPID-MIX_API/dependencies/pipo/modules/collection/PiPoCollection.cpp:49:0:
RAPID-MIX_API/dependencies/pipo/modules/PiPoConst.h: In constructor ‘PiPoConst::PiPoConst(PiPo::Parent*, PiPo*)’:
RAPID-MIX_API/dependencies/pipo/modules/PiPoConst.h:78:53: warning: passing NULL to non-pointer argument 1 of ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = float; _Alloc = std::allocator<float>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<float>]’ [-Wconversion-null]
   numCols(0), maxDescrNameLength(64), outValues(NULL)
                                                     ^
In file included from RAPID-MIX_API/dependencies/pipo/modules/PiPoFft.h:47:0,
                 from RAPID-MIX_API/dependencies/pipo/modules/collection/PiPoCollection.cpp:53:
RAPID-MIX_API/dependencies/pipo/modules/rta/src/signal/rta_fft.h: At global scope:
RAPID-MIX_API/dependencies/pipo/modules/rta/src/signal/rta_fft.h:204:33: error: expected ‘,’ or ‘...’ before ‘*’ token
                   rta_complex_t * input, const unsigned int input_size,
                                 ^
RAPID-MIX_API/dependencies/pipo/modules/rta/src/signal/rta_fft.h:250:17: error: expected ‘,’ or ‘...’ before ‘*’ token
   rta_complex_t * input, const int i_stride, const unsigned int input_size,
                 ^
In file included from RAPID-MIX_API/dependencies/pipo/modules/PiPoBiquad.h:54:0,
                 from RAPID-MIX_API/dependencies/pipo/modules/collection/PiPoCollection.cpp:47:
RAPID-MIX_API/dependencies/pipo/modules/rta/src/signal/rta_biquad.h:575:26: warning: inline function ‘float rta_biquad_df1_stride(float, const float*, int, const float*, int, float*, int)’ used but never defined
 extern inline rta_real_t rta_biquad_df1_stride(
                          ^
RAPID-MIX_API/dependencies/pipo/modules/rta/src/signal/rta_biquad.h:614:26: warning: inline function ‘float rta_biquad_df2t_stride(float, const float*, int, const float*, int, float*, int)’ used but never defined
 extern inline rta_real_t rta_biquad_df2t_stride(
diemoschwarz commented 5 years ago

Hi, could you give more details please? Which system, os, compiler and ide version, rapidmix repo?

sensestage commented 5 years ago

master of rapidmix repo: http://gitlab.doc.gold.ac.uk/rapid-mix/RAPID-MIX_API.git

Linux Xubuntu Xenial. I'm building with Cmake from the command line. g++ (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904

diemoschwarz commented 5 years ago

Confirmed, it compiles for Mac but not Linux. There is something going wrong with the (re-)definition of rta_complex_t in dependencies/pipo/modules/rta/src/util/rta_complex.h

sensestage commented 5 years ago

I just updated my system and the problem persists at Xubuntu 18.04. g++ (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0

Also there is already an error before the one in rta_complex - in PipoGraph.h (also at the top of the previous output listing):

/pipo/sdk/src/host/PiPoGraph.h:217:84: error: cannot convert ‘std::__cxx11::basic_string<char>::iterator {aka __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >}’ to ‘const char*’ for argument ‘1’ to ‘int remove(const char*)’
           std::remove(this->representation.begin(), this->representation.end(), ' '),
diemoschwarz commented 5 years ago

after an updated compiler detection in rta_complex.h, it works on Linux now with latest branches develop for sdk and master for rta submodules. note the needed compiler flags, see build/linux/makefile:

# with gnu c++ everything is easy CXXFLAGS += $(FLAGS) -std=gnu++11

# with clang, -fext-numeric-literals is needed for complex definition CXXFLAGS += $(FLAGS) -std=c++11 -fext-numeric-literals

sensestage commented 5 years ago

ok, I can get pipo itself now to build, modifying to use the changed CXXFlags, but not yet from the RAPIDMIX API cmake build....

sensestage commented 5 years ago

ok - added in the CMakeLists of RAPIDMIX API the line:

# added for pipo
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
sensestage commented 5 years ago

One more addition needed there to link to pthreads.

find_package (Threads)
target_link_libraries(RAPID-MIX_API ${CMAKE_THREAD_LIBS_INIT})

(It seems a bit more tricky to file issues with the RAPIDMIX API gitlab repo, so that's why I put them here - as reference for people who might run into the same issues in the future.)