[GRASS5] Next 5.7 link problem

Hi

I left nls of and now have the next error:

gcc -rdynamic
-L/usr/src/packages/BUILD/grass57_exp_2003_11_08/dist.i686-pc-linux-gnu/l
ib -o
/usr/src/packages/BUILD/grass57_exp_2003_11_08/dist.i686-pc-linux-gnu/etc
/bin/cmd/r.mapcalc OBJ.i686-pc-linux-gnu/check.o
OBJ.i686-pc-linux-gnu/evaluate.o OBJ.i686-pc-linux-gnu/expression.o
OBJ.i686-pc-linux-gnu/function.o OBJ.i686-pc-linux-gnu/main.o
OBJ.i686-pc-linux-gnu/map.o OBJ.i686-pc-linux-gnu/xabs.o
OBJ.i686-pc-linux-gnu/xadd.o OBJ.i686-pc-linux-gnu/xand.o
OBJ.i686-pc-linux-gnu/xatan.o OBJ.i686-pc-linux-gnu/xcoor.o
OBJ.i686-pc-linux-gnu/xcos.o OBJ.i686-pc-linux-gnu/xdiv.o
OBJ.i686-pc-linux-gnu/xdouble.o OBJ.i686-pc-linux-gnu/xeq.o
OBJ.i686-pc-linux-gnu/xeval.o OBJ.i686-pc-linux-gnu/xexp.o
OBJ.i686-pc-linux-gnu/xfloat.o OBJ.i686-pc-linux-gnu/xge.o
OBJ.i686-pc-linux-gnu/xgt.o OBJ.i686-pc-linux-gnu/xif.o
OBJ.i686-pc-linux-gnu/xint.o OBJ.i686-pc-linux-gnu/xisnull.o
OBJ.i686-pc-linux-gnu/xle.o OBJ.i686-pc-linux-gnu/xlog.o
OBJ.i686-pc-linux-gnu/xlt.o OBJ.i686-pc-linux-gnu/xmax.o
OBJ.i686-pc-linux-gnu/xmedian.o OBJ.i686-pc-linux-gnu/xmin.o
OBJ.i686-pc-linux-gnu/xmod.o OBJ.i686-pc-linux-gnu/xmode.o
OBJ.i686-pc-linux-gnu/xmul.o OBJ.i686-pc-linux-gnu/xne.o
OBJ.i686-pc-linux-gnu/xneg.o OBJ.i686-pc-linux-gnu/xnot.o
OBJ.i686-pc-linux-gnu/xnull.o OBJ.i686-pc-linux-gnu/xor.o
OBJ.i686-pc-linux-gnu/xpow.o OBJ.i686-pc-linux-gnu/xrand.o
OBJ.i686-pc-linux-gnu/xres.o OBJ.i686-pc-linux-gnu/xround.o
OBJ.i686-pc-linux-gnu/xrowcol.o OBJ.i686-pc-linux-gnu/xsin.o
OBJ.i686-pc-linux-gnu/xsqrt.o OBJ.i686-pc-linux-gnu/xsub.o
OBJ.i686-pc-linux-gnu/xtan.o -lgrass_gis -lgrass_datetime -lgrass_btree
-lgrass_rowio -lreadline -lhistory -lm -lz
OBJ.i686-pc-linux-gnu/expression.o(.text+0x53c): In function `variable':
/usr/src/packages/BUILD/grass57_exp_2003_11_08/raster/r.mapcalc/expressio
n.c:199: undefined reference to `syntax_error'
OBJ.i686-pc-linux-gnu/expression.o(.text+0x5dc): In function `mapname':
/usr/src/packages/BUILD/grass57_exp_2003_11_08/raster/r.mapcalc/expressio
n.c:208: undefined reference to `syntax_error'
OBJ.i686-pc-linux-gnu/expression.o(.text+0x721): In function `operator':
/usr/src/packages/BUILD/grass57_exp_2003_11_08/raster/r.mapcalc/expressio
n.c:261: undefined reference to `syntax_error'
OBJ.i686-pc-linux-gnu/expression.o(.text+0x80d):/usr/src/packages/BUILD/g
rass57_exp_2003_11_08/raster/r.mapcalc/expression.c:253: undefined
reference to `syntax_error'
OBJ.i686-pc-linux-gnu/main.o(.text+0x217): In function `main':
/usr/src/packages/BUILD/grass57_exp_2003_11_08/raster/r.mapcalc/main.c:12
2: undefined reference to `parse_string'
OBJ.i686-pc-linux-gnu/main.o(.text+0x279):/usr/src/packages/BUILD/grass57
_exp_2003_11_08/raster/r.mapcalc/main.c:147: undefined reference to
`parse_stream'
collect2: ld returned 1 exit status

