Subject: bug#21373: compile for development version from git fails on OpenBSD

From: Jamil Egdemir <[email-masked]>
Date: Sat, 29 Aug 2015 16:36:24 -0400

[email-masked] writes:

>> flex -t ./c-tokenize.lex > c-tokenize.c || { rm c-tokenize.c; false; }
>> "./c-tokenize.lex", line 1: unrecognized '%' directive
>> "./c-tokenize.lex", line 7: bad character: #
>> "./c-tokenize.lex", line 7: unknown error processing section 1
>> "./c-tokenize.lex", line 8: bad character: #
>> "./c-tokenize.lex", line 8: bad character: <
>> "./c-tokenize.lex", line 8: bad character: .
>> "./c-tokenize.lex", line 8: bad character: >
>> "./c-tokenize.lex", line 9: bad character: #
>> "./c-tokenize.lex", line 10: bad character: }

>> Just as a first hunch, I'd double check whether you've got a suitable
>> version/variant of flex.

Thank you Tomas.

I was using the flex that came with OpenBSD 5.6 which was 2.5.4 so I
pulled down and installed flex-2.5.39.  This got me past these errors
though I'm not sure if this is associated with differences between the
OpenBSD brand of flex or just a versioning issue.  If it's a versioning
issue then it probably make sense to put something in configure.ac like
AC_PROG_LEX to make sure we have a flex that's a bit more recent than
2.5.4 as suggested here:

https://www.gnu.org/software/autoconf/manual/autoconf.html#Alternative-Programs

I guess the suggestion from the autoconf manual is to parse the output
of '$LEX --version'... Unfortunately the version of guile that is
packaged on OpenBSD is still 1.8 so I suspect most people who try to use
guile there will end up trying to build it from source and run into the
same problem I had.

I guess something like this might work in configure.ac:

AC_PROG_LEX

# parse the output from flex --version:
L_MAJ=$($LEX --version | cut -d . -f 1 | cut -d ' ' -f 2)
L_MIN=$($LEX --version | cut -d . -f 2)
L_REL=$($LEX --version | cut -d . -f 3)

# just making these up here 'cause I don't know what's really required:
L_REQ_MAJ=2
L_REQ_MIN=5
L_REQ_REL=30

# bring those numbers together:
L_REQ=$L_REQ_MAJ.$L_REQ_MIN.$L_REQ_REL
if [ $L_MAJ -lt $L_REQ_MAJ ] || [ $L_MIN -lt $L_REQ_MIN ] || [ $L_REL -lt $L_REQ_REL ] ; then
  echo "Installed flex version $L_MAJ.$L_MIN.$L_REL is too old!  Must be at least $L_REQ_MAJ.$L_REQ_MIN.$L_REQ_REL!"
  exit
else
  AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
  AC_SUBST([LEXLIB], [''])
fi

or something like that.  Forgive my crappy shell coding here.  I haven't
done this sort of thing in a long time and I'm sure it's horrible and
about as portable as that old engine in the back of my garage but
whatever.. :)

In any case I'm on to a new set of errors now:

$ cd buildarea/guile
$ git pull
$ autoreconf --install
$ ./configure --prefix=/home/me/usr \
    --with-libltdl-prefix=/usr/local      \
    --with-libgmp-prefix=/usr/local       \
    --with-libunistring-prefix=/usr/local
$ gmake clean
$ gmake

<.. lots of output snipped out here ..>

  SNARF  socket.doc
  SNARF  regex-posix.doc
  GEN      guile-procedures.texi
Uncaught exception:
Throw to key encoding-error with args ("scm_to_stringn" "cannot convert narrow string to output locale" 78 #f #f)Threads explicit registering is not previously enabled
Abort trap (core dumped) 
Makefile:3859: recipe for target 'guile-procedures.texi' failed
gmake[3]: *** [guile-procedures.texi] Error 1
gmake[3]: Leaving directory '/home/me/buildarea/guile/libguile'
Makefile:2251: recipe for target 'all' failed
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory '/home/me/buildarea/guile/libguile'
Makefile:1815: recipe for target 'all-recursive' failed
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory '/home/me/buildarea/guile'
Makefile:1700: recipe for target 'all' failed
gmake: *** [all] Error 2

-jamil

-- 
Sent with my mu4e