PDA

View Full Version : MAC Leopard + Lazarus + Dummy = ?LOST?



jdarling
04-03-2008, 02:19 PM
Ok, so at my new company we are all on MAC's (I'm not sure if I'm thrilled or not). IT tells me I can't harm this thing and to have at it. So, I've been trying to figure out how to install Lazarus on it.

Does anyone have a TRUELY for DUMMIES tutorial or walkthrough that tells you how to install Lazarus on Leopard? I need something that starts at the basics (IE: I don't know what FINK is or how to install it, and I have no idea how to get to the command line on this thing).

Thanks from a lost coder,

JernejL
04-03-2008, 05:32 PM
*My* personal reaction to a company switching to macs just like that without reasonable causes or compromises would be to go work somewhere else.

Ofcourse you might not be able to do that, so i can only wish you good luck with it.

noeska
04-03-2008, 05:59 PM
Do read this: http://wiki.lazarus.freepascal.org/OS_X_Programming_Tips

jdarling
04-03-2008, 06:35 PM
*My* personal reaction to a company switching to macs just like that without reasonable causes or compromises would be to go work somewhere else.

Ofcourse you might not be able to do that, so i can only wish you good luck with it.

LOL, this isn't a company switching to MAC. I switched companies and the new one uses MAC. I work in the marketing and advertising business, so almost everyone is MAC and not PC. In fact, the PC pretty much sucks when it comes to true media editing :).[code]

Noeska, I did read that one (and many others). In the end a few nice IT people talked me through getting the dev tools installed along with X11. I built the laz IDE with the Carbon interface and now everything is working great. With the exception that I can't figure out how to use things like Lua and SDL as I always get a ]

technomage
04-03-2008, 07:24 PM
Do check out

http://www.cerebral-bicycle.co.uk/viewdoc.asp?doc=349

It's a good article on how to use JEDI-SDL with Mac OS X.

JernejL
04-03-2008, 08:03 PM
In fact, the PC pretty much sucks when it comes to true media editing :).

Wait, are you saying that mac isn't really just a glorified PC?

*ahem*, so yeah, if PC sucks at media editing then macs suck at software development.

waran
04-03-2008, 08:31 PM
A Pentium4 in a Mac is soooo much better for media editing than the lousy Pentium4 in a PC.
Ok, maybe there are also people who won't get the irony if I dont put their noses on it :roll:

savage
04-03-2008, 10:16 PM
Hi Jeremy,
I had to go through this for the Game Maker port.
The thin you have to decide is if you want to use the latest stable version or an over night snapshot and also if you are using Intel Macs or Power PC macs
The easiest way to get Lazarus installed on Mac OS X is to do the grab some *.dmg files...

For stable :
1. Grab the last stable release from http://sourceforge.net/project/showfiles.php?group_id=89339
You are looking the PowerPC/i386 files that start with..

fpc-2.2.0-[processor]-macosx.dmg
fpcsrc-2.2.0-[processor]-macosx.dmg
lazarus-0.9.24-[processor]-macosx.dmg


or

For latest overnight snapshot :
1. Go to http://www.hu.freepascal.org/lazarus/
2. Grab the files that look like this...

fpc-2.2.0-[snapshotdate]-[processor]-macosx.dmg
fpcsrc-2.2.0-[snapshotdate]-[processor]-macosx.dmg
lazarus-0.9.25-[snapshotdate]-[processor]-macosx.dmg


The *.dmg files MUST be installed in the order listed above.
*.dmg files are like packages in Linux or in the case of the FPC and Lazarus dmg files, like MSI installers. Note you will need admin/sudo access less to be able to install these dmg files.

The harder way to do it would be to download the source code using SVN and build everything from that, but you need at least the FPC compiler for that.

I hope this helps.

jdarling
05-03-2008, 05:32 PM
Hey Savage, thanks for the info. Unfortunately my problem with using the standard DMG distros is that they require GTK/2 to be installed. Since I'm using Leopard FINK isn't available and I can't figure out how to install GTK by hand. Thus I had to go with the Carbon interface. I managed to get SVN installed, checked out the Carbon sources and built Lazarus for Carbon.

