Samba 3.0.22 Porting by Vidya Sagar
28
But what if it’s not possible to compile with the missing include file? Check to see if the file is provided via the
Porting Wrappers (/POSIXC60/include or
Appendix H) or in /usr/contrib/include, and if it is, specify either -
I/POSIXC60/include or -I/usr/contrib/include (but preferably not both) in the CPPFLAGS list of precompiler
options.
If the include file does not exist in the Porting Wrappers or in /usr/contrib/include, and you are getting undefined
symbol compile errors due to your inability to include this file, examine this include file on an HP-UX or Linux
system to see what the correct symbol definitions might be. Then copy just what you need into the source file you
are porting, i.e.:
#ifdef HAVE_FOOBAR_H
# include <foobar.h>
#else
# ifdef MPE
# define symbol1 value1
# define symbol2 value2
# define symbol3 value3
# endif
#endif
Alternatively, you could copy an entire include file or set of include files from HP-UX or Linux, and store them in
your own directory structure that mirrors the regular system include root directory, i.e.:
/MYACCT/MYGROUP/src/myapp/mpeinclude/arpa
/MYACCT/MYGROUP/src/myapp/mpeinclude/net
/MYACCT/MYGROUP/src/myapp/mpeinclude/sys
Then modify the compiler flags in CPPFLAGS to also include:
-I/MYACCT/MYGROUP/src/myapp/mpeinclude
Then when the source code does something like:
#include <foobar.h>
The compiler will look for /MYACCT/MYGROUP/src/myapp/mpeinclude/foobar.h before checking the default
system include directories. One important drawback to this approach is that very few open source applications
are structured this way, so you may have trouble submitting your porting changes back to the original developers.
Some time-related symbols that a real Unix system would define in <sys/time.h> are instead defined in MPE’s
<time.h>. Don’t ask me why. Since <sys/time.h> does not exist on MPE, replace references to it with <time.h>.
4.2 Common Compile-Time Problems
Make sure your source files (and *.h header files) are bytestream files. Files that are MPE Fixed-length ASCII will
cause gcc to return strange errors about premature EOFs. This is a well-known side-effect of MPE’s bytestream
emulator, which also impacts other POSIX apps like Apache and Samba.
The gcc compiler can generate a mind-numbing amount of warnings and yet still complete the compile. The
compiler will make certain assumptions for certain warnings, and sometimes it can guess wrong in a way that will
prevent your application from running properly. For example, due to available telldir() and seekdir() declaration
compiler assumes they are available on MPE/iX however the same is not.
Nearly all POSIX applications on MPE require the use of the compiler options
-D_POSIX_SOURCE and -D_SOCKET_SOURCE in CPPFLAGS as we did in section
adjusting and running
configure [3.5]. If you are getting lots of compiler errors about undefined types and macros, try defining these
compile symbols first before doing any other investigation.