Recent

Author Topic: TOTAL NEWBIE: how to install Lazarus on OS X intel Max  (Read 50744 times)

jhyams

  • Newbie
  • Posts: 2
TOTAL NEWBIE: how to install Lazarus on OS X intel Max
« on: December 07, 2006, 08:52:54 pm »
I see a lot of posts on this subject and all confuse me. I have never ever used a Mac before, I am from 10 years programming in Delphi on Windows. I want to write some Mac apps and use my Delphi language knowledge, ie not learn a new language. I have (or thought I had) installed Lazarus but it is nowhere to be seen on my machine. I then saw all that stuff about Fink and X11 and so on and feel completely daunted. Is there some way I can see a real step by step for complete Newbies (Newbies to the Mac world as well as to Lazarus)?

Many thanks.

Jonathan

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: TOTAL NEWBIE: how to install Lazarus on OS X intel Max
« Reply #1 on: December 07, 2006, 09:28:13 pm »
Quote from: "jhyams"
I then saw all that stuff about Fink and X11 and so on and feel completely daunted. Is there some way I can see a real step by step for complete Newbies (Newbies to the Mac world as well as to Lazarus)?


Jonathan,

Yes, it can be daunting because of Lazarus's dependency on the GTK libraries for its GUI and these aren't installed by default on Mac like they are on Linux. See this wiki topic for more information:

http://wiki.lazarus.freepascal.org/OS_X_Programming_Tips

Basically, make sure you have installed:

- OS X's X11 app.
- OS X's programmer tools (includes linker and other things needed by Free Pascal).
- fink for Intel Mac - this is only used to simplify the downloading and installation of the GTK libraries and is not used by Free Pascal and Lazarus.
- GTK libraries - these are installed in a new /sw folder, so they don't conflict with or mess up anything else on your Mac.

Maybe one day Lazarus will be as easy to install as it is on Windows (single .exe installer), but not yet.

Once you have the GTK-based Lazarus installed, you can experiment with two other widgetsets that are under development for Mac OS: the native Carbon widgetset and the Qt widgetset.

Let us know if you need more information. I think the link above should help a lot.

-Phil

jhyams

  • Newbie
  • Posts: 2
TOTAL NEWBIE: how to install Lazarus on OS X intel Max
« Reply #2 on: December 08, 2006, 09:31:31 am »
Oh dear, having read all that I feel completely put off. Sounds like major work to get the whole thing up and running, then there is some doubt as to whether it will work on the Intel Mac anyway, and finally when I have written my application there doesn't appear to be a simple way to distribute it.

Perhaps it would be easier to (re-)learn C++ and code in the XCode environment?

Jonathan

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
TOTAL NEWBIE: how to install Lazarus on OS X intel Max
« Reply #3 on: December 08, 2006, 12:08:58 pm »
Quote from: "jhyams"
Oh dear, having read all that I feel completely put off. Sounds like major work to get the whole thing up and running,


It's a setup process, just get througth it once and you will never have to do it again.

Quote
then there is some doubt as to whether it will work on the Intel Mac anyway,


Which doubt?

Quote
and finally when I have written my application there doesn't appear to be a simple way to distribute it.


You don't have to distribute Lazarus IDE with your software, so it's easier. If you use Qt or carbon interfaces you don't have to install X11, Fink or anything like that to run your software.

We are working on improving the install process, so it doesn't require X11 or Fink. Lazarus will move it's stable distribution to Gtk 2 in the not so long future, and at that point I hope someone will provide a compiled Gtk 2 that doesn't require X11 or Fink to be installed. With this, the IDE would be free from Fink and X11.

Quote
Perhaps it would be easier to (re-)learn C++ and code in the XCode environment?


Those dependencies you mentioned have nothing to do with the language. If you created a Gtk based app on C++ it would be as hard to install as Lazarus.

Not to mention that Lazarus produced software can be recompiled natively on each platform, differently from a c++ gtk software that will always need Gtk to be installed, or a Carbon or Cocoa app which simply won't work outside Mac OS X

