Error compiling Samba

Jim Duey jduey at
Thu Jul 12 18:03:30 GMT 2001


I've been trying to cross compile Samba targeting the PowerPC 405GP 
embedded processor.  The compile proceeds until it gets to 
source/smbd/vfs-wrap.c in function vfs_ftruncate().  I've included the 
first part of that function below.  In config.h, WITH_PROFILE is 
undefined and HAVE_FTRUNCATE_EXTEND is undefined.  Since WITH_PROFILE is 
undefined, "START_PROFILE(syscall_ftruncate);" evaluates to ";" by the 
preprocessor.  This lone ; causes the compiler to halt with the 
following error.

/home/jim/archive/samba-2.2.0a/source/smbd/vfs-wrap.c: In function 
/home/jim/archive/samba-2.2.0a/source/smbd/vfs-wrap.c:494: parse error 
before `struct'
/home/jim/archive/samba-2.2.0a/source/smbd/vfs-wrap.c:499: `currpos' 
undeclared (first use in this function)
/home/jim/archive/samba-2.2.0a/source/smbd/vfs-wrap.c:499: (Each 
undeclared identifier is reported only once
/home/jim/archive/samba-2.2.0a/source/smbd/vfs-wrap.c:499: for each 
function it appears in.)
/home/jim/archive/samba-2.2.0a/source/smbd/vfs-wrap.c:499: `vfs_ops' 
undeclared (first use in this function)
/home/jim/archive/samba-2.2.0a/source/smbd/vfs-wrap.c:508: `st' 
undeclared (first use in this function)
/home/jim/archive/samba-2.2.0a/source/smbd/vfs-wrap.c:534: `c' 
undeclared (first use in this function)

Commenting out this line allows the compiler to get past this error. (It 
has another error but I'll post another message for that)  Placing a 
lone ; anywhere before the 'struct vfs_obs' line causes the same error. 
 Removing the ';' from 'START_PROFILE(syscall_ftruncate)' also works. 
 The compiler version is gcc 2.95.2.  I can work around this problem for 
myself, but I'd like to know the 'official' answer to this problem.


int vfswrap_ftruncate(files_struct *fsp, int fd, SMB_OFF_T len)
    int result = -1;

    result = sys_ftruncate(fd, len);
    return result;

    /* According to W. R. Stevens advanced UNIX prog. Pure 4.3 BSD cannot
        extend a file with ftruncate. Provide alternate implementation
        for this */

    struct vfs_ops *vfs_ops = &fsp->conn->vfs_ops;

More information about the samba-technical mailing list