Unfortunately, nothing I build runs properly under Carbon :(. Command line apps all run ok, but the actual carbon apps just sit their doing nothing :(.

Guess they mean it when they say that Carbon is still in DEEP alpha mode.

To everyone else:
I don't want to start a flame war on architecture here. Yes, I'm running the Duo Core Intel MAC and yes I realize its similar to a PC (meaning Windows and Linux standard distros), but after using all I can say this thing blows the pants off other Linux and Windows distros when it comes to video editing.

Comparing apples to apples (no pun intended) I have similar hardware at home running Windows Vista and the latest Debian distros and I can see where the MAC rips them to pieces.

When it comes to installing and using 3rd party libraries though I can see where windows still wins hands down. Nothing like simply copying a dll into a folder and it works. On the MAC and Linux sides you have to install the .a or .so files and link against them or it won't work properly (damnit).

If anyone knows how to get GTK installed (easily) on Leopard let me know, until then I'm still fiddling with Carbon.

JernejL
05-03-2008, 05:51 PM
I don't want to start a flame war on architecture here.


But you just did a few posts ago



Yes, I'm running the Duo Core Intel MAC and yes I realize its similar to a PC (meaning Windows and Linux standard distros)


It IS a pc.



but after using all I can say this thing blows the pants off other Linux and Windows distros when it comes to video editing.


Such as? you made some benchmarks?



Comparing apples to apples (no pun intended) I have similar hardware at home running Windows Vista and the latest Debian distros and I can see where the MAC rips them to pieces.


I thought you didn't want to start a flame war, but you still keep on going and going..

savage
05-03-2008, 07:23 PM
Unfortunately, nothing I build runs properly under Carbon :(. Command line apps all run ok, but the actual carbon apps just sit their doing nothing :(.

As mentioned privately, in order for your application to run properly on Mac OS X you need to make use of Application Bundles.

Create the following folder hierarchy...


MyApp.app ( then right click on it and select "Show Package Contents" )
Contents
MacOS


Now copy your Mac OS exe into the MacOS sub-directory.

If you now double click MyApp your application should now work like a normal Carbon application.

I hope this helps others.

cronodragon
05-03-2008, 08:45 PM
Yes, I'm running the Duo Core Intel MAC and yes I realize its similar to a PC (meaning Windows and Linux standard distros)


It IS a pc.

Interesting that Apple invented the PC (personal computer), but we identify as PC the architecture of their enemies, IBM. Ironic :lol:

EDIT: And now HP tries to identify itself with the PC: "The computer is personal again" :lol:

JernejL
05-03-2008, 08:47 PM
Yes, I'm running the Duo Core Intel MAC and yes I realize its similar to a PC (meaning Windows and Linux standard distros)


It IS a pc.

Interesting that Apple invented the PC (personal computer), but we identify as PC the architecture of their enemies, IBM. Ironic :lol:

And now they use the same "enemy" ibm architecture and call it a "mac"... and fanboys still claim it's better than a pc..

jdarling
05-03-2008, 09:41 PM
Ok, so back on topic. So far here is what I have found out when dealing with Lazarus on Leopard:

1) Download an SVN client
2) Download and install the FPC DMG file
3) Perform an SVN checkout of the Lazarus Source
4) Perform "sudo make macosx install" in the trunk folder for Lazarus
5) Drag the icon to the launch bar
6) Create a new projects folder
7) Create a new project and in the options set its output folder to "MyAppName/Components/MacOS/"
8) Drop to the shell and create the same folder structure as mentioned in 7
9) Build the test app and run it

So far all is good. I'll have to see about putting together better documentation, but thats at least the high level that I've found works thus far.

PS: Thanks greatly for your info Savage. I still can't get SDL or Lua applications to work, but this is due to it failing during linking. I'm guessing I'm going to have to put the .a or .so files some place everything can find them.

savage
05-03-2008, 10:06 PM
Jeremy, You didn't tell me you were using SDL as well, otherwise I would have provided more info.

