[comp.sys.hp] HP X11 include file problem

burzio@mmlai.UUCP (Tony Burzio) (02/23/89)

At last, I finally got my X11 tapes from HP.  Very nice, 
plus it still has X10s' very fast graphics.  The guys at
HP constantly amaze our ULTRIX administrator with their
smooth installation procedures.

However...

Several of my programs are bombing in compile because the
include file /usr/include/X11/Xos.h is looking for the
file <strings.h> and it can't find it.  Hmmm..  This sounds
like a BSD dependancy.  Anyone from HP know about this?

*********************************************************************
Tony Burzio               * PLEASE lower the price on the 800 series!
Martin Marietta Labs      *  - I don't want another DEC box in here!
mmlai!burzio@uunet.uu.net *
*********************************************************************

milburn@ux1.lbl.gov (John Milburn) (02/24/89)

In article <508@mmlai.UUCP> burzio@mmlai.UUCP (Tony Burzio) writes:
>Several of my programs are bombing in compile because the
>include file /usr/include/X11/Xos.h is looking for the
>file <strings.h> and it can't find it.  Hmmm..  This sounds
>like a BSD dependancy.  Anyone from HP know about this?

Try linking string.h to strings.h, it will save you grief with many ports.

John Milburn  Lawrence Berkeley Laboratory
(JEMilburn@lbl.gov)

mayer@hplabsz.HPL.HP.COM (Niels Mayer) (02/24/89)

In article <508@mmlai.UUCP> burzio@mmlai.UUCP (Tony Burzio) writes:
>Several of my programs are bombing in compile because the
>include file /usr/include/X11/Xos.h is looking for the
>file <strings.h> and it can't find it.  Hmmm..  This sounds
>like a BSD dependancy.  Anyone from HP know about this?

/usr/include/X11/Xos.h has a bunch of stuff like
> #ifdef SYSV
> #include <string.h>
> #define index strchr
> #define rindex strrchr
> #else /* SYSV */
> #include <strings.h>
> #endif /* SYSV */.

These ifdefs hopefully take care of the superficial differences between
SYSV-based systems (like HPUX) and BSD-based systems (like SunOS).

So the proper way to compile a file name.c containing X11/Xt/Xw calls
should be:
	"cc -c -O -DSYSV +Nd4000 +Ns4000 name.c" for an HP9000s3xx system, and
	"cc -c -O -DSYSV name.c" for an HP9000x8xx system.

The MIT X11 sources force -DSYSV through imake's machine-specific
configuration files. Including <X11/Xos.h> in your X11 client source allows
for some degree of program portability across unix variants.

-- Niels.

burdick@hpindda.HP.COM (Matt Burdick) (02/24/89)

> At last, I finally got my X11 tapes from HP.  Very nice, 

> Several of my programs are bombing in compile because the include file
> /usr/include/X11/Xos.h is looking for the file <strings.h> and it can't
> find it.  Hmmm..  This sounds like a BSD dependancy.  Anyone from HP know
> about this?

You should use the -DSYSV flag for the C compiler. /usr/include/X11/Xos.h
will look for string.h if told it it working with a SYSV compatible system.

							-matt
-- 
Matt Burdick			| Hewlett-Packard
burdick%hpda@hplabs.hp.com	| Technical Communications Lab

cola@hpislx.HP.COM (Ken Colasuonno) (02/25/89)

I JUST (yesterday) ran into this problem while compiling some X
source from 'outside' (read BSD world).  You do indeed have to set 
some compile flags, in particular SYSV must be defined and hpux
also.  So add to the Makefile a flag for CC such that the CCFLAGS 
will show up with:

cc [oldstuff] -DSYSV -Dhpux

If you look in Xos.h it has a line of #ifdef SYSV.....
and that is the path you want to take.

Hope this helps you out.  It worked for me.

| Ken Colasuonno  <Hewlett-Packard>      |  #include <std_disclaimer.h>
|Mail:  P.O. Box 301; Loveland, CO 80539 |
|EMail: hplabs!hpisla!cola               |
|Voice: (303) 679-2903                   |

jrg@hpirs.HP.COM (Jeff Glasson) (02/25/89)

> Several of my programs are bombing in compile because the
> include file /usr/include/X11/Xos.h is looking for the
> file <strings.h> and it can't find it.  Hmmm..  This sounds
> like a BSD dependancy.  Anyone from HP know about this?

Just put a -DSYSV in your Makefile.  That should solve your Xos problems.
However, since HP-UX is System V based, your applications may have some
Berkeleyisms that must be modified.

Hope this helps.


Jeff Glasson

kk@hpl-opus.HP.COM (Konstantinos Konstantinides) (02/25/89)

Always compile with the -DSYSV option. This solves the problem.

K. Konstantinides
kk%hpkronos@hplabs.hp.com

morrell@hpsal2.HP.COM (Michael Morrell) (02/25/89)

/ hpsal2:comp.sys.hp / burzio@mmlai.UUCP (Tony Burzio) /  3:37 pm  Feb 22, 1989 /

Several of my programs are bombing in compile because the
include file /usr/include/X11/Xos.h is looking for the
file <strings.h> and it can't find it.  Hmmm..  This sounds
like a BSD dependancy.  Anyone from HP know about this?
----------

If you check the include file, you'll notice you need to #define SYSV to get
your program to compile on HP-UX.  I realize these include files come from
a BSD environment, but I don't think that's an excuse to make an HP-UX user
add a "-DSYSV" to the "cc" line when compiling.

   Michael Morrell

shankar@hpclscu.HP.COM (Shankar Unni) (02/25/89)

> Several of my programs are bombing in compile because the
> include file /usr/include/X11/Xos.h is looking for the
> file <strings.h> and it can't find it.  Hmmm..  This sounds
> like a BSD dependancy.  Anyone from HP know about this?

Yup.

Just create a file /usr/include/strings.h which contains the one
line
   
   #include <string.h>
   
Or, make a link (symbolic, preferably) from strings.h to string.h in
/usr/include.

   ln -s /usr/include/string.h /usr/include/strings.h
---
Shankar.

guy@auspex.UUCP (Guy Harris) (02/25/89)

 >Several of my programs are bombing in compile because the
 >include file /usr/include/X11/Xos.h is looking for the
 >file <strings.h> and it can't find it.  Hmmm..  This sounds
 >like a BSD dependancy.

It is.  <strings.h> declares a bunch of the string-manipulating
functions ("strcpy", "strcmp", etc.); the S5 equivalent is <string.h>. 

Note that "index" and "rindex" in V7 (and inherited by BSD) were renamed
"strchr" and "strrchr" by AT&T; I don't know if HP/UX has "index" and
"rindex", and if so whether it's in "libc" or a BSD compatibility
library.  As such, if the code uses either of them, it may have to be
linked with a BSD compatibility library, or compiled with some
pre#defined value to map "index" and "rindex" to "strchr" and "strrchr".