# Building Ruby 1.8.2 on HP-UX 10.20

**URL:** <https://www.ruby-forum.com/t/building-ruby-1-8-2-on-hp-ux-10-20/48402>\
**Category:** Ruby\
**Created:** [November 19, 2005, 9:59pm UTC](https://www.ruby-forum.com/t/building-ruby-1-8-2-on-hp-ux-10-20/48402 "2005-11-19T21:59:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gerardo.santana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9e5f3/32.png) [@gerardo.santana](https://www.ruby-forum.com/u/gerardo.santana)\
**Post date:** [November 19, 2005, 9:59pm UTC](https://www.ruby-forum.com/t/building-ruby-1-8-2-on-hp-ux-10-20/48402/1 "2005-11-19T21:59:36Z")

</div>

I get the following error:

-----------8\<-------------  
cc -Ae -g -DYYMAXDEPTH=300 -I. -I. -c ./missing/vsnprintf.c  
cpp: “stdio.h”, line 316: warning 2001: Redefinition of macro clearerr.  
cpp: “stdio.h”, line 317: warning 2001: Redefinition of macro feof.  
cpp: “stdio.h”, line 318: warning 2001: Redefinition of macro ferror.  
cc: “/usr/include/stdio.h”, line 173: error 1000: Unexpected symbol:  
“void”.  
cc: “/usr/include/stdio.h”, line 173: error 1000: Unexpected symbol:  
“(”.  
cc: “/usr/include/stdio.h”, line 173: error 1000: Unexpected symbol:  
“-\>”.  
cc: “/usr/include/stdio.h”, line 173: error 1000: Unexpected symbol:  
“&=”.  
cc: “/usr/include/stdio.h”, line 174: error 1000: Unexpected symbol:  
“_".  
cc: “/usr/include/stdio.h”, line 174: error 1000: Unexpected symbol:  
“-\>”.  
cc: “/usr/include/stdio.h”, line 174: error 1000: Unexpected symbol:  
“)”.  
cc: “/usr/include/stdio.h”, line 174: error 1000: Unexpected symbol:  
“)”.  
cc: “/usr/include/stdio.h”, line 31: error 1584: Inconsistent type  
declaration: “FILE”.  
cc: “/usr/include/stdio.h”, line 173: error 1506: Parameters allowed  
in function definition only.  
cc: “/usr/include/stdio.h”, line 175: error 1000: Unexpected symbol:  
"_”.  
cc: “/usr/include/stdio.h”, line 175: error 1000: Unexpected symbol:  
“-\>”.  
cc: “/usr/include/stdio.h”, line 175: error 1000: Unexpected symbol:  
“)”.  
cc: “/usr/include/stdio.h”, line 175: error 1000: Unexpected symbol:  
“)”.  
cc: “/usr/include/stdio.h”, line 174: warning 558: Empty declaration.  
cc: “/usr/include/stdio.h”, line 253: error 1000: Unexpected symbol:  
“FILE”.  
cc: “/usr/include/stdio.h”, line 254: error 1000: Unexpected symbol:  
“FILE”.  
cc: “/usr/include/stdio.h”, line 269: error 1000: Unexpected symbol:  
“FILE”.  
cc: “/usr/include/stdio.h”, line 270: error 1000: Unexpected symbol:  
“_".  
cc: “/usr/include/stdio.h”, line 339: error 1000: Unexpected symbol:  
"_”.  
cc: “/usr/include/stdio.h”, line 339: error 1000: Unexpected symbol:  
“-\>”.  
cc: “/usr/include/stdio.h”, line 340: error 1000: Unexpected symbol:  
“\*”.  
cc: error 2017: Cannot recover from earlier errors, terminating.  
\*\*\* Error exit code 1

Stop.  
-----------\>8-------------

I can “fix it” changing -Ae for -Aa, but when the building process  
runs miniruby to run every extconf.rb, it breaks in lib/mkmf.rb saying  
a block was not given to checking\_for (when checking for the existence  
of windows.h), which is non sense.

Any idea?

---

<div class="post-metadata">

