Recent

Author Topic: Build on OSX for Linux Target  (Read 13044 times)

mbohn

  • Full Member
  • ***
  • Posts: 120
Build on OSX for Linux Target
« on: December 30, 2009, 03:32:34 pm »
I'd like to be able to build my Lazarus app on OSX for a Linux target. 

So, I go to Project | Compiler Options | Code and enter under Target Platform, Target OS (-T) the selection Linux.  I left the Target CPU family (-P) selection blank and the Target Processor selection as (Default) since the cpu is the same on both computers (i386).

When I click OK I get the error message shown in the attached file.

How do I get the "system.ppu for this target" and put in in the FPC binary directory?

What do I need to do to "make sure fpc is installed correctly for this target" and how do I adjust fpc.cfg so it "contains the right directories?"

TIA

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1071
Re: Build on OSX for Linux Target
« Reply #1 on: December 30, 2009, 03:42:04 pm »
I'd like to be able to build my Lazarus app on OSX for a Linux target. 

So, I go to Project | Compiler Options | Code and enter under Target Platform, Target OS (-T) the selection Linux.  I left the Target CPU family (-P) selection blank and the Target Processor selection as (Default) since the cpu is the same on both computers (i386).

When I click OK I get the error message shown in the attached file.

How do I get the "system.ppu for this target" and put in in the FPC binary directory?

What do I need to do to "make sure fpc is installed correctly for this target" and how do I adjust fpc.cfg so it "contains the right directories?"

You have to download or build cross-compilation binutils (from Mac OS X/i386 to Linux/i386), then compile FPC from source for Linux/i386, and finally install it. See the build faq for general information about cross-compiling.

Alternatively, you can use fink to install the cross-compilation packages: http://wiki.freepascal.org/Cross_compiling#To_Windows.2C_Linux_.2832_bit.29_and_other

But keep in mind that in that case
a) you will get two separate and independent FPC installations on your system (one installed in /sw by fink, and one installed in /usr/local by the freepascal.org installer
b) the default FPC on the command line will become the one from fink
c) you may need to enable the "unstable" packages of fink to get the latest stable FPC release (because "stable" fink packages are fink packages that have been tested by enough people to be considered stable; it does not necessarily refer to the software in those packages)

Since you have to run the programs on Linux anyway afterwards to test them, I would strongly recommend to simply natively compile on Linux if you are unfamiliar with either the details cross-compiling or configuring and installing FPC via Fink for use with Lazarus.

mbohn

  • Full Member
  • ***
  • Posts: 120
Re: Build on OSX for Linux Target
« Reply #2 on: December 30, 2009, 03:58:55 pm »
Thanks for that help.

I tried the fink route a couple of days ago and haven't quite gotten fink to run correctly.

My original plan was to compile on Linux but I've hit snags with installing Lazarus on my Linux box.

So, I thought I'd try the OSX route and your help will get me going.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12721
  • FPC developer.
Re: Build on OSX for Linux Target
« Reply #3 on: December 30, 2009, 08:48:48 pm »
Moreover there is the need for Linux libraries on OS X issue.

Probably it is worth trying Linux again, any problem is more likely easier solvable than crosscompiling.

mbohn

  • Full Member
  • ***
  • Posts: 120
Re: Build on OSX for Linux Target
« Reply #4 on: December 30, 2009, 10:01:29 pm »
Moreover there is the need for Linux libraries on OS X issue.

Probably it is worth trying Linux again, any problem is more likely easier solvable than crosscompiling.
Is that true for a console app?

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Build on OSX for Linux Target
« Reply #5 on: December 30, 2009, 10:08:29 pm »
Is that true for a console app?
yes.

mbohn

  • Full Member
  • ***
  • Posts: 120
Re: Build on OSX for Linux Target
« Reply #6 on: December 30, 2009, 10:12:17 pm »
Well, if the consensus among the experts is that I'd be better off compiling natively, I'll rejoin the battle with Ubuntu and Lazarus.

I appreciate the advice.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Build on OSX for Linux Target
« Reply #7 on: December 30, 2009, 10:20:04 pm »
there should be no battle, really.
I have 2 virtual box (ubuntu and fedora, both 32-bit) machines running on OSX host.
Both machines have Lazarus installed and configured.

mbohn

  • Full Member
  • ***
  • Posts: 120
Re: Build on OSX for Linux Target
« Reply #8 on: December 30, 2009, 10:39:15 pm »
That's encouraging, but I have had a battle royale.  I'll give it another shot and ask for more help if necessary. :)

Mike J

  • Jr. Member
  • **
  • Posts: 54
  • Computer Programmer/www.NewsRx.com
    • ᏣᎳᎩ ᎦᏬᏂᎯᏍᏗ ᏗᏕᎶᏆᏍᏗ (Cherokee Language Lessons)
Re: Build on OSX for Linux Target
« Reply #9 on: December 31, 2009, 12:00:54 am »
Follow the getlaz instructions in the Wiki and Lazarus should be up and running with no fuss and no muss.
ᏙᎯ

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12721
  • FPC developer.
Re: Build on OSX for Linux Target
« Reply #10 on: December 31, 2009, 12:34:56 am »
I recommend the buildfaq, already earlier mentioned, but I'm biassed.  :D

mbohn

  • Full Member
  • ***
  • Posts: 120
Re: Build on OSX for Linux Target
« Reply #11 on: December 31, 2009, 01:49:34 am »
Quote
I recommend the buildfaq, already earlier mentioned, but I'm biassed.

You didn't by any chance write that Build FAQ did you? :)

I've been reading it also.  Pretty impressive so far.

mbohn

  • Full Member
  • ***
  • Posts: 120
Re: Build on OSX for Linux Target
« Reply #12 on: January 06, 2010, 07:46:16 pm »
Follow the getlaz instructions in the Wiki and Lazarus should be up and running with no fuss and no muss.

I did that and since it is now on Linux I have started a new thread on the Linux forum:
http://forum.lazarus.freepascal.org/index.php/topic,8329.0.html

kamischi

  • Full Member
  • ***
  • Posts: 177
Re: Build on OSX for Linux Target
« Reply #13 on: January 17, 2010, 07:41:12 pm »
Hi,

I have updated fpc in fink recently and after installing fpc-cross-i386-linux cross-compiling is supposed to work. If it does not, I would actually appreciate feedback about what goes wrong.

Everything from the rtl should work and also all those units from the packages, which do not rely on external C-libraries.

Mischi.
fpc 2.6.4, lazarus 1.4.0, Mac OS X, fink

 

TinyPortal © 2005-2018