#1175 Redefinition of HAVE_BOOL

open
5
2011-06-23
2011-06-22
xypron
No

I tried to compile swig-2.0.4 on Debian Wheezy 64bit.

I received the error below.

make[1]: Entering directory `/home/myuser/src/swig-2.0.4/Source'
make all-am
make[2]: Entering directory `/home/myuser/src/swig-2.0.4/Source'
source='Modules/allegrocl.cxx' object='Modules/allegrocl.o' libtool=no \ DEPDIR=.deps depmode=none /bin/bash ../Tools/config/depcomp \ g++ -DHAVE_CONFIG_H -I../Source/Include -I../Source/CParse -I../Source/Include -I../Source/DOH -I../Source/CParse -I../Source/Preprocessor -I../Source/Swig -I../Source/Modules -c -o Modules/allegrocl.o Modules/allegrocl.cxx
In file included from Modules/allegrocl.cxx:16:0:
Modules/swigmod.h:22:13: error: redeclaration of C++ built-in type ‘bool’ [-fpermissive]

To fix the error I commented the lines in Sources/Modules/swigmod.h which redefined bool.

Please, change the configure file to detect if bool is defined and to set HAVE_BOOL in config.h.

Best regards

Xypron

Discussion

  • Mikel Bancroft

    Mikel Bancroft - 2011-06-22

    This does not appear to be allegrocl specific, nor can I duplicate (on a non-debian machine). Also, the suggested fix appears to already be implemented in 2.0.4, with HAVE_BOOL being defined, based on a test for bool, in Source/Include/swigconfig.h, which is generated via configure.in.

     
  • xypron

    xypron - 2011-06-22

    >> with HAVE_BOOL being defined, based on a test for
    >> bool, in Source/Include/swigconfig.h,
    This is just the code that is not working, because though bool is defined, HAVE_BOOL is never set.

     
  • xypron

    xypron - 2011-06-22

    On my first try of compiling SWIG I first ran ./configure and
    only during make received an error message that
    g++ was missing.

    I installed g++ with
    sudo apt-get install g++
    and continued make. I then ran into the error concerning HAVE_BOOL.

    When g++ is installed before ./configure everything runs fine.

    It seems the real bug is that the configure script does not check for g++.

     
  • William Fulton

    William Fulton - 2011-06-23

    After reconfiguring your system installing g++, you need to rerun configure. You cannot avoid that or expect any other behaviour.

    The fact that you discovered your system was missing g++ when compiling SWIG rather than during configure time is not ideal and somewhat surprising. This is standard (buggy) autoconf behaviour, see: http://lists.gnu.org/archive/html/bug-autoconf/2010-05/msg00001.html. Note that we have the following macros configure.in

    AC_PROG_CC
    AC_PROG_CXX

    so the 2nd AC_PROG macro does not check that the tool works - this is described as buggy behaviour. I don't see any value in switching those macros around as it shifts the problem to the C compiler from the C++ compiler.

    If someone can find a reliable autoconf macro that checks the c++ compiler works we can put it in, otherwise I propose we leave the current behaviour as it is quite clear that a c++ compiler needs to be installed, even if it is a bit late in the configure/build/install cycle.

     
  • William Fulton

    William Fulton - 2011-06-23
    • assigned_to: mutandiz --> wsfulton
    • labels: 776080 --> installation
     
  • xypron

    xypron - 2011-06-23

    >> If someone can find a reliable autoconf macro that checks the c++ compiler
    >> works we can put it in,

    The following should be suffcient to check if g++ is really installed:

    AC_INIT
    AC_PROG_CC
    AC_PROG_CXX
    AC_CHECK_PROG([HAVE_CXX],$CXX,[yes],[no])
    AC_MSG_CHECKING([whether $CXX exists])
    if test "$HAVE_CXX" = "no"; then
    AC_MSG_ERROR([$CXX not found])
    fi
    AC_OUTPUT

     

Log in to post a comment.