strange compile problem

John Barry jbarryATeso.org
Mon Sep 13 13:13:00 GMT 1999


Hi,

> >    I've been getting this with every version of binutils I've built up since I
> >    started using -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64, this includes
> >    2.9.1 and every snapshop I've downloaded from cygnus. It's a Solaris only
> >    issue, didn't happen when I built it on a hppa2.0 Visualise C 3000
> > 
> > You can probably fix it by adding
> > 
> > #include <sys/types.h>
> > #include <sys/stat.h>
> > 
> > near the top of bfd/bfd-in2.h.
> > 
> > I'm somewhat uncomfortable with requiring every program which includes
> > bfd.h to also include those files.  Unfortunately, the only other
> > choice is probably to change the two uses of struct stat * to void *,
> > instead, and thus lose type checking.
> 
> I would be inclined to warn away from this.  In fact, I think something
> more comprehensive needs to be done in people are using -D_FILE_OFFSET_BITS=64.
> (Note that newer glibc versions also support this, not just Solaris.)
> 
> Since bfd_stat is a user-visible function in -lbfd, the type used in its
> interface needs to be well-specified for all users for the library, not
> just code in the binutils tree.

Well, it has to be said that Solaris isn't that hot on 64bit, 2.6 is reckoned
to have a 64bit FS, but just try building gdb with -D_FILE_OFFSET_BITS=64,
(any version) it bombs out whenever you include <sys/procfs.h>:

#if _FILE_OFFSET_BITS == 64
#error  "Cannot use procfs in the large file compilation environment"
#endif

At which point the bfd.h code:

	struct stat;
	struct stat64;
	#if _FILE_OFFSET_BITS - 0 == 64
	#define bfd_stat bfd_stat64
	#else
	extern int bfd_stat64 PARAMS ((bfd *abfd, struct stat64 *));
	#endif
	extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));

Wouldn't do you a lot of good, since you have to remove the _FILE_OFFSET flag
to get more than a few object files to build at all, (it was gdb's failure to
build that caused me to rethink, in the first place...)

Food for thought.

later
jb


More information about the Binutils mailing list