lparse 1.1.1 compiling conflicts with GCC 4.4.1 on Ubuntu Linux 9.10

by Forrest Sheng Bao http://fsbao.net

It seems people are looking for my blog on how to compile lparse with modern GCC or Ubuntu. The major problem is that many programs in lparse source code do not include stdio.h or other needed head files. I do not know why on some platform such code can be compiled. At least it does not work for my GCC 4.x. And it seems since version 4.2, GCC is getting strict on C standard.

Here is the solution to solve such problems if you are using GCC 4.4.1 on Ubuntu Linux 9.10. An earlier version for GCC 4.33 on Ubuntu Linux 9.04 is at http://forrestbao.blogspot.com/2009/11/lparse-111-conflicts-with-gcc-433.html Janosch reported the problem on Ubuntu 9.10. So I am writing this blog entry.

Step 1: Install bison. You can use
sudo apt-get install bison
or other ways.

Step 2: Comment out line 85 of src/extern.h
//long int strtol(const char *nptr, char **endptr, int base);
PS: I do not know why the HAVE_STRTOL does not work.

Step 3: Include stdarg.h and stdio.h into src/global.h

#include <stdio.h>
#include <stdarg.h>

Step 4: Done! Make and you shall get tons of warnings but finally the lparse executable.

1 comment:

Pacheco M. Lucas said...

Thanks a lot. All problems solved.