name.cc needs <climits>

Bug #327417 reported by Alex Rousskov
6
Affects Status Importance Assigned to Milestone
eCAP
Fix Released
Undecided
Alex Rousskov

Bug Description

This is a bug report copied from question #60461

Whilst compiling libecap-0.0.2 on a 2.6.23-1 Debian host I made the following observations/amendments to the process in order for it to compile without error.

To avoid the warning about failing to find iostream.h, I supplied the configure script with --enable-std-include=/usr/include/c++/4.2/backward/. I'm not sure if this is needed though.

Running make returns the following output:

Making all in src
make[1]: Entering directory `/home/mgb/libecap-0.0.2/src'
Making all in libecap
make[2]: Entering directory `/home/mgb/libecap-0.0.2/src/libecap'
Making all in common
make[3]: Entering directory `/home/mgb/libecap-0.0.2/src/libecap/common'
make all-am
make[4]: Entering directory `/home/mgb/libecap-0.0.2/src/libecap/common'
if /bin/sh ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I../../../src -I/usr/include/c++/4.2/backward/ -g -O2 -MT area.lo -MD -MP -MF ".deps/area.Tpo" -c -o area.lo area.cc; \
    then mv -f ".deps/area.Tpo" ".deps/area.Plo"; else rm -f ".deps/area.Tpo"; exit 1; fi
 g++ -DHAVE_CONFIG_H -I../../../src -I/usr/include/c++/4.2/backward/ -g -O2 -MT area.lo -MD -MP -MF .deps/area.Tpo -c area.cc -fPIC -DPIC -o .libs/area.o
 g++ -DHAVE_CONFIG_H -I../../../src -I/usr/include/c++/4.2/backward/ -g -O2 -MT area.lo -MD -MP -MF .deps/area.Tpo -c area.cc -o area.o >/dev/null 2>&1
if /bin/sh ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I../../../src -I/usr/include/c++/4.2/backward/ -g -O2 -MT body_size.lo -MD -MP -MF ".deps/body_size.Tpo" -c -o body_size.lo body_size.cc; \
    then mv -f ".deps/body_size.Tpo" ".deps/body_size.Plo"; else rm -f ".deps/body_size.Tpo"; exit 1; fi
 g++ -DHAVE_CONFIG_H -I../../../src -I/usr/include/c++/4.2/backward/ -g -O2 -MT body_size.lo -MD -MP -MF .deps/body_size.Tpo -c body_size.cc -fPIC -DPIC -o .libs/body_size.o
 g++ -DHAVE_CONFIG_H -I../../../src -I/usr/include/c++/4.2/backward/ -g -O2 -MT body_size.lo -MD -MP -MF .deps/body_size.Tpo -c body_size.cc -o body_size.o >/dev/null 2>&1
if /bin/sh ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I../../../src -I/usr/include/c++/4.2/backward/ -g -O2 -MT message.lo -MD -MP -MF ".deps/message.Tpo" -c -o message.lo message.cc; \
    then mv -f ".deps/message.Tpo" ".deps/message.Plo"; else rm -f ".deps/message.Tpo"; exit 1; fi
 g++ -DHAVE_CONFIG_H -I../../../src -I/usr/include/c++/4.2/backward/ -g -O2 -MT message.lo -MD -MP -MF .deps/message.Tpo -c message.cc -fPIC -DPIC -o .libs/message.o
 g++ -DHAVE_CONFIG_H -I../../../src -I/usr/include/c++/4.2/backward/ -g -O2 -MT message.lo -MD -MP -MF .deps/message.Tpo -c message.cc -o message.o >/dev/null 2>&1
if /bin/sh ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I../../../src -I/usr/include/c++/4.2/backward/ -g -O2 -MT name.lo -MD -MP -MF ".deps/name.Tpo" -c -o name.lo name.cc; \
    then mv -f ".deps/name.Tpo" ".deps/name.Plo"; else rm -f ".deps/name.Tpo"; exit 1; fi
 g++ -DHAVE_CONFIG_H -I../../../src -I/usr/include/c++/4.2/backward/ -g -O2 -MT name.lo -MD -MP -MF .deps/name.Tpo -c name.cc -fPIC -DPIC -o .libs/name.o
name.cc: In constructor 'libecap::Name::Name()':
name.cc:7: error: 'INT_MIN' was not declared in this scope
name.cc: In constructor 'libecap::Name::Name(const std::string&)':
name.cc:11: error: 'INT_MIN' was not declared in this scope
name.cc: In constructor 'libecap::Name::Name(const std::string&, int)':
name.cc:15: error: 'INT_MIN' was not declared in this scope
name.cc: In member function 'bool libecap::Name::assignedHostId() const':
name.cc:23: error: 'INT_MIN' was not declared in this scope
name.cc: In member function 'void libecap::Name::assignHostId(int) const':
name.cc:27: error: 'INT_MIN' was not declared in this scope
make[4]: *** [name.lo] Error 1
make[4]: Leaving directory `/home/mgb/libecap-0.0.2/src/libecap/common'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/mgb/libecap-0.0.2/src/libecap/common'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/mgb/libecap-0.0.2/src/libecap'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/mgb/libecap-0.0.2/src'
make: *** [all-recursive] Error 1

I got it to compile by adding #include <climits.h> to name.cc. Again, I'm really not sure if this is going to impact other things, but at least it compiled. yay!

Tags: lib
Revision history for this message
Alex Rousskov (rousskov) wrote :

You changes are probably correct. Will polish #includes.

description: updated
description: updated
Changed in ecap:
assignee: nobody → rousskov
status: New → In Progress
Alex Rousskov (rousskov)
Changed in ecap:
status: In Progress → Fix Committed
Revision history for this message
Ealireza (ealireza) wrote :

Is Any Fix for this bug ?

Changed in ecap:
status: Fix Committed → Fix Released
status: Fix Released → Incomplete
Revision history for this message
Alex Rousskov (rousskov) wrote :

Until the fix is released, adding
#include <climits.h>
to name.cc should make the compiler happy.

Changed in ecap:
status: Incomplete → Fix Committed
Revision history for this message
Ealireza (ealireza) wrote :

it get error again

name.cc:4:21: error: climits.h: No such file or directory

where is Climits.h ? :D
i can't find it :D

Revision history for this message
Alex Rousskov (rousskov) wrote :

Sorry, it is either
#include <limits.h>
or
#include <climits>

With most modern compilers, the latter is the preferred way.

Alex Rousskov (rousskov)
Changed in ecap:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.