by Forrest Sheng Bao http://fsbao.net
An updated version for Ubuntu 9.10 is here: lparse 1.1.1 compiling conflicts with GCC 4.4.1 on Ubuntu Linux 9.10
If you are having problem compiling lparse 1.1.1 using GCC 4.3.3, specifically on Ubuntu 9.04, and your error happens to be like this
Open src/extern.h and comment the line
This is my GCC version info:
An updated version for Ubuntu 9.10 is here: lparse 1.1.1 compiling conflicts with GCC 4.4.1 on Ubuntu Linux 9.10
If you are having problem compiling lparse 1.1.1 using GCC 4.3.3, specifically on Ubuntu 9.04, and your error happens to be like this
g++ -g -O3 -c instance.cc In file included from instance.cc:23: extern.h:86: error: previous declaration of ‘long int strtol(const char*, char**, int)’ with ‘C++’ linkage /usr/include/stdlib.h:186: error: conflicts with new declaration with ‘C’ linkage /usr/include/stdlib.h:186: error: declaration of ‘long int strtol(const char*, char**, int) throw ()’ throws different exceptions extern.h:86: error: from previous declaration ‘long int strtol(const char*, char**, int)’just do a simple step:
Open src/extern.h and comment the line
long int strtol(const char *nptr, char **endptr, int base);which is around line 86.
strtol
is a C++ standard library function used to convert numbers of different radixes (or bases). So it doesn't need to be redefined here. This is my GCC version info:
$ gcc -v Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.3-5ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4)
3 comments:
I am trying to install lparse on Ubuntu 9.10. Well, I have commented such line but even there are a lot of errors. Trying to solve them.
instance.cc: In function ‘long int print_text_instance(Instance*, long int, int)’:
instance.cc:139: error: ‘stderr’ was not declared in this scope
instance.cc:139: error: ‘fprintf’ was not declared in this scope
instance.cc: In function ‘long int print_smodels_instance(Instance*, long int, int)’:
instance.cc:158: error: ‘stderr’ was not declared in this scope
instance.cc:158: error: ‘fprintf’ was not declared in this scope
instance.cc: In constructor ‘HashSet::HashSet(long int, int)’:
instance.cc:225: warning: deprecated conversion from string constant to ‘char*’
instance.cc: In destructor ‘HashSet::~HashSet()’:
instance.cc:245: warning: deprecated conversion from string constant to ‘char*’
instance.cc: In member function ‘void HashSet::Clear(int)’:
instance.cc:277: warning: deprecated conversion from string constant to ‘char*’
instance.cc:278: warning: deprecated conversion from string constant to ‘char*’
make[1]: *** [instance.o] Error 1
make[1]: se sale del directorio `/home/administrador/Documentos/lparse-1.1.1/src'
Hi Janosch, I have left a new blog entry to solve your problem: http://forrestbao.blogspot.com/2010/02/lparse-111-compiling-conflicts-with-gcc.html
/* Sorry about re-posting this comment, but Blogger has eaten my #include <something.h> and I think it would confuse someone */
All problems about installing lparse on Ubuntu 9.10 solved
I have installed: bison++ Version 1.21.9-1
'make' instruction gives next error:
In file included from global.h:33,
from array.cc:21:
extern.h:91: error: 'va_list' has not been declared
extern.h:92: error: 'va_list' has not been declared
make[1]: *** [array.o] Error 1
make[1]: se sale del directorio '/home/administrador/Documentos/lparse-1.1.1/src'
So, I edited file ./src/extern.h adding "#include <stdarg.h>" after line "#define EXTERN_H" like this:
#include <stdarg.h>
#define EXTERN_H
Next: I commented line "long int strtol(const char *nptr, char **endptr, int base);" like this:
#if !HAVE_STRTOL
//long int strtol(const char *nptr, char **endptr, int base);
#endif
Now 'make' command yet gives many errors like:
error: 'printf' was not declared in this scope
Due that, next step was editing ./src/error.h I added line: #include <stdio.h> next to #include "config.h"
#include "config.h"
#include <stdio.h>
After that I got lots of "warning: deprecated conversion from string constant to 'char*'" messages. But that where only warnings.
Last error indicated file parse.cc.h do not exist, then I executed 'make' again and all was fine.
Finally, installed lparse with $sudo make install
Thanks a lot. Your post gived me many hints.
Post a Comment