MacOS has the concept of "Frameworks", which are essentially application bundles for shared libraries. So here is what you need to do ( and has worked for me )...

1. grab the SDL dmg files from the libsdl.org site and install them. There will install the SDL Framework.

2. In your Lazarus project options (-k if you are using the command line) on Linking, you need to pass the following...


-framework carbon -framework cocoa -framework sdl

obviously add similar things for sdl_mixer, sdl_image etc etc.

3. Again in the Lazarus project options, on the Other tab in the "Custom options" section you need...


-XMSDL_main


This is required because the SDL Framework requires a C style "main"
and means you need a file called SDLMain.o which contains a main function called SDL_main. There may be a better way to do this, so if anyone find out how to do it, please let me know.

4. in your project file you will need

{$IFDEF DARWIN}
{$LINKLIB gcc}
{$LINKLIB SDLMain}
{$ENDIF}


So the only thing left now is a missing SDLMain.o (http://www.cerebral-bicycle.co.uk/downloads/SDLMain.o) file.

technomage
06-03-2008, 12:12 AM
Everyone seems to have missed my earlier post regarding JEDI-SDL and Mac OSX :cry:

:wink:


Do check out

http://www.cerebral-bicycle.co.uk/viewdoc.asp?doc=349

It's a good article on how to use JEDI-SDL with Mac OS X.


EDIT: BTW Dom , it might be an idea to include an Intel and PPC SDLMain.o file in the JEDI-SDL release.

savage
06-03-2008, 12:25 AM
Not a bad idea Dean.

I wonder if it's possible to create a Universal version of SDLMain.o so that only one file is required.

jdarling
06-03-2008, 02:09 PM
Everyone seems to have missed my earlier post regarding JEDI-SDL and Mac OSX :cry:

:wink:


Do check out

http://www.cerebral-bicycle.co.uk/viewdoc.asp?doc=349

It's a good article on how to use JEDI-SDL with Mac OS X.


EDIT: BTW Dom , it might be an idea to include an Intel and PPC SDLMain.o file in the JEDI-SDL release.

I didn't miss it, I just found it difficult to follow :). For a geek I'm pretty slow picking up new OS's apparently :D.

So, if I have to put all the libs and stuff into the project for SDL apps to work properly will I have to do the same for Lua to work? Basically I've setup two test projects to try and get Lua to link and the other to get SDL to link. Following your directions I got the SDL to link, but I still can't figure out how to link Lua :(.

savage
06-03-2008, 10:27 PM
It might be an idea to post any error messages you get while linking.
Are your Lua headers Mac OS X compatible?

jdarling
07-03-2008, 04:24 PM
The Lua headers are the ones generated when I do a make on the Lua sources so they should be ok. The Lua interpreter doesn't have any problems with them :).

The funny thing is that I don't get any good error messages. It simply says: "ERROR while linking."

I know it has something to do with the Lua.pas file and I've tracked it down a bit further but can't get enough information to actually do anything useful with it. IE: It has something to do with the LibraryName constant. I've tried everything from liblua to liblua5.1.so (including; liblua5.1.a, liblua.a, liblua.so) all of which exist in the lua frameworks folder :(. I wonder if I need to tell it where to find the framework folder or if I need to include the framework as you do with SDL.

PS: Yes I still have my gmail account and check it quite frequently so that would be the best place to send files.

jdarling
07-03-2008, 04:25 PM
The Lua headers are the ones generated when I do a make on the Lua sources so they should be ok. The Lua interpreter doesn't have any problems with them :).

The funny thing is that I don't get any good error messages. It simply says: "ERROR while linking."

I know it has something to do with the Lua.pas file and I've tracked it down a bit further but can't get enough information to actually do anything useful with it. IE: It has something to do with the LibraryName constant. I've tried everything from liblua to liblua5.1.so (including; liblua5.1.a, liblua.a, liblua.so) all of which exist in the lua frameworks folder :(. I wonder if I need to tell it where to find the framework folder or if I need to include the framework as you do with SDL.

PS: Yes I still have my gmail account and check it quite frequently so that would be the best place to send files.