Compiling CF on Raspberry Pi

If you're having trouble using Context Free or don't understand the language, ask for help here.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
thk123
Posts: 1
Joined: Mon Mar 27, 2017 2:02 pm

Compiling CF on Raspberry Pi

Post by thk123 »

Hi -- I would like to use Context Free at a Code Club as I think it would be a really good fit for some of the students.

I am trying to get it compiling on a Raspberry Pi 3 (Model B). I believe all the prerequisites are required, crucially it has g++ 4.9 which supports C++14.

I have fixed one problem to do with the "-march=native" flag, which I resolved by changing the "-march=armv6". I have also tried correcting the path to "libpng.a" to "/usr/lib/arm-linux-gnueabihf" as that's where is seems to reside.

Code: Select all

LIB_DIRS = $(FFMPEG_DIR)/lib /usr/lib/arm-linux-gnueabihf
However, I am now getting the following compile error:

Code: Select all

src-common/astexpression.cpp:2890:48: error: no match for ‘operator+=’ (operand types are ‘yy::location’ and ‘yy::location’)
                                 (*term)->where += (*term)->args->where;
                                                ^
I don't know enough about the code base to know what the cause of this could be. Any help would be massively appreciated, thanks in advance.

Full compile error:

Code: Select all

g++  -Isrc-common -Isrc-unix -Iobjs -Isrc-agg/include -Isrc-common/agg-extras -Isrc-ffmpeg/include -I/usr/local/include -O3 -Wall -march=armv6 -Wno-parentheses -std=c++14  -c -o objs/astexpression.o src-common/astexpression.cpp
src-common/astexpression.cpp: In member function ‘virtual AST::ASTexpression* AST::ASTmodification::compile(AST::CompilePhase)’:
src-common/astexpression.cpp:2890:48: error: no match for ‘operator+=’ (operand types are ‘yy::location’ and ‘yy::location’)
                                 (*term)->where += (*term)->args->where;
                                                ^
src-common/astexpression.cpp:2890:48: note: candidates are:
In file included from src-common/ast.h:34:0,
                 from src-common/astexpression.h:29,
                 from src-common/astexpression.cpp:26:
objs/location.hh:122:20: note: yy::location& yy::operator+=(yy::location&, int)
   inline location& operator+= (location& res, int width)
                    ^
objs/location.hh:122:20: note:   no known conversion for argument 2 from ‘yy::location’ to ‘int’
In file included from objs/location.hh:41:0,
                 from src-common/ast.h:34,
                 from src-common/astexpression.h:29,
                 from src-common/astexpression.cpp:26:
objs/position.hh:119:3: note: yy::position& yy::operator+=(yy::position&, int)
   operator+= (position& res, int width)
   ^
objs/position.hh:119:3: note:   no known conversion for argument 1 from ‘yy::location’ to ‘yy::position&’
Makefile:155: recipe for target 'objs/astexpression.o' failed
make: *** [objs/astexpression.o] Error 1

User avatar
MtnViewJohn
Site Admin
Posts: 875
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Compiling CF on Raspberry Pi

Post by MtnViewJohn »

The problem is that, although the cfdg.ypp file only uses features in Bison 2.5, I have Bison 3.04 installed on all my systems. This operator overload was added in Bison 3.03. I will log this as an issue and fix it in the next release. For now you have three options:
  1. Install Bison 3.04
  2. Replace the few instances of location1 += location2 with location1 = location1 + location2
  3. Stop building cfdg.l/cfdg.ypp and use the precompiled parser at src-win/derived
I can only see two places where this operator+= overload is used: astexpression.cpp and line 1027 in ast.cpp

Post Reply