Date: Sat, 3 Jul 1999 18:55:44 +0100 From: Mark Ovens <markov@globalnet.co.uk> To: Alfred Perlstein <bright@rush.net> Cc: Zhibing Wang <wang_zb@yahoo.com>, freebsd-questions@FreeBSD.ORG Subject: Re: how to compile c program for linux on freebsd Message-ID: <19990703185544.A423@marder-1> In-Reply-To: <Pine.BSF.3.96.990703113906.14320w-100000@cygnus.rush.net>; from Alfred Perlstein on Sat, Jul 03, 1999 at 11:43:23AM -0500 References: <19990703162927.27710.rocketmail@web130.yahoomail.com> <Pine.BSF.3.96.990703113906.14320w-100000@cygnus.rush.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jul 03, 1999 at 11:43:23AM -0500, Alfred Perlstein wrote: > On Sat, 3 Jul 1999, Zhibing Wang wrote: > > > hi there: > > I am trying to compile a c program on freebsd 3.2. > > the program was writen for linux originally. it calls > > many header files in /usr/include/linux and some other > > directories, which can not be found in freebsd. > > what can I do? just copy those directories from > > linux ? > > really appreciate for any help. > > no: > > 1) remove all includes that reference linux/* > 2) try to compile the program, see which structures the > compile fails on because they are not defined, > 3) try to find those in the freebsd headers and include > those > 4) repeat steps 2 & 3 until you have found all structures > needed. > 5) convert still unfound structures to the appropriate > freebsd ones. > > do not touch anything in /usr/include, you should > only be working on your program. > If you wish the same source files to still compile under Linux as well as FreeBSD then instead of *changing* the #includes and structs wrap them in #ifdef...#else...#endif thus: #ifdef __FreeBSD__ #include <freebsd.h> #else #include <linux.h> #endif You may find the book "Porting Unix Software" by Greg Lehey (of "The Complete FreeBSD" fame) useful, I do. It's published by O'Reilly, ISBN 1-56592-126-7 > -Alfred Perlstein - [bright@rush.net|bright@wintelcom.net] > systems administrator and programmer > Win Telecom - http://www.wintelcom.net/ > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > -- FreeBSD - The Power To Serve http://www.freebsd.org My Webpage http://www.users.globalnet.co.uk/~markov _______________________________________________________________ Mark Ovens, CNC Apps Engineer, Radan Computational Ltd. Bath UK CAD/CAM solutions for Sheetmetal Working Industry mailto:markov@globalnet.co.uk http://www.radan.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990703185544.A423>