[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: autoconf 2.52 vs Solaris 2.6 AC_SYS_LARGEFILE problems

From: Paul Eggert
Subject: Re: autoconf 2.52 vs Solaris 2.6 AC_SYS_LARGEFILE problems
Date: Wed, 28 Nov 2001 14:57:05 -0800 (PST)

> From: "Mark D. Baushke" <address@hidden>
> Date: Fri, 23 Nov 2001 00:53:02 -0800
> The basic problem is that _LARGEFILE64_SOURCE needs to be defined on
> Solaris 2.6 if AC_SYS_LARGEFILE ends up doing a 
> '#define _FILE_OFFSET_BITS 64'
> If _FILE_OFFSET_BITS == 64, then <sys/resource.h> will define a
> 'struct rlimit64' but NOT define a 'struct rlimit' leading to a
> failure to compile ssh.c because 'struct rlimit' is not a complete
> type.

I don't observe this problem on Solaris 2.6, with either gcc 2.95.2 or
with Sun WorkShop 6 update 1 cc.  Here's the program that I used:

  #define _FILE_OFFSET_BITS 64
  #include <sys/resource.h>
  #include <stdio.h>
  int main()
    struct rlimit r;
    if (getrlimit (RLIMIT_FSIZE, &r) != 0)
      perror ("getrlimit");
    printf ("file size limit is %lld\n", r.rlim_cur);
    return 0;

and here's the behavior I get when running the program:

  $ ulimit -f 4294967296
  $ ./a.out 
  file size limit is 4398046511104

which appears to be correct (4398046511104 == 4294967296 * 1024).

Can you reproduce the problem with the above source file?  If so, what
is the output of "gcc -E" for that file?

Here is the sys/resource.h include file that I used.

  $ ls -l /usr/include/sys/resource.h
  -rw-r--r--   1 bin      bin         4366 Jul 15  1997 
  $ sum /usr/include/sys/resource.h
  21067 9 /usr/include/sys/resource.h

> The Solaris 2.6 lfcompile(5) man page provides the supported method of
> compiling apps with largefile support under Solaris is to use the
> getconf command.  Perhaps getconf(1) should be used to define the
> correct flags (rather than guessing at which macros need to be
> defined) to ensure compatibility with current and future releases of
> Solaris?

We used to do it that way, but ran into many portability problems in
practice.  Among other things, it makes cross-compiling difficult.
Also, the LFS getconf flags are not really standardized well in

>   #define _LARGEFILE_SOURCE 1

_LARGEFILE_SOURCE is (supposed to be) an independent issue.  It
governs whether some symbols (notably fseeko) are visible, regardless
of whether you're compiling in largefile-mode.  AC_SYS_LARGEFILE used
to define _LARGEFILE_SOURCE but that was a mistake and nowadays it is
the job of AC_FUNC_FSEEKO.

> So, if someone who understands how to do it properly would adapt the
> code below that I wrote for the OpenSSH source for use in the
> AC_SYS_LARGEFILE macro of autoconf itself, I would appreciate it.

Which version of GCC were you using on Solaris 2.6, and how was that
GCC built?  If you were using GCC 2.7.2.x or earlier, it does not
work, as it mishandles system headers.  (This is not too surprising,
as GCC 2.7.2.x was released before Solaris 2.6 was.)  You cannot
reliably use GCC 2.7.2.x on Solaris 2.6 or later, and this is not
something that can be autoconfed around.

Also, if GCC is built on a version of Solaris other than 2.6, it won't
run correctly on 2.6: it will have subtle bugs.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]