开发者

Writing code for a Mac using Lazarus

开发者 https://www.devze.com 2023-04-05 22:04 出处:网络
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 i开发者_如何学JAVAnitial, \"it can\'t be done\" stage. (followed by an asp.ne

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 i开发者_如何学JAVAnitial, "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?


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.


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.


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号