• SoftwareFaust
  • faust2bela results in errors when building render.cpp

Hi,
I followed this guide to run Faust code on Bela. Unfortunately when I run faust2bela -tobela simpleFX_Analog.dsp I get a bunch of compiler errors.
Bela image: v0.3.6b
Faust version from the guide, so 09ad59955eccb522382d60d58fb648e9b0fb4a78

Am I doing something wrong? Thanks in advance.

Compiler output:

Building render.cpp...
/root/Bela/projects/simple/render.cpp:8545:17: error: use of undeclared identifier 'itemInfo'
    std::vector<itemInfo*> fUiItems;     
                ^
/root/Bela/projects/simple/render.cpp:8545:26: error: expected expression
    std::vector<itemInfo*> fUiItems;     
                         ^
/root/Bela/projects/simple/render.cpp:8642:21: error: use of undeclared identifier 'itemInfo'
        std::vector<itemInfo*>::iterator it;
                    ^
/root/Bela/projects/simple/render.cpp:8642:30: error: expected expression
        std::vector<itemInfo*>::iterator it;
                             ^
/root/Bela/projects/simple/render.cpp:8642:31: error: no type named 'iterator' in the global namespace; did you mean 'MidiMeta::iterator'?
        std::vector<itemInfo*>::iterator it;
                              ^~~~~~~~~~
                              MidiMeta::iterator
/usr/bin/../lib/gcc/arm-linux-gnueabihf/6.3.0/../../../../include/c++/6.3.0/bits/stl_map.h:149:58: note: 'MidiMeta::iterator' declared here
      typedef typename _Rep_type::iterator               iterator;
                                                         ^
/root/Bela/projects/simple/render.cpp:8644:37: error: member reference type 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >' is not a pointer; did you mean to use '.'?
            std::string type = (*it)->type;
                               ~~~~~^~
                                    .
/root/Bela/projects/simple/render.cpp:8644:39: error: no member named 'type' in 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >'
            std::string type = (*it)->type;
                               ~~~~~  ^
/root/Bela/projects/simple/render.cpp:8663:37: error: member reference type 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >' is not a pointer; did you mean to use '.'?
            std::string type = (*it)->type;
                               ~~~~~^~
                                    .
/root/Bela/projects/simple/render.cpp:8663:39: error: no member named 'type' in 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >'
            std::string type = (*it)->type;
                               ~~~~~  ^
/root/Bela/projects/simple/render.cpp:8666:26: error: member reference type 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >' is not a pointer; did you mean to use '.'?
                if ((*it)->address != "") {
                    ~~~~~^~
                         .
/root/Bela/projects/simple/render.cpp:8666:28: error: no member named 'address' in 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >'
                if ((*it)->address != "") {
                    ~~~~~  ^
/root/Bela/projects/simple/render.cpp:8667:42: error: member reference type 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >' is not a pointer; did you mean to use '.'?
                    fPathInputTable[(*it)->address] = std::make_pair(std::atoi((*it)->index.c_str()), &fInControl[counterIn]);
                                    ~~~~~^~
                                         .
/root/Bela/projects/simple/render.cpp:8667:44: error: no member named 'address' in 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >'
                    fPathInputTable[(*it)->address] = std::make_pair(std::atoi((*it)->index.c_str()), &fInControl[counterIn]);
                                    ~~~~~  ^
/root/Bela/projects/simple/render.cpp:8667:85: error: member reference type 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >' is not a pointer; did you mean to use '.'?
                    fPathInputTable[(*it)->address] = std::make_pair(std::atoi((*it)->index.c_str()), &fInControl[counterIn]);
                                                                               ~~~~~^~
                                                                                    .
/root/Bela/projects/simple/render.cpp:8667:87: error: no member named 'index' in 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >'
                    fPathInputTable[(*it)->address] = std::make_pair(std::atoi((*it)->index.c_str()), &fInControl[counterIn]);
                                                                               ~~~~~  ^
/root/Bela/projects/simple/render.cpp:8669:55: error: member reference type 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >' is not a pointer; did you mean to use '.'?
                fInControl[counterIn] = STR2REAL((*it)->init);
                                                 ~~~~~^~
                                                      .
/root/Bela/projects/simple/render.cpp:8669:57: error: no member named 'init' in 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >'
                fInControl[counterIn] = STR2REAL((*it)->init);
                                                 ~~~~~  ^
/root/Bela/projects/simple/render.cpp:8674:26: error: member reference type 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >' is not a pointer; did you mean to use '.'?
                if ((*it)->address != "") {
                    ~~~~~^~
                         .
/root/Bela/projects/simple/render.cpp:8674:28: error: no member named 'address' in 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >'
                if ((*it)->address != "") {
                    ~~~~~  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Makefile:434: recipe for target '/root/Bela/projects/simple/build/render.o' failed
make: *** [/root/Bela/projects/simple/build/render.o] Error 1

Hmm are you 100% sure you are running the correct version of Faust? Note that it's not enough to have it checked out and running that command within it: you must actually make install it.

I've also tried to upload render.cpp I got from https://faust.grame.fr/tools/editor/ and I got the same errors, so my local Faust is maybe not the cause. I will try to flash the sd again, maybe I messed it up while trying to set up distcc. I had it working before with some older Bela image and just recently updated to v0.3.6b.

it's not about the image, I am sure: the faust-generated file is supposed to be self-contained except for some system-wide headers, but in your case you are not missing an #include'd file, but there is a type that is not defined in the file.

The file you'd get from the online editor will probably be the latest release (i.e.: not 09ad59955eccb522382d60d58fb648e9b0fb4a78).
And I confirm that with 09ad59955eccb522382d60d58fb648e9b0fb4a78, faust2bela -tobela simpleFX_Analog.dsp works fine.

Right, so now I downloaded the latest commit of Faust from master-dev, and I get the same error as you. If I run faust2bela with -soundfile it works. Created issue upstream: https://github.com/grame-cncm/faust/issues/310 .

    giuliomoro yes, you are right! with 09ad59955eccb522382d60d58fb648e9b0fb4a78 it works fine. My stupid mistake was that I just copy-pasted instructions from the guide without paying attention and there cd faust and git checkout are in wrong order:

    git clone https://github.com/grame-cncm/faust.git &&\
    git checkout 09ad59955eccb522382d60d58fb648e9b0fb4a78 &&\
    cd faust &&\
    make -j4 &&\
    sudo make install

    Thanks a lot for the help!

      anton cd faust and git checkout are in wrong order:

      I see, but then the command chain should have failed, given how they are chained with && that should only execute the next one if the previous one succeeds. Anyhow, I fixed the wiki now, thanks.