1753851 Members
7379 Online
108807 Solutions
New Discussion юеВ

SIZE_MAX undefined

 
michas
Occasional Contributor

SIZE_MAX undefined

Hello,

I'm trying to compile some software on HP-UX B.11.11.

Things like coreutils and bash compile without problems, but gcc-4.5.2 and ruby-1.9.2-p180 fail and complain about "SIZE_MAX" being undefined.

Any idea what the reason for this might be, and how to fix them?

Did anyone manage to compile gcc and ruby on such a system? What did you do to let it work?

There are two different cc installed on the system. Is there a way to tell what kind of compiler they are? (There seems not to be something like --version.)
3 REPLIES 3
Steven Schweda
Honored Contributor

Re: SIZE_MAX undefined

As usual, showing some actual commands with
their actual output might be more helpful
than vague descriptions or interpretations.

Around here:

dy # uname -a
HP-UX dy B.11.11 U 9000/785 2012616114 unlimited-user license

dy # gcc -v
Using built-in specs.
Target: hppa2.0w-hp-hpux11.11
Configured with: ../gcc-4.4.2/configure
Thread model: posix
gcc version 4.4.2 (GCC)

SIZE_MAX is not defined everywhere. Does
your newer GCC really demand it?

> Did anyone manage to compile gcc [...]

My notes suggest that I needed to install GNU
"bison", "m4", and "sed", and then
export PATH="/usr/local/bin:${PATH}"
before doing the "configure" step. But I
don't recall any complaints about SIZE_MAX.

> There are two different cc installed on the
> system. [...]

Where?

> Is there a way [...]?

man cc

The old, bundled compiler may not be very
informative:

dy # /usr/bin/cc -v
(Bundled) cc: NLSPATH is /usr/lib/nls/msg/%L/%N.cat:/usr/lib/nls/msg/C/%N.cat:
(Bundled) cc: CCOPTS is not set.
(Bundled) cc: INCLUDIR is INCLUDIR=/usr/include
Dennis Handly
Acclaimed Contributor

Re: SIZE_MAX undefined

>complain about "SIZE_MAX" being undefined.

This is in stdint.h on 11.23.
There is SSIZE_MAX in limits.h.

>Is there a way to tell what kind of compiler they are?

Have you tried what(1) or -V?
mvpel
Trusted Contributor

Re: SIZE_MAX undefined

A little late, here, but maybe it will prove useful to someone in the future.

 

I ran into the same problem using the AllianceONE build of GCC 4.6.3 on HP-UX 11.11 just yesterday. This definition, as well as INTPTR_MAX and UINTPTR_MAX, are not present in the 11.11 include files with the latest December 2009 Gold Quality pack.

 

gbrhpq$ find /usr/include -type f -print | xargs egrep '[^A-Z_]SIZE_MAX'

gbrhpq$

 

The fix for it is to add the following to the code:

 

#ifdef __hpux

#ifndef SIZE_MAX
#define SIZE_MAX ((size_t)-1)
#endif

#endif

 

For the other two, which are defined but null:

 

#ifdef __hpux

#if !defined(INTPTR_MAX) || (defined(INTPTR_MAX) && !(INTPTR_MAX+0))
#ifdef __LP64__
#define INTPTR_MAX INT64_MAX
#else
#define INTPTR_MAX INT32_MAX
#endif

#endif