“适用于 Mac 的可再发行二进制文件,使用 QT 和其他一些库”的速成课程?

发布于 2024-12-11 04:39:00 字数 350 浏览 0 评论 0原文

好吧,我是一名工程师/应用数学人员,有些软件的 Linux 版本给我留下了深刻的印象,但想要 Mac 版(医生...)

有人可以告诉我如何重新分发 Mac 的可执行文件吗?在我放弃 Windows 之前,原子解决方案是将一堆 DLL 复制到其 System32 文件夹中。一些子问题:

1)好吧,我看到“sudo macports install XYZ”。这允许我静态构建 QT 应用程序吗?或者,假设他们安装了 QT,我如何让我的应用程序在他们的电脑上找到它?

2)也许有一个例子,使用VTK + QT + Boost,为Mac构建应用程序?

我对这个模糊的问题表示歉意,如果我知道要系统地搜索什么,我就会这样做。

Ok so I am an engineer / applied-math guy and someone only mildly technical was impressed by a linux version of some software but wants it for Mac (Doctors...)

Can someone point me at how to redistribute an executable for Mac? Before I ditched Windows the atomic solution was to copy a bunch of DLL's into their System32 folder. Some sub-questions:

1) Ok I see "sudo macports install XYZ". Will this allow me to statically build QT apps? Or, suppose they have QT installed, how do I get my app to find it on their comp?

2) Maybe there's an example out there, using VTK + QT + Boost, for building application for Mac?

My apologies with the vague question, if I knew what to methodically search for I would have done so.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

魂ガ小子 2024-12-18 04:39:00

您想要将 Qt+VTK+Boost 与应用程序静态链接有什么具体原因吗?在 Mac 上,对于像这样的库,我想不出任何理由(许可除外)为什么静态链接比动态链接更好。

查看 Bvarious 发布的“在 Mac OS X 上部署应用程序”链接。它解释了 Mac 应用程序如何存储在捆绑包中,从而允许由许多文件组成的应用程序向用户显示为单个文件。库也可以存储在一个包中(连同它们的头文件),在这种情况下它被称为框架。任何需要的框架都可以存储在应用程序包中,使应用程序独立。

Qt 附带了一个名为 macdeployqt 的实用程序,它会自动将 Qt 框架(以及插件)复制到捆绑包中,然后修复应用程序二进制文件(使用 install_name_tool),以便动态链接器知道查看应用程序包。您可能需要为 VTK 和 Boost 手动执行此操作,如果它们不是自动构建为框架,这可能会更加复杂。虽然它们是流行的库,但互联网上应该有关于使用 VTK/Boost 部署 Mac 应用程序的指南。

另外,我不会为此目的使用 MacPorts 安装 Qt。 Qt 二进制文件可从诺基亚获取< /a> 工作得很好,而且它们是通用的(为 32 位和 64 位构建,以防您需要同时针对两者)。

顺便说一句,我不是一个特别喜欢 Windows 的人,但我不认为将 DLL 放入 System32 并不是在 Windows 上部署库的好方法。对于我制作的 Qt 应用程序,我们将 Qt DLL(和 mingw/gcc DLL)放入与 .exe 相同的文件夹中,并且运行良好。

Is there any specific reason why you want to statically link Qt+VTK+Boost with the app? On the Mac, for libraries like these I can't think of any reason (except licensing) why static linking would be preferable to dynamic.

Take a look at the "Deploying an Application on Mac OS X" link that Bavarious posted. It explains how Mac apps are stored in bundles, allowing an app made up of many files to appear to the user as a single file. Libraries can also be stored in a bundle (along with their header files), in which case it's called a framework. Any needed frameworks can be stored inside the app bundle, making the app self-contained.

Qt comes with a utility called macdeployqt which automatically copies the Qt frameworks (plus plugins) into the bundle, then fixes up the app binary (using install_name_tool) so the dynamic linker knows to look in the app bundle. You'll probably need to do this manually for VTK and Boost, which could be more complicated if they aren't built automatically as frameworks. They are popular libraries though, there should be guides on the Internet about deploying Mac apps with VTK/Boost.

Also, I would not use MacPorts to install Qt for this purpose. The Qt binaries available from Nokia work just fine, and they are universal (built for both 32-bit and 64-bit, in case you need to target both).

By the way, I'm not particularly a Windows guy, but I don't think throwing DLLs into System32 is a good way to deploy libraries on Windows. For a Qt app I made, we put the Qt DLLs (and mingw/gcc DLLs) into the same folder as the .exe, and it worked fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文