Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Dec 2006 12:05:10 -0600
From:      Lane <lane@joeandlane.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: compilation problems with some code from Linux
Message-ID:  <200612081205.10243.lane@joeandlane.com>
In-Reply-To: <340a29540612080921i7d202e4dn7f8378c5341aeca2@mail.gmail.com>
References:  <340a29540612080921i7d202e4dn7f8378c5341aeca2@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 08 December 2006 11:21, Andrew Falanga wrote:
> Hi,
>
> I'm trying to port some code from Linux to FreeBSD and I've got an issue
> that revolves around something I've never dealt with before.  The code
> includes the following header:
>
> #include <sys/ucred.h>
>
> Apparently, program is attempting to make use of the xucred structure
> defined in there, because the rest of the stuff in the file seems to be for
> the kernel.  However, when I try to compile, gcc continually bails with the
> following error (among others), "NGROUPS was not declared in this scope."
> The NGROUPS appears to be a macro, but it's not defined earlier on.  Would
> anyone here know where it's defined so I can include that file too?
>
> Secondly, I'm also getting errors because gcc can't find <sys/vfs.h>
> either.  True enough, there isn't any vfs.h file in /usr/include/sys. 
> Since this file is in Linux, what should I include for FreeBSD?
>
> Thanks,
> Andy
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe@freebsd.org"
Andy,

I won't pretend to know exactly which header files correspond for your port, 
but in the past I've found some things that work for me:

use 

locate vfs.h

to find similar file names.  On 6.x and 5.x I see that these are possible 
candidates:

/usr/X11R6/include/gnome-vfs-2.0/libgnomevfs/gnome-vfs.h
/usr/include/fs/devfs/devfs.h
/usr/include/sys/statvfs.h
/usr/local/include/af_vfs.h
/usr/src/sys/compat/svr4/svr4_statvfs.h
/usr/src/sys/fs/devfs/devfs.h
/usr/src/sys/nfs4client/nfs4_vfs.h
/usr/src/sys/sys/statvfs.h


But you'd have to compare the functions and structures defined in sys/vfs.h on 
linux to determine which is your best match up.

There is /usr/ports/devel/mipsel-linux-kernel-headers/ which, according to 
pkg-plist will install mipsel-linux/include/linux/vfs.h.  That may be exactly 
what you need (although it may be overkill).  Or it may be the LAST thing you 
need :)

Sometimes a porter will simply create a patch file 
in /usr/ports/<portname>/files that will create a skeleton version of the 
file which includes only the items you need.  I've done this for development 
on my own system.

As far as the NGROUP or other macros ... yikes!  You may have to recreate that 
functionality entirely.

I ran this:

#!/bin/sh
for each in `locate  .h | grep '\.h$'`
do
if [ -f $each ]; then
MYF=`cat $each | grep -i ngroups`
if [ "x$MYF" != "x" ]; then
        echo $each : "$MYF"
fi
MYF=""
fi
done


It could probably be done more easily with sed and some elbow grease, but it 
does show NGROUPS defined here:

/usr/X11R6/include/X11/Xos.h : #define NGROUPS 16

and 

/usr/include/sys/param.h 

among other places.

Good luck!

lane



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200612081205.10243.lane>