0

There is a given r-tree code by Toni Guttman(it's been modified for my homework), however, if I change an parameter(the dimension of the node), then "make" will cause such errors:

yacc y.spec
make: yacc:command not found
make: *** [y.tab.c] error 127 

I've installed bison and flex, and "which yacc" shows that

alias yacc='bison'
/usr/bin/bison

What should I do to solve the problem?

Here is the "Makefile":

# %W% %G%
# use flag -O for optimized code, slower compile
FLAGS=

SRC= main.c index.c newtid.c node.c rectangle.c \
    printstats.c clock.c y.spec allocate.c error.c\
    split.l.c \
    split.q.c \
    split.e.c

HEADERS= options.h macros.h index.h assert.h

ALL= $(SRC) $(HEADERS) split.l.h split.q.h split.e.h

OBJ= main.o index.o newtid.o node.o rectangle.o \
    printstats.o clock.o y.tab.o allocate.o error.o

OBJLIN= split.l.o
OBJQ= split.q.o
OBJEXP= split.e.o

$(OBJ): $(HEADERS)
$(OBJLIN): $(HEADERS) split.l.h
$(OBJQ): $(HEADERS) split.q.h
$(OBJEXP): $(HEADERS) split.e.h

# assembler chokes if graphics.c is compiled with -g option, do it without.
# graphics.o: graphics.c $(HEADERS)
#   cc -c graphics.c

# assembler chokes if y.tab.c is compiled with -g option, do it without.
# y.tab.o: y.tab.c $(HEADERS)
#   cc -c y.tab.c

.c.o: $(HEADERS)
    cc -c $(FLAGS) $*.c

linear: $(OBJ) $(OBJLIN)
    cc $(FLAGS) $(OBJ) $(OBJLIN) -lm -o linear

quad: $(OBJ) $(OBJQ)
    cc $(FLAGS) $(OBJ) $(OBJQ) -lm -o quad

exp: $(OBJ) $(OBJEXP)
    cc $(FLAGS) $(OBJ) $(OBJEXP) -lm -o exp

y.tab.c: y.spec $(HEADERS)
    yacc y.spec

edit:
    sccs edit $(SRC) $(HEADERS) split.l.h split.q.h split.o.h

unedit:
    sccs unedit $(ALL)
    rm -f tags

delta:
    sccs delta $(ALL)
    rm -f tags

get:
    sccs get $(ALL)

clean:
    rm -f *.o core y.tab.c tags

tags: $(SRC)
    ctags *.c

lint:
    rm -f lint.out
    lint *.c > lint.out
user2358561
  • 51
  • 1
  • 2
  • 5
  • please refer this solution: [add alias to solve it][1] [1]: http://stackoverflow.com/questions/10733238/make-yacc-command-not-found-after-installing-bison – winningsix Oct 21 '14 at 02:35

2 Answers2

2

You don't have yacc installed, as you've seen. Changing an alias in your shell won't help, because it's make that is trying to run the yacc command, not the shell. You have to edit your makefile, and add a line like:

YACC = bison -y

(the -y flag makes bison behave like yacc)

Since you didn't show your actual makefile we can't be sure that this will do it, but it's likely.

EDIT:

I your makefile above, change the reference to yacc to say bison -y instead.

Your makefile is not following many best practices but that's for another day.

MadScientist
  • 92,819
  • 9
  • 109
  • 136
1

manually add this script /usr/bin/yacc is simply a script containing:

#! /bin/sh
exec '/usr/bin/bison' -y "$@"
winningsix
  • 101
  • 4