**Author:** ![gerardo.santana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9e5f3/32.png) [@gerardo.santana](https://www.ruby-forum.com/u/gerardo.santana)\
**Post date:** [November 20, 2005, 2:48pm UTC](https://www.ruby-forum.com/t/building-ruby-1-8-2-on-hp-ux-10-20/48402/2 "2005-11-20T14:48:24Z")

</div>

> I get the following error:
> 
> -----------8\<-------------  
> cc -Ae -g -DYYMAXDEPTH=300 -I. -I. -c ./missing/vsnprintf.c  
> cpp: “stdio.h”, line 316: warning 2001: Redefinition of macro clearerr.  
> cpp: “stdio.h”, line 317: warning 2001: Redefinition of macro feof.  
> cpp: “stdio.h”, line 318: warning 2001: Redefinition of macro ferror.  
> cc: “/usr/include/stdio.h”, line 173: error 1000: Unexpected symbol: “void”=

Is the stdio.h in error itself, or did Ruby override something it  
shouldn’t  
have?

Does it go away with 1.8.3 or 1.8.4-preview1 ?

And probably most important, is vsnprintf missing on hpux 10? if not,  
why  
does ./configure seem to think so?

I have not seen this problem with 1.8.1 or 1.8.4-preview1 on HP-UX 11  
(though comforting, that may be of very little help to you)

Bye,  
Kero.

---

<div class="post-metadata">

**Author:** ![gerardo.santana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9e5f3/32.png) [@gerardo.santana](https://www.ruby-forum.com/u/gerardo.santana)\
**Post date:** [November 20, 2005, 5:33pm UTC](https://www.ruby-forum.com/t/building-ruby-1-8-2-on-hp-ux-10-20/48402/3 "2005-11-20T17:33:54Z")

</div>

Thanks Kero

2005/11/20, Kero [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> have?  
> missing/vsnprintf.c defines some macros like clearerr and ferror,  
> which are already declared as functions in stdio.h. Although  
> vsnprintf.c is not including stdio.h, it seems like cpp includes it  
> after preprocessing vsnprintf.c and then I get those errors  
> (“Redefinition of macro clearerr” because stdio.h is declaring it as a  
> function, after being defined as a macro in vsnprintf.c, etc)

I’m new at HP-UX, I’m missing something important for sure. Changing  
the flag -Ae for -Aa “solves” the problem for vsnprintf.c. But then I  
get other errors when running miniruby.

> Does it go away with 1.8.3 or 1.8.4-preview1 ?

I’ll try with 1.8.4-preview1 and see

> And probably most important, is vsnprintf missing on hpux 10? if not, why  
> does ./configure seem to think so?

Yes, it is missing.

> I have not seen this problem with 1.8.1 or 1.8.4-preview1 on HP-UX 11  
> (though comforting, that may be of very little help to you)

HP-UX 11 already has vsnprintf AFAIK.

I have just found this:

[http://www.ruby-lang.org/ja/install.cgi?cmd=view;name=HP-UX](http://www.ruby-lang.org/ja/install.cgi?cmd=view;name=HP-UX)

It explains how to solve some problems I ran into. It says something  
about vsnprintf and a patch for HP-UX, but I can’t read Japanese ☹  
Does any caritative soul want to help me? (from the line starting with  
“missing/vsnprintf.c”, almost at the end of the file)

Thanks in advance

---

<div class="post-metadata">

**Author:** ![gerardo.santana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9e5f3/32.png) [@gerardo.santana](https://www.ruby-forum.com/u/gerardo.santana)\
**Post date:** [November 20, 2005, 5:49pm UTC](https://www.ruby-forum.com/t/building-ruby-1-8-2-on-hp-ux-10-20/48402/4 "2005-11-20T17:49:59Z")

</div>

> > > > > “G” == =?ISO-8859-1?Q?Gerardo S. G=F3mez Garrido?= writes:

G\> [http://www.ruby-lang.org/ja/install.cgi?cmd=view;name=HP-UX](http://www.ruby-lang.org/ja/install.cgi?cmd=view;name=HP-UX)

You have an online translator at

[http://www.excite.co.jp/world/english/web/](http://www.excite.co.jp/world/english/web/)

Select the right checkbox

Sometimes it give something funny 🙂

Guy Decoux

---

<div class="post-metadata">

**Author:** ![gerardo.santana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9e5f3/32.png) [@gerardo.santana](https://www.ruby-forum.com/u/gerardo.santana)\
**Post date:** [November 20, 2005, 7:14pm UTC](https://www.ruby-forum.com/t/building-ruby-1-8-2-on-hp-ux-10-20/48402/5 "2005-11-20T19:14:36Z")

</div>

Hi,

In message “Re: Building Ruby 1.8.2 on HP-UX 10.20”  
on Sun, 20 Nov 2005 05:57:42 +0900, Gerardo S. Gómez Garrido  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

|I get the following error:

Does this patch help you?

```
						matz.

```

— missing/vsnprintf.c 24 Sep 2005 13:34:26 -0000 1.15  
+++ missing/vsnprintf.c 20 Nov 2005 18:12:22 -0000  
@@ -113,2 +113,9 @@  
#include \<stddef.h\>  
+#if defined(\_\_hpux) && !defined( **GNUC** ) || defined(\_\_DECC)  
+#include \<string.h\>  
+#endif  
+  
+#if !defined( **CYGWIN32** ) && defined(\_\_hpux) && !defined( **GNUC** )  
+#include \<stdlib.h\>  
+#endif

@@ -205,6 +212,2 @@ typedef struct \_\_sFILE {

## -#if defined(\_\_hpux) && !defined( **GNUC** ) || defined(\_\_DECC) -#include \<string.h\> -#endif

/\*  
@@ -305,6 +308,2 @@ static int BSD\_\_sfvwrite(fp, uio)

## -#if !defined( **CYGWIN32** ) && defined(\_\_hpux) && !defined( **GNUC** ) -#include \<stdlib.h\> -#endif

/\*

---

<div class="post-metadata">

**Author:** ![gerardo.santana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9e5f3/32.png) [@gerardo.santana](https://www.ruby-forum.com/u/gerardo.santana)\
**Post date:** [November 20, 2005, 7:50pm UTC](https://www.ruby-forum.com/t/building-ruby-1-8-2-on-hp-ux-10-20/48402/6 "2005-11-20T19:50:51Z")

</div>

(Kero: I tried 1.8.3 and it was the same)

I manually applied the patch to ruby-1.8.3/missing/vsnprintf.c and it  
seems that fixed something, but I got new errors:

----------8\<------------  
cc -Ae -g -DYYMAXDEPTH=300 -I. -I. -c ./missing/vsnprintf.c  
cpp: “vsnprintf.c”, line 197: warning 2001: Redefinition of macro feof.  
cpp: “vsnprintf.c”, line 198: warning 2001: Redefinition of macro  
ferror.  
cpp: “vsnprintf.c”, line 199: warning 2001: Redefinition of macro  
clearerr.  
cc: “missing/vsnprintf.c”, line 169: error 1584: Inconsistent type  
declaration: “FILE”.  
cc: “missing/vsnprintf.c”, line 252: error 1588: “\_flags” undefined.  
cc: “missing/vsnprintf.c”, line 252: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 252: error 1563: Expression in if must  
be scalar.  
cc: “missing/vsnprintf.c”, line 256: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 256: error 1563: Expression in if must  
be scalar.  
cc: “missing/vsnprintf.c”, line 270: error 1588: “\_w” undefined.  
cc: “missing/vsnprintf.c”, line 270: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 271: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 271: error 1563: Expression in if must  
be scalar.  
cc: “missing/vsnprintf.c”, line 274: error 1588: “\_p” undefined.  
cc: “missing/vsnprintf.c”, line 274: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 274: error 1527: Incompatible types in  
cast: Must cast from scalar to scalar or to void type.  
cc: “missing/vsnprintf.c”, line 275: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 275: error 1549: Modifiable lvalue  
required for assignment operator.  
cc: “missing/vsnprintf.c”, line 275: error 1603: Incompatible  
operands: assign operator.  
cc: “missing/vsnprintf.c”, line 276: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 276: error 1549: Modifiable lvalue  
required for assignment operator.  
cc: “missing/vsnprintf.c”, line 276: error 1603: Incompatible  
operands: assign operator.  
cc: “missing/vsnprintf.c”, line 294: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 294: error 1549: Modifiable lvalue  
required for assignment operator.  
cc: “missing/vsnprintf.c”, line 553: error 1588: “\_flags” undefined.  
cc: “missing/vsnprintf.c”, line 553: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 554: error 1588: “\_file” undefined.  
cc: “missing/vsnprintf.c”, line 554: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 553: error 1563: Expression in if must  
be scalar.  
cc: “missing/vsnprintf.c”, line 998: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 998: error 1552: First expression of  
?: must be arithmetic.  
cc: “missing/vsnprintf.c”, line 1089: error 1588: “\_flags” undefined.  
cc: “missing/vsnprintf.c”, line 1089: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 1090: error 1588: “\_bf” undefined.  
cc: “missing/vsnprintf.c”, line 1090: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 1090: error 1529: Cannot select field  
of non-structure.  
cc: “missing/vsnprintf.c”, line 1090: error 1588: “\_p” undefined.  
cc: “missing/vsnprintf.c”, line 1090: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 1091: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 1091: error 1529: Cannot select field  
of non-structure.  
cc: “missing/vsnprintf.c”, line 1091: error 1588: “\_w” undefined.  
cc: “missing/vsnprintf.c”, line 1091: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 1093: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 1093: error 1554: Indirection must be  
through a pointer.  
cc: “missing/vsnprintf.c”, line 1129: error 1588: “\_flags” undefined.  
cc: “missing/vsnprintf.c”, line 1129: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 1130: error 1588: “\_bf” undefined.  
cc: “missing/vsnprintf.c”, line 1130: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 1130: error 1529: Cannot select field  
of non-structure.  
cc: “missing/vsnprintf.c”, line 1130: error 1588: “\_p” undefined.  
cc: “missing/vsnprintf.c”, line 1130: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 1131: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 1131: error 1529: Cannot select field  
of non-structure.  
cc: “missing/vsnprintf.c”, line 1131: error 1588: “\_w” undefined.  
cc: “missing/vsnprintf.c”, line 1131: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 1133: error 1531: Invalid member of  
struct or union.  
cc: “missing/vsnprintf.c”, line 1133: error 1554: Indirection must be  
through a pointer.  
\*\*\* Error exit code 1

Stop.

----------\>8------------

Again, if I use -Aa it works, but then I get:

----------8\<------------  
/home/santana/sw/ruby-1.8.3/lib/optparse.rb:857:in `accept’: negative  
allocation size (or too big) (NoMemoryError)  
from /home/santana/sw/ruby-1.8.3/lib/optparse/shellwords.rb:6  
from ./ext/extmk.rb:33  
\*\*\* Error exit code 1

Stop.  
----------\>8------------

2005/11/20, Yukihiro M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![gerardo.santana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9e5f3/32.png) [@gerardo.santana](https://www.ruby-forum.com/u/gerardo.santana)\
**Post date:** [November 21, 2005, 12:44am UTC](https://www.ruby-forum.com/t/building-ruby-1-8-2-on-hp-ux-10-20/48402/7 "2005-11-21T00:44:47Z")

</div>

I tried with 1.8.4preview1 and got the same problem. But the error  
after compiling with -Aa changed:

/home/santana/sw/ruby-1.8.4/lib/fileutils.rb:1561: [BUG] Bus Error  
ruby 1.8.4 (2005-10-29) [hppa2.0-hpux10.20]

sh: 16263 Abort(coredump)  
\*\*\* Error exit code 134

Stop.

2005/11/20, Gerardo S. Gómez Garrido [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![gerardo.santana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9e5f3/32.png) [@gerardo.santana](https://www.ruby-forum.com/u/gerardo.santana)\
**Post date:** [November 21, 2005, 7:39am UTC](https://www.ruby-forum.com/t/building-ruby-1-8-2-on-hp-ux-10-20/48402/8 "2005-11-21T07:39:05Z")

</div>

2005/11/20, Yukihiro M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> |Again, if I use -Aa it works, but then I get:
> 
> Hmm, it must be a difficult bug to fix. I wish I could have access to  
> the HP-UX box.

Just in case you haven’t noticed yet, I’ve sent you in private the  
information needed to log in to the server.

Thanks

---

<div class="post-metadata">

**Author:** ![gerardo.santana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9e5f3/32.png) [@gerardo.santana](https://www.ruby-forum.com/u/gerardo.santana)\
**Post date:** [November 21, 2005, 1:00am UTC](https://www.ruby-forum.com/t/building-ruby-1-8-2-on-hp-ux-10-20/48402/9 "2005-11-21T01:00:52Z")

</div>

Hi,

In message “Re: Building Ruby 1.8.2 on HP-UX 10.20”  
on Mon, 21 Nov 2005 03:48:56 +0900, Gerardo S. Gómez Garrido  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

|I manually applied the patch to ruby-1.8.3/missing/vsnprintf.c and it  
|seems that fixed something, but I got new errors:

Try the attached patch, please.

|Again, if I use -Aa it works, but then I get:

Hmm, it must be a difficult bug to fix. I wish I could have access to  
the HP-UX box.

```
						matz.

```

— missing/vsnprintf.c 24 Sep 2005 13:34:26 -0000 1.15  
+++ missing/vsnprintf.c 20 Nov 2005 23:56:34 -0000  
@@ -113,2 +113,9 @@  
#include \<stddef.h\>  
+#if defined(\_\_hpux) && !defined( **GNUC** ) || defined(\_\_DECC)  
+#include \<string.h\>  
+#endif  
+  
+#if !defined( **CYGWIN32** ) && defined(\_\_hpux) && !defined( **GNUC** )  
+#include \<stdlib.h\>  
+#endif

@@ -196,2 +203,5 @@ typedef struct \_\_sFILE {

+#undef feof  
+#undef ferror  
+#undef clearerr  
#define feof(p) \_\_sfeof(p)  
@@ -205,6 +215,2 @@ typedef struct \_\_sFILE {

## -#if defined(\_\_hpux) && !defined( **GNUC** ) || defined(\_\_DECC) -#include \<string.h\> -#endif

/\*  
@@ -305,6 +311,2 @@ static int BSD\_\_sfvwrite(fp, uio)

## -#if !defined( **CYGWIN32** ) && defined(\_\_hpux) && !defined( **GNUC** ) -#include \<stdlib.h\> -#endif

/\*
