在 Mac OS X 上使用 Qwt

发布于 2024-08-15 23:02:40 字数 473 浏览 7 评论 0原文

如何使用 Qwt 在 Mac OS X 上?

我总是收到一条错误消息,告诉我找不到 libqwt.dylib。根据我从谷歌搜索中了解到的情况,在 environment.plist 中设置 DYLD_LIBRARY_PATH 没有帮助,因为苹果出于安全原因已禁用它,所以我该怎么办它(无需在每次重新编译时手动将库复制到我的 .app 中)?

我已经尝试了 qmake -spec macx-g++qmake ,没有任何规范。该库目前位于 /usr/local/qwt/lib 中。我应该手动将其移动到某个系统路径还是有更好的方法(通过使用 otool 和 install_name_tool 魔法)?

How can I compile and run Qt programs using Qwt on Mac OS X?

I always get an error telling me that it can't find libqwt.dylib. For what I have understood from my googling it won't help to set DYLD_LIBRARY_PATH in environment.plist since Apple has disabled that due to security reasons so how am I supposed to do it (without manually copying the lib to my .app for every recompile)?

I have tried both qmake -spec macx-g++ and qmake without any spec. The lib is in /usr/local/qwt/lib at the moment. Should I move it to some system path manually or is there a better way to do it (by using otool and install_name_tool magics)?

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

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

发布评论

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

评论(1

话少情深 2024-08-22 23:02:40

我认为编辑environment.plist或以任何其他方式更改您的配置文件设置以添加此类“非标准”路径是个坏主意。

我假设您的项目 *.pro 文件中有类似的内容:

INCLUDEPATH += /usr/local/qwt-5.2.0/include

LIBS += -L/usr/local/qwt-5.2.0/lib \
    -lqwt

或者您尝试运行其中包含所有这些附加路径的示例之一:

include( ../examples.pri )

无论如何,您在程序启动时收到此消息:

dyld: Library not loaded: libqwt.5.dylib
Referenced from: /Users/kemiisto/Downloads/qwt-5.2.0/examples/histogram/histogram.app/Contents/MacOS/histogram
Reason: image not found
The program has unexpectedly finished.

好吧,您可以使用解决方案来自博客文章。我已经用 Qt 4.6 和 Qwt 5.2 对其进行了测试。有用。

在 qwt 源代码分发目录中运行 qmake -spec macx-g++ 后(您已完成),编辑 src/Makefile。找到字符串

-install_name libqwt.5.dylib

并使其看起来像这样(更改为完整路径)

-install_name /usr/local/qwt-5.2.0/lib/libqwt.dylib

现在(重新)构建 Qwt(make clean && make)并重新安装它(sudo make install)。

I think it's bad idea to edit environment.plist or in any other way to change your profile settings to add such "non-standard" path to it.

I assumed you have something like this in you project *.pro file:

INCLUDEPATH += /usr/local/qwt-5.2.0/include

LIBS += -L/usr/local/qwt-5.2.0/lib \
    -lqwt

Or you try to run one of samples where all this additional path are included by:

include( ../examples.pri )

Anyway you get this message at program start:

dyld: Library not loaded: libqwt.5.dylib
Referenced from: /Users/kemiisto/Downloads/qwt-5.2.0/examples/histogram/histogram.app/Contents/MacOS/histogram
Reason: image not found
The program has unexpectedly finished.

Well, you can use solution from this blog post. I have tested it with Qt 4.6 and Qwt 5.2. It works.

After running qmake -spec macx-g++ in qwt sources distribution directory (already done by you), edit src/Makefile. Find the string with

-install_name libqwt.5.dylib

and make it looks like this (change to full path)

-install_name /usr/local/qwt-5.2.0/lib/libqwt.dylib

Now (re)build Qwt (make clean && make) and reinstall it (sudo make install).

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