Error compiling solaris cross compiler.

Kai Ruottu
Fri Oct 5 04:10:00 GMT 2001

Phillip Thurmond wrote:
> I'm trying to cross-compile gcc 2.95.3 to the target sparc-solaris.
> Unfortunately it only gets so far and then spits out the following error.
> /config/sparc/gmon-sol2.c: In function `_mcleanup':
> /config/sparc/gmon-sol2.c:185: `PATH_MAX' undeclared (first use in this
> function)
> I have binutils cross-compiled for solaris and installed in
> /usr/local/sparc-sun-solaris and I also copied over all the include files
> including directories from /usr/include on my solaris box into
> /usr/local/sparc-sun-solaris/include on my linux box.

 The GCC-build expects to see the system's own 'limits.h' in the
'$prefix/$target/sys-include' not in the '$prefix/$target/include'
during the build... Whether this is a bug or feature is not relevant,
but it is the case. Then the GCCs own 'limits.h' will be fixed to
include the system's own 'limits.h' via the 'syslimits.h'... 

> I checked and found out that PATH_MAX is defined in limits.h as 1024,
> so I added the line
> #define PATH_MAX 1024
> into gmon-sol2.c.

 This doesn't remove the bug which exists after the installation. So
you either have to fix the 'limits.h' in the GCC_INCLUDE_DIR :


to include the 'syslimits.h' in the same directory, somewhere in the
file beginning, or to rebuild with the 'limits.h' seen in the 'sys-include'.
Anyway symlinking it into the 'sys-include' for the next upgrade build,
eg. into gcc-3.0.x or gcc-3.1.x wouldn't be a bad idea.

>  This will let me get further into the compile, but then I
> get errors about struct exception being defined more than once.

 This is a well-known bug in the SVR4-targets. As with the 'limits.h',
you can either let the GCC-build to fix the 'math.h' into the GCC_INCLUDE_DIR,
or fix it yourself like here :

----------------------- clip ----------------------
*** math.bak	Tue Dec 28 19:26:13 1999
--- math.h	Tue Dec 28 21:12:03 1999
*** 72,78 ****
--- 72,82 ----
  extern enum version _lib_version;
+ #ifdef __cplusplus
+ struct __math_exception {
+ #else
  struct exception {
+ #endif
  	int type;
  	char *name;
  	double arg1;
*** 183,189 ****
--- 187,197 ----
   * SVID
+ #ifdef __cplusplus
+ extern int matherr __P((struct __math_exception *));
+ #else
  extern int matherr __P((struct exception *));
+ #endif
   * IEEE Test Vector
----------------------- clip ----------------------

 When you have copies in your cross-host, editing the copy is not as
big sin as editing the original in the Solaris2 box... Again, leave
the fixed 'math.h' into the $prefix/$target/include to wait for the
next upgrade...

Cheers, Kai

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list