使用 Lazarus 为 Mac 编写代码
我对 lazarus 的 free pascal 做了一些工作。因此,当客户要求我为 Mac 编写应用程序时,在最初的“无法完成”阶段之后。 (后面可能是一个 asp.net 阶段)我考虑过使用 lazarus 来编写它。
问题是。我只有一个运行 mac OSX 的虚拟机,这意味着我并不是真的想在 mac 上进行开发。然而,我似乎无法让我在 Windows 上用 lazarus 编写的应用程序在 Mac 上运行。我已经尝试使用 Lazarus Wiki 进行部署,并且 MACOS 文件夹是空的,所以当我放置它时在 Mac 上它不运行该应用程序。
这样做的最好方法是什么,还是我找错了树?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看来你想做交叉编译,这在理论上是可能的,但由于 Marco 上面提到的原因可能不实际。
作为替代方案,您可以在 MacOX 计算机上安装 XCode、FreePascal 和 Lazarus。您仍然可以在 Windows/Linux 上进行开发和一些测试。当您达到某个里程碑时,您可以将源代码复制到 Mac 并编译您的应用程序以进行测试并提供给用户。
即使可以轻松地交叉编译,平台之间也存在一些细微的差异,因此(特别是如果它是 GUI 应用程序),您需要在将其提供给客户端之前在实际的 MacOS 机器上对其进行测试。
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.
我采用了 Noah 描述的路线 - 令我感到非常惊讶的是,在 Windows 上开发了大约三周后,应用程序在 Mac 上运行大约需要 10 分钟。
我的路线是在运行雪豹的旧 Mac Mini 上安装 Xcode 4.3,然后使用 fink 版本安装 Lazarus,如所述 在这里。这花了一些时间,但在一个晚上就完成了。
然后我将文件夹复制到 Mac,在 Mac 上打开 lpi,编译它。它失败了,所以我删除了 Windows 引用,重新编译,然后它就可以工作了。我真的很惊讶。
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.
您使用什么链接器和汇编器来生成二进制文件?据我所知,最新 OS X 版本的链接器在源代码中不可用。
Afaik 你想要的(交叉编译到 Mac)对于最近的版本来说是不可能的(我过去自己为 PowerPC 做过)。
最简单的方法是在二进制文件上使用 Unix“file”命令来查看生成的内容,并确保它读取其中包含“MachO”的内容。最简单的方法是如果您安装的是 Linux(此命令非常标准),但也可以找到适用于 Windows 的版本(cygwin、mingw 和第 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)