Any hints?

Ciao,
  Jens

Jens Oberender wrote:

I left nls of and now have the next error:

OBJ.i686-pc-linux-gnu/expression.o(.text+0x53c): In function `variable':
/usr/src/packages/BUILD/grass57_exp_2003_11_08/raster/r.mapcalc/expressio
n.c:199: undefined reference to `syntax_error'

OBJ.i686-pc-linux-gnu/main.o(.text+0x217): In function `main':
/usr/src/packages/BUILD/grass57_exp_2003_11_08/raster/r.mapcalc/main.c:12
2: undefined reference to `parse_string'

OBJ.i686-pc-linux-gnu/main.o(.text+0x279):/usr/src/packages/BUILD/grass57
_exp_2003_11_08/raster/r.mapcalc/main.c:147: undefined reference to
`parse_stream'

Any hints?

This is a known problem with the 5.7 build system. It constructs the
list of .o files to build from the list of the .c files which
initially exist in the directory. Anything for which the source file
isn't a .c file won't be built. In the case of r.mapcalc, one of the
source files is lex file (mapcalc.l) and another is a yacc file
(mapcalc.y). The undefined functions are defined in mapcalc.y.

Whilst the Makefile does have the necessary rules to build the
intermediate C files (lex.yy.c and y.tab.c), those .c files don't
exist at the point that the list of .o files is constructed, so they
never get compiled.

If you build the underlying 5.3 tree first (assuming that you did
"make mix" rather than "make copymix"), that will generate lex.yy.c
and y.tab.c, and 5.7 should then build correctly. Alternatively, you
should be able to generate those files manually with something like:

  make -C raster/r.mapcalc lex.yy.c y.tab.c

--
Glynn Clements <glynn.clements@virgin.net>

On Friday 14 November 2003 21:12, you wrote:

Jens Oberender wrote:
> I left nls of and now have the next error:
>
> OBJ.i686-pc-linux-gnu/expression.o(.text+0x53c): In function `variable':
> /usr/src/packages/BUILD/grass57_exp_2003_11_08/raster/r.mapcalc/expressio
> n.c:199: undefined reference to `syntax_error'
>
> OBJ.i686-pc-linux-gnu/main.o(.text+0x217): In function `main':
> /usr/src/packages/BUILD/grass57_exp_2003_11_08/raster/r.mapcalc/main.c:12
> 2: undefined reference to `parse_string'
>
> OBJ.i686-pc-linux-gnu/main.o(.text+0x279):/usr/src/packages/BUILD/grass57
> _exp_2003_11_08/raster/r.mapcalc/main.c:147: undefined reference to
> `parse_stream'
>
> Any hints?

This is a known problem with the 5.7 build system. It constructs the
list of .o files to build from the list of the .c files which
initially exist in the directory. Anything for which the source file
isn't a .c file won't be built. In the case of r.mapcalc, one of the
source files is lex file (mapcalc.l) and another is a yacc file
(mapcalc.y). The undefined functions are defined in mapcalc.y.

Whilst the Makefile does have the necessary rules to build the
intermediate C files (lex.yy.c and y.tab.c), those .c files don't
exist at the point that the list of .o files is constructed, so they
never get compiled.

If you build the underlying 5.3 tree first (assuming that you did
"make mix" rather than "make copymix"), that will generate lex.yy.c
and y.tab.c, and 5.7 should then build correctly. Alternatively, you
should be able to generate those files manually with something like:

  make -C raster/r.mapcalc lex.yy.c y.tab.c

There is a list of all .o files in the Makefile, the only problem IMHO was,
that it was called OBJ instead of CMD_OBJS.

Radim