And you can write a Carbon app on Pascal, and you can write Pascal software on XCode and not use Lazarus IDE too. Or if you use Lazarus, you don't have to use the form designer and Lazarus Component Library.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
TOTAL NEWBIE: how to install Lazarus on OS X intel Max
« Reply #4 on: December 08, 2006, 12:15:30 pm »
Here is the Gtk on native mac os x project: http://developer.imendio.com/wiki/Gtk_Mac_OS_X

Unfortunately they don't seam to provide a already compiled package, and the build process doesn't seam simple.

ovidius

  • New Member
  • *
  • Posts: 21
TOTAL NEWBIE: how to install Lazarus on OS X intel Max
« Reply #5 on: December 08, 2006, 03:58:57 pm »
Quote from: "sekel"
Here is the Gtk on native mac os x project: http://developer.imendio.com/wiki/Gtk_Mac_OS_X

Unfortunately they don't seam to provide a already compiled package, and the build process doesn't seam simple.

Actually, it works. I have successfully built a version of it. You can even compile Lazarus with it, but it will not link, because of some direct X11 rendering calls in Lazarus. Once these are mapped to cairo, you should be able to use Lazarus without X11.

Phil

  • Hero Member
  • *****
  • Posts: 2750
TOTAL NEWBIE: how to install Lazarus on OS X intel Max
« Reply #6 on: December 08, 2006, 04:06:51 pm »
Quote from: "jhyams"
Perhaps it would be easier to (re-)learn C++ and code in the XCode environment?


Jonathan: XCode is a possibility, but it's not cross-platform and any GUI code you develop won't be useable elsewhere. That's kind of the whole point to Lazarus, that you can take your Delphi GUI code (and Delphi skills) and use them on Linux and OS X. If you have no interest in Windows or Linux programming, XCode would be a good choice. I have LCL-based programs that run identically on Windows, Linux and OS X - really pretty exciting when you see your programs running on all those different platforms!

Sekel and ovidius: That's exciting news about a native GTK port. Also, any Mac users who are reading this, be sure to take a look at this well-written document:

http://developer.imendio.com/files/developer/Porting-Gtk-MacOSX.pdf

Lots of useful information here about the differences between Carbon, Cocoa, etc.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
TOTAL NEWBIE: how to install Lazarus on OS X intel Max
« Reply #7 on: December 08, 2006, 08:43:40 pm »
Quote from: "ovidius"
Actually, it works. I have successfully built a version of it. You can even compile Lazarus with it, but it will not link, because of some direct X11 rendering calls in Lazarus. Once these are mapped to cairo, you should be able to use Lazarus without X11.


Ok, now I remembered. X11 direct access is indispensable for some tasks LCL is capable of, such as taking a screenshot from the screen. However, all such calls should be encloused by IFDEFs.

Take a look at gtkinf.pp:

{$IFDEF Unix}
  {$DEFINE HasX}
  {$IFDEF Gtk1}
    {$DEFINE HasGtkX}
  {$ENDIF}
{$ENDIF}

This is what causes trouble. It should probably be:

{$IFDEF Gtk1}
  {$IFDEF Unix}
    {$DEFINE HasX}
    {$DEFINE HasGtkX}
  {$ENDIF}
{$ENDIF}

{$IFDEF Gtk2}
  {$IFDEF Unix}
    {$IFNDEF DARWIN}
      {$DEFINE HasX}
    {$ENDIF}
  {$ENDIF}
{$ENDIF}

Also at gtk2int.pp:

  {$IfNDef GTK2_2}
    {$IfNDef Win32}
     XLib, X, //XUtil,
    {$EndIf}
  {$EndIf}

This is wrong, it should check for HasX and not ifndef win32. So, many of this small things need to be changed.

You can report this as a bug. Even much better if you can go try to locate all X11 calls on Gtk2 code and make sure all IFDEFs are correct, and of course test that the final work compiles without X11 on Mac OS X.

ovidius

  • New Member
  • *
  • Posts: 21
TOTAL NEWBIE: how to install Lazarus on OS X intel Max
« Reply #8 on: December 08, 2006, 10:03:07 pm »
Quote
You can report this as a bug. Even much better if you can go try to locate all X11 calls on Gtk2 code and make sure all IFDEFs are correct, and of course test that the final work compiles without X11 on Mac OS X.

