Hello,
After months of being distracted by another portion of my
application, I'm back to creating a universal binary version of the
Pascal based library we are linking into our C++ based application.
The problem is the application will not launch under PPC on Mac OS X
10.3 (Panther). The console registers an undefined symbol: _statvfs
expected to be defined in /usr/lib/libSystem.B.dylib
After some research, I found this call is being used by the StatFS
routine implemented in rts.c (line 1510)
/** Get information about a file system. */
GLOBAL (Boolean _p_StatFS (char *Path UNUSED, StatFSBuffer *Buf))
{
int Result;
#ifdef HAVE_STATVFS
struct statvfs b;
errno = 0;
Result = statvfs (Path, &b);
Buf->BlockSize = (long long int) b.f_frsize;
Buf->BlocksTotal = (long long int) b.f_blocks;
Buf->BlocksFree = (long long int) b.f_bavail;
Buf->FilesTotal = (int) b.f_files;
Buf->FilesFree = (int) b.f_favail;
#elif defined (HAVE_STATFS)
struct statfs b;
errno = 0;
Result = statfs (Path, &b);
Buf->BlockSize = (long long int) b.f_bsize;
Buf->BlocksTotal = (long long int) b.f_blocks;
Buf->BlocksFree = (long long int) b.f_bavail;
Buf->FilesTotal = (int) b.f_files;
Buf->FilesFree = (int) b.f_ffree;
#else
Result = -1;
errno = ENOSYS;
#endif
if (Result == 0) return True;
Buf->BlockSize = 0;
Buf->BlocksTotal = 0;
Buf->BlocksFree = 0;
Buf->FilesTotal = 0;
Buf->FilesFree = 0;
return False;
}
It appears to me that HAVE_STATVFS is defined if my current OS X SDK
(10.4) has a statvfs.h header file amongst its include files, which
means if I build my Pascal development environment from the build-on-
Intel.command that the statvfs version will be hard wired into the
runtime and any binary I generate will not work on 10.3 (which does
not have statvfs in its libSystem.B.dylib library). Also, if I build
my environment/library on a PowerPC using the build-on-
powerPC-10.3.command, I end up with a different set of link problems
involving the long double version of pow(). Besides which, I'd prefer
to do my development on OS X for Intel going forward.
I have tried hand editing the above routine and rebuilding my Pascal
development environment, and pulling the statvfs.h file from my OS X
SDK, and yet when my application links, it still has an unresolved
reference to _statvfs. I'm not a build engineer, as my previous
missives to this mailing list make clear, and I'm at a loss as to how
to proceed.
Just to be clear, I link in two static libraries: a universal version
of the libgpc.a for the runtime, and a universal version of the
library I've created. Neither of them contain the symbol _statvfs (at
least I can't find that text in them). I link that with my
application. The application now references _statvfs (I can now see
the text in it's executable). I can't launch on 10.3. I comment out
the calls to the Pascal library and recompile+relink, and the
application no longer has the symbol and I can launch under 10.3. So
something in either of the gpc associated libraries must be calling
something which calls statvfs, making the linker (ld) mark statvfs as
an unresolved symbol to be loaded in at runtime. At least that is my
impression.
So, I'd appreciate some suggestions.
--glenn