[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference smurf::buildhelp

Title:USG buildhelp questions/answers
Moderator:SMURF::FILTER
Created:Mon Apr 26 1993
Last Modified:Mon Jan 20 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2763
Total number of notes:5802

791.0. "Question about the -I paths and header files" by SMURF::FILTER (Automatic Posting Software - mail to flume::puck) Mon Jun 06 1994 16:46

Date Of Receipt: 	 6-JUN-1994 15:05:48.12
From: 	FLAMBE::"[email protected]" "06-Jun-1994 1504"
To: 	[email protected]
CC: 	
Subj: 	Question about the -I paths and header files

Hi,

Can anyone tell me where/how/when the -I path's are generated out of the
build script and where I need to put my sys/ files to get them included?

I have the following sandbox (sb) setup:

sb/obj/alpha:

coors(alpha)% ls kernel
AVANTI/       BINARY/       BINARY.uni/   BITBUCKET/    COBRA/
FLAMINGO/     GENERIC/      GENERIC.uni/  JENSEN/       LOADABLE/
MUSTANG/      PELICAN/      RUBY/         SABLE/        SAS/
arch/         bin/          bsd/          ccm/          conf/
data/         dec/          dli/          include/      io/
kern/         lat/          net/          sec/          src/
streams/      streamsm/     tty/          vfs/

coors(alpha)% ls kernel/include/ccm/
ccm_def.h            ccm_internal_def.h   ccm_map.h

coors(alpha)% ls usr/include/sys/ccm*
usr/include/sys/ccm_def.h

I get the following output when I do a build:

coors(kernel)% build MAKE_ARGS="-k ccm_data.o ccm_cfg.o ccm_internal.o" BINARY_
relative path: ./kernel.
cd ../../obj/alpha/kernel
cd BINARY && make -cF -k ccm_data.o ccm_cfg.o ccm_internal.o
KCC=/usr/sde/osf1/build/goldos.bl10/tools/alpha_OSF1/alpha/acc/cc 
LD=/usr/sde/osf1/build/goldos.bl10/tools/alpha_OSF1/alpha/acc/ld 
CPP=cpp  AWK=awk 
AR=/usr/sde/osf1/build/goldos.bl10/tools/alpha_OSF1/alpha/acc/ar 
RANLIB='/usr/sde/osf1/build/goldos.bl10/tools/alpha_OSF1/alpha/acc/ar
ts'  SHELL=sh  SED=sed  SORT=sort  ECHO=echo  KSH=ksh  EGREP=egrep 
GREP=grep  LINT=lint CONFIG=BINARY 
`ccm_data.o' is up to date.
`ccm_cfg.o' is up to date.
/usr/sde/osf1/build/goldos.bl10/tools/alpha_OSF1/alpha/acc/cc  -c -O2
-g3  -DLANGUAGE_C -g3 -G 4 -I -I. -I.. -I../include -DIDENT=BINARY
-DDEC2100_A500 -DDEC2100_A50 -DLCAMUSTANG -DDEC2000_300 -DDEC3000_300
-DDEC3000_500 -DDEC7000 -DDEC4000 -DSWAPTYPE=1 -DRELEASE='"'9.0'"'
-DVERSION='"'0'"' -DMACH -DOSF -DCOMPAT_43 -DUFS -DTRN -DCCM -DKERNEL
-D_KERNEL -D_BSD -signed  -no_excpt -Wb,-static -Wco,-nofloat -Olimit
1500 -D__alpha -Umips -UMIPS -DBINARY
../../../../src/kernel/ccm/ccm_internal.c
/usr/sde/osf1/build/goldos.bl10/tools/alpha_OSF1/alpha/acc/usr/lib/cmplrs/cc/cfe
:
Error: ../../../../src/kernel/ccm/ccm_map.h: 15: Cannot open file
sys/ccm_def.h for #include
*** Exit 1


Ok, now, the file I want, "ccm_map.h" is included on line 15 of ccm_def.h with
the line:

#include <sys/ccm_map.h>

This means there must be a sys/ccm_map.h in my -I path.  Looking at the command
line, there is only 

	-I -I. -I.. -I../include 

A reference to -I ../usr/include is missing.  Now, I understand that you
don't want the kernel build to be dependent on the usr tree, but how and where
do I specify that a file comes from sys/*.h?  I see there are sources in the
tree that reference <sys/xyz.h> with no problem, there must be a way.  The
only way I have succeeded is to do something like put 

#ifdef _KERNEL
#include "ccm_def.h"
#else
#include "sys/ccm_def.h"
#endif

in my code, I know this has gotta be wrong.

I have a Makefile in src/kernel/include/ccm that sayz:

VPATH                   = ${MAKETOP}/kernel/ccm
DATAFILES               = ccm_def.h ccm_internal_def.h ccm_map.h

but this simply puts things into the obj/alpha/kernel/include/ccm directory
(after a build from the src/kernel/include/ccm directory).



Next question:

What is the policy for kernel header files including other header files.
I am trying to include the following files from a kernel source (i.e, _KERNEL
is defined)

#ifdef _KERNEL
#include <sys/socket.h>
#include <sys/protosw.h>
#endif

#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>

I get the following warnings:

usr/sde/osf1/build/goldos.bl10/tools/alpha_OSF1/alpha/acc/usr/lib/cmplrs/cc/cfe:
Warning: ../include/sys/protosw.h, line 128: 'socket' declared within
and is limited to this function prototype
        int     (*pr_ctloutput)(int, struct socket *, int, int, struct mbuf **);
        ---     ----------------------------^

/usr/sde/osf1/build/goldos.bl10/tools/alpha_OSF1/alpha/acc/usr/lib/cmplrs/cc/cfe
:
Warning: ../include/sys/protosw.h, line 128: 'mbuf' declared within and
is limited to this function prototype
        int     (*pr_ctloutput)(int, struct socket *, int, int, struct mbuf **);
        ---     -------------------------------------------------------^

/usr/sde/osf1/build/goldos.bl10/tools/alpha_OSF1/alpha/acc/usr/lib/cmplrs/cc/cfe
:
Warning: ../include/sys/protosw.h, line 133: 'socket' declared within
and is limited to this function prototype
        int     (*pr_usrreq)(struct socket *, int,
        ---     --------------------^

/usr/sde/osf1/build/goldos.bl10/tools/alpha_OSF1/alpha/acc/usr/lib/cmplrs/cc/cfe
:
Warning: ../include/sys/protosw.h, line 134: 'mbuf' declared within and
is limited to this function prototype
                                struct mbuf *, struct mbuf *, struct mbuf *);
                                -------^

The reason I included protosw.h is because it is needed explicitly in 
netinet/in.h (it references some protosw defined structures).  (Why 
netinet/in.h)
doesn't include <sys/protosw.h>I don't understand ...)

Now, protosw.h needs to have <socket.h> defined iff _KERNEL is defined because
some of the proto-types refer to the mbuf's and sockets.

What am I missing here, shouldn't protosw.h include everything it needs in 
order to build itself clean?  How come every header file doesn't pass the
test?

  echo "#include "sys/file.h" >test.c
  cc -c test.c

Without this requirement every header and source has to know about the insides
of every other header in order to be sure to include the headers that are
needed, right?  Am I missing something obvious? 


Any help here is greatly appreciated.

Thanx in advance.
-FredC



T.RTitleUserPersonal
Name
DateLines
791.1Re: Question about the -I paths and header filesSMURF::FILTERAutomatic Posting Software - mail to flume::puckTue Jun 07 1994 18:3018
Date Of Receipt: 	 7-JUN-1994 14:16:49.54
From: 	ALPHA::bstevens "Brian Stevens  07-Jun-1994 1415"
To: 	[email protected]
CC: 	[email protected], bstevens@DEC:.zko.alpha
Subj: 	Re: Question about the -I paths and header files

Fred,

I would recommend having ccm_def.h live in src/kernel/ccm, along with the
other ccm header files. You need to modify the src/kernel/include/ccm/Makefile
so that it is exported to the user build. You are including it as
<sys/ccm_def.h>, where you should be including it as <ccm/ccm_def.h>. 

Not all kernel header files are standalone. It would be nice if they all
included the headers they depended on, but they don't.

Brian