From owner-freebsd-questions Sat Jul 3 11: 0:17 1999 Delivered-To: freebsd-questions@freebsd.org Received: from sand2.global.net.uk (sand2.global.net.uk [195.147.246.100]) by hub.freebsd.org (Postfix) with ESMTP id 73D8C15096 for ; Sat, 3 Jul 1999 11:00:10 -0700 (PDT) (envelope-from marko@globalnet.co.uk) Received: from pd6s03a06.client.global.net.uk ([195.147.211.215] helo=marder-1.) by sand2.global.net.uk with esmtp (Exim 2.05 #1) id 110U5B-0003uS-00; Sat, 3 Jul 1999 19:00:10 +0100 Received: (from marko@localhost) by marder-1. (8.9.2/8.8.8) id SAA01032; Sat, 3 Jul 1999 18:55:44 +0100 (BST) (envelope-from marko) Date: Sat, 3 Jul 1999 18:55:44 +0100 From: Mark Ovens To: Alfred Perlstein Cc: Zhibing Wang , freebsd-questions@FreeBSD.ORG Subject: Re: how to compile c program for linux on freebsd Message-ID: <19990703185544.A423@marder-1> References: <19990703162927.27710.rocketmail@web130.yahoomail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.3i In-Reply-To: ; from Alfred Perlstein on Sat, Jul 03, 1999 at 11:43:23AM -0500 Organization: Total lack of Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 #else #include #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