Writing code for a Mac using Lazarus
Asked Answered
H

3

5

I have done a little work on lazarus' free pascal. So when a client asked me to write an application for a mac, after the initial, "it can't be done" stage. (followed by an asp.net maybe stage) i thought about writing it using lazarus.

Question is. I have only a virtual machine running mac OSX, this means that i do not really want to develop on the mac. However, i just cannot seem to get the applications that i have written in lazarus on windows to work on the mac. I have tried the deployment using the Lazarus Wiki and the MACOS folder is empty and so when i put it on the mac it doesn't run the application.

What is the best way of doing this or am i barking up the wrong tree?

Heptagonal answered 18/9, 2011 at 17:26 Comment(1)
Clearly you have a problem but you have not described what that problem is. This makes it hard to help. Please be more specific.Maitilde
W
3

What linker and assembler do you use to generate binaries? To my best knowledge the linker for recent OS X versions is not available in source.

Afaik what you want (crosscompiling to Mac) is not possible for recent versions (and I've done it for PowerPC myself in the past).

The easiest is to use the Unix "file" command on the binary to see what is generated, and make sure it reads something with "MachO" in it. Easiest is if you have a Linux install (where this command is pretty standard), but versions can be found for windows too (cygwin, mingw and 3rd party)

Weave answered 19/9, 2011 at 18:19 Comment(0)
K
4

It seems you want to do cross-compiling, which is theoretically possible, but may not be practical, for the reasons mentioned by Marco above.

As an alternative, you could install XCode, FreePascal, and Lazarus on a MacOX machine. You could still do your development and some testing on Windows/Linux. When you hit a certain milestone, you can copy your source code to the Mac and compile your application to test and give to the user.

Even if it were possible to easily cross-compile, there some minor differences between platforms, so (especially if it's a GUI app), you would want to test it on an actual MacOS box before giving it to the client.

Knudson answered 3/2, 2012 at 7:54 Comment(0)
W
4

I've taken the route described by Noah - and I was incredibly surprised that after about three weeks development on Windows, it took about 10 minutes to get the application running on the Mac.

My route was to install Xcode 4.3 on an old Mac Mini running snow leopard, then install Lazarus using the fink version as described here. This took a while but was done in an evening.

Then I just copied my folder across to the Mac, opened the lpi on the Mac, compiled it. It failed so I removed a windows references, recompiled, and it was working. I was truly amazed.

Wiretap answered 21/4, 2013 at 23:38 Comment(0)
W
3

What linker and assembler do you use to generate binaries? To my best knowledge the linker for recent OS X versions is not available in source.

Afaik what you want (crosscompiling to Mac) is not possible for recent versions (and I've done it for PowerPC myself in the past).

The easiest is to use the Unix "file" command on the binary to see what is generated, and make sure it reads something with "MachO" in it. Easiest is if you have a Linux install (where this command is pretty standard), but versions can be found for windows too (cygwin, mingw and 3rd party)

Weave answered 19/9, 2011 at 18:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.