Date: Sat, 16 Dec 2006 12:37:40 -0700 From: "Andrew Falanga" <af300wsm@gmail.com> To: Lane <lane@joeandlane.com>, freebsd-questions <freebsd-questions@freebsd.org> Subject: Re: compilation problems with some code from Linux Message-ID: <340a29540612161137j69850888t9dcffa9f7cd04e47@mail.gmail.com> In-Reply-To: <200612081205.10243.lane@joeandlane.com> References: <340a29540612080921i7d202e4dn7f8378c5341aeca2@mail.gmail.com> <200612081205.10243.lane@joeandlane.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 12/8/06, Lane <lane@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 > 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 > _______________________________________________ > 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" > 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. Thanks again. Andy
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?340a29540612161137j69850888t9dcffa9f7cd04e47>