compilation problems with some code from Linux
af300wsm at gmail.com
Sat Dec 16 11:42:03 PST 2006
On 12/8/06, Lane <lane at joeandlane.com> wrote:
> 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
> > the kernel. However, when I try to compile, gcc continually bails with
> > following error (among others), "NGROUPS was not declared in this
> > 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 at freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > To unsubscribe, send any mail to
> > "freebsd-questions-unsubscribe at freebsd.org"
> I won't pretend to know exactly which header files correspond for your
> but in the past I've found some things that work for me:
> locate vfs.h
> to find similar file names. On 6.x and 5.x I see that these are possible
> 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
> what you need (although it may be overkill). Or it may be the LAST thing
> 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
> on my own system.
> As far as the NGROUP or other macros ... yikes! You may have to recreate
> functionality entirely.
> I ran this:
> for each in `locate .h | grep '\.h$'`
> if [ -f $each ]; then
> MYF=`cat $each | grep -i ngroups`
> if [ "x$MYF" != "x" ]; then
> echo $each : "$MYF"
> It could probably be done more easily with sed and some elbow grease, but
> does show NGROUPS defined here:
> /usr/X11R6/include/X11/Xos.h : #define NGROUPS 16
> among other places.
> Good luck!
> freebsd-questions at freebsd.org mailing list
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe at freebsd.org"
Thank you everyone. I'm sorry that I didn't reply sooner. I did get this
worked out, but unfortunately I don't remember the include file I had to
use. I found in a different file than the one I was editing at the time I
wrote this a nice comment explaining why the "#include <sys/vfs.h>"
preprocessor directive was there. I found that function in a different
include file for FreeBSD, changed the code and all was well.
More information about the freebsd-questions