These are the errors I see when linking without your changes above: (I had to add some symlinks before, because lazarus looks for libgdk-x11-2.0.dylib and it is called libgdk-quartz-2.0.dylib. Same for libgtk.)

/usr/bin/ld: Undefined symbols:
_gdk_x11_drawable_get_xdisplay
_gdk_x11_drawable_get_xid
_gdk_display
_gdk_free_text_list

If I apply your advise, then nothing works, because compilations stucks in the /interfaces/gtk part. There seems to be some dependency I do not understand.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
TOTAL NEWBIE: how to install Lazarus on OS X intel Max
« Reply #9 on: December 14, 2006, 11:04:06 am »
Thanks, I didn't know that lib existed, I'll look if I can get it to build.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

harveyrs

  • Newbie
  • Posts: 2
TOTAL NEWBIE: how to install Lazarus on OS X intel Max
« Reply #10 on: February 27, 2007, 09:47:50 am »
javascript:emoticon(':!:')Here is a simple enough question: has anyone succeeded in installing Lazarus and freePascal on an Intel Mac so it is usable as a DELPHI-STYLED RAD? If so, would they be kind enough to divulge the critical path required. I am amazed at the development work behind this project, but I have, as yet, no evidence that it has fully arrived for owners of new Macs. :!:

Phil

  • Hero Member
  • *****
  • Posts: 2750
TOTAL NEWBIE: how to install Lazarus on OS X intel Max
« Reply #11 on: February 27, 2007, 04:45:22 pm »
Quote from: "harveyrs"
javascript:emoticon(':!:')Here is a simple enough question: has anyone succeeded in installing Lazarus and freePascal on an Intel Mac so it is usable as a DELPHI-STYLED RAD? If so, would they be kind enough to divulge the critical path required. I am amazed at the development work behind this project, but I have, as yet, no evidence that it has fully arrived for owners of new Macs. :!:


What specific problems are you having?

abb

  • New Member
  • *
  • Posts: 40
Re: TOTAL NEWBIE: how to install Lazarus on OS X intel Max
« Reply #12 on: February 27, 2007, 05:26:55 pm »
Quote from: "Phil"
Quote from: "jhyams"
I then saw all that stuff about Fink and http://wiki.lazarus.freepascal.org/OS_X_Programming_Tips

I'm sorry to interfere with your discussion but I'm also a perfect newbie in Mac :) And I appreciate the link above! But the comparative table of different libraries and their capabilities makes me blue... I'd like to port a big (in code) Delphi app into Mac OS. But I don't need too many several visual components but few scrollboxes TImage and TTreeView. But I'd like to create really easy-to-install and easy-to-use Mac app just as it is for Windows now. And I'd prefer to have an app looking natively in Mac OS. So, the question is -- whether I really need Lazarus? Or can I just use X-code with Carbon + FPC 2.1? As I see, after FPC installation a new type of New Project appears in the X-Code -- Pascal Carbon Application. Is it what I can use taking in the account all my wishes, enumerated above?

Please help me understand it!

kalle_19

  • New Member
  • *
  • Posts: 15
RE: Re: TOTAL NEWBIE: how to install Lazarus on OS X intel M
« Reply #13 on: February 27, 2007, 05:36:20 pm »
Well, you can use XCode, but it's pretty different than delphi RAD - you need to create connections and headers just to use a button...

abb

  • New Member
  • *
  • Posts: 40
Re: RE: Re: TOTAL NEWBIE: how to install Lazarus on OS X int
« Reply #14 on: February 27, 2007, 05:59:53 pm »
Quote from: "kalle_19"
Well, you can use XCode, but it's pretty different than delphi RAD - you need to create connections and headers just to use a button...

So, good... are you about a X-Code with FPC? If yes, then why should I "create a button"? Can't I use already existing components from Carbon library? Or I can't use the "X_Code's Carbon" because it is C++ library? Could you clarify it?

Also can I use Lazarus in a way that:

-- would not require to install any special system components like X11, etc. on a target computer? I'm agree to install everything I need on my (developer's) computer, but not at the user's computer.

-- would create an app, easily installable in a user's system just like a package is installed by few mouse clicks?

-- would create a user interface, looking natively in Mac OS? This is because I'm speaking about a commercial project... External look-and-feel is important here!

Appreciate a clarification!