如何构建 C++适用于 Xcode 中的 OSX 10.4、10.5 和 10.6,带有动态库

发布于 2024-08-20 15:39:25 字数 356 浏览 6 评论 0原文

我正在 Xcode 中构建一个 C++ 命令行工具。该项目包含用于curl、boost 和log4cpp 的dylib。

理想情况下,我喜欢构建一个支持 10.4 到 10.6 的 i386 通用二进制文件。

我似乎无法让 Xcode 进行编译,当我的目标是 10.4 时,它会说“没有这样的文件或目录”。

当我的目标是 10.6 x_64 时,它构建正常,但是 10.5 i386 抱怨我的 dylibs 不是 10.5 的正确架构?

我应该使用什么版本的 GCC?

另外,当我使用 PackageMaker 创建安装包时,安装程​​序应将工具所需的 dylib 放置在哪里?

预先非常感谢, 托比.

I'm building a C++ command line tool in Xcode. The project contains dylibs for curl, boost and log4cpp.

Ideally id like to build an i386 universal binary that supports 10.4 through to 10.6.

I cant seem to get Xcode to compile, when I target 10.4 it says things like no such file or directory.

When i target 10.6 x_64 it builds ok, but 10.5 i386 complains about my dylibs not being the correct architecture for 10.5?

What version of GCC should i be using?

Also, When i create an install package with PackageMaker, where should the installer place the dylibs that the tool requires?

Many thanks in advance,
Toby.

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

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

发布评论

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

评论(4

对不⑦ 2024-08-27 15:39:25

3rd 方库是为 10.6 x_64 构建的,我需要为 10.4 重建它们。

我通过下载 xcode 3.2 并在安装过程中选择“安装 10.4 支持”来安装 10.4u sdk。

在使用 GCC 4.0 针对 10.4u sdk 重建每个库后,我的项目编译成功。

我还使用了静态库,因此不需要将它们包含在安装程序中。

The 3rd party libraries were built for 10.6 x_64, I needed to rebuild them for 10.4.

I installed the 10.4u sdk by downloading xcode 3.2 and choosing 'install 10.4 support' during the installation process.

After rebuilding each library with GCC 4.0 against the 10.4u sdk, my project compiled successfully.

I also used static libraries so I don't need to include them in the installer.

伴我心暖 2024-08-27 15:39:25

您应该能够只选择 10.4 SDK 和 gcc 4.0 并构建一个可以在 10.4 以上版本上运行的可执行文件。

You should be able to just select the 10.4 SDK and gcc 4.0 and build one executable that will run on anything from 10.4 upwards.

无远思近则忧 2024-08-27 15:39:25

您的库可能仅针对 X86_64 构建。您需要将库重新编译为通用二进制文件。

编辑:使用10.4 SDK。

Your libraries are probably only built for X86_64. You need to recompile your libraries as universal binaries.

Edit: Using the 10.4 SDK.

滴情不沾 2024-08-27 15:39:25

在“项目”菜单中,选择“设置活动 SDK”,然后选择“Mac OS X 10.4”。

如果您使用该 SDK 时遇到链接错误,则您可能添加了不是为 10.4 构建的库。

请确保您使用的是 10.4 库,例如 libcurl 将在

/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/libcurl.dylib

You're likely linking with

/usr/lib/libcurl.dylib

which will be the version for your running OS 中找到。 (我假设是10.6)

In the Project menu, choose Set Active SDK, and pick Mac OS X 10.4 there.

If you get link errors using that SDK, you probably added libraries which were not build for 10.4

Make sure you're using the 10.4 libraries, e.g. libcurl would be found in

/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/libcurl.dylib

You're probably linking with

/usr/lib/libcurl.dylib

which would be the version for your running OS (I assume 10.6)

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