在 OS X 上,$QTDIR 的正确设置是什么?

发布于 2024-09-12 18:34:53 字数 424 浏览 5 评论 0原文

我正在尝试安装 QtROOT,并作为安装的一部分(具体来说,QtROOT tarball 中的自述文件位于 http://root.bnl.gov/QtRoot/downloads/qtFullRoot.tar.gz),它提到要确保设置 QTDIR。我已经从 Mac OS X 的 Qt 4.6.3 SDK 安装中进行了安装,但没有设置这样的环境变量。我尝试通过谷歌搜索来找出应该设置的位置,但是我找到的选项(例如 /usr/local/qt)不存在。这个变量应该设置成什么?

OS X 10.6.4、Qt 4.6.3、ROOT 5.26/00、QtROOT...我不知道。 :P

谢谢,

保罗

I'm trying to install QtROOT, and as part of the installation (specifically, the readme file in the QtROOT tarball at http://root.bnl.gov/QtRoot/downloads/qtFullRoot.tar.gz), it mentions to make sure that QTDIR is set. I've installed from the Qt 4.6.3 SDK installation for Mac OS X, and I have no such environment variable set. I've tried googling to figure out where it should be set to, but the options I've found (such as /usr/local/qt) don't exist. What should this variable be set to?

OS X 10.6.4, Qt 4.6.3, ROOT 5.26/00, QtROOT... I have no idea. :P

Thanks,

Paul

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

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

发布评论

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

评论(3

黑白记忆 2024-09-19 18:34:53

Qt 的 OSX 打包安装程序将内容分散在 /Developer 和 /Library 目录中,而不是像您在其他基于 UNIX 的系统上所期望的那样安装到 /usr/local 或 /opt/local 中的独立位置。

顺便说一句,Qt 在这方面遵循 Apple 的行事方式,因此它确实没有错,只是不同,但它确实使某些 3rd 方 Qt 应用程序有些困难在 OSX 上构建。

打包的 Qt 安装程序本身对这个主题有以下说明:

成功安装后,您可以在/Developer中找到大多数新内容。具体来说,这些东西将位于以下位置:

  • Qt 设计师、Qt 语言学家:/Developer/Applications/Qt
  • Qt 文档:/Developer/Documentation/Qt
  • Qt 示例:/Developer/Examples/Qt
  • Qt 插件:/Developer/Applications/Qt/Plugins
  • Qt 框架:/Library/Frameworks
  • Qt 库:/usr/lib
  • qmake、moc、uic 等:/Developer/Tools/Qt(符号链接到 /usr/bin)
  • 卸载脚本:/Developer/Tools/uninstall-qt.py

,它确实将库放入“/usr/lib”中,并将基本的 Qt 工具(如 qmake)符号链接到“/usr/bin”中。这表明 QTDIR 可以设置为“/usr”。然而实际上,这不起作用,因为 qt 标头仍然隐藏在“/Library/Frameworks/Qt*/Headers/*.h”中,而依赖于 $QTDIR 的构建最终将在“$ {QTDIR}/include/" 代替。

解决这一切的最简单方法是从源代码构建 Qt。安装位置默认为 /usr/local/Trolltech/Qt-4.6.3 (记下版本号,并进行相应调整)。您可以使用 ./configure 上的 -prefix 选项覆盖默认安装位置。

一个更简单的方法是让 macports 为您构建它。这就是我最终采取的方法(并且取得了良好的成功)。如果您还没有安装 macports,只需安装它即可。然后:

> sudo port selfupdate
> sudo port install qt4-mac

Macports 将发挥其魔力,完成后 Qt 将完整安装在 /opt/local/libexec/qt4-mac 中。

无论您如何构建 Qt,完整的构建预计都需要几个小时。这是一个非常大的代码库。

Qt's packaged installer for OSX scatters things throughout the /Developer and /Library directories rather than installing to a self-contained location in /usr/local or /opt/local as you might expect it to do on other unix-based systems.

Incidentally, Qt follows Apple's way of doing things in this respect, so it's really not wrong -- it's just different -- but it does make some 3rd party Qt applications somewhat difficult to build on OSX.

The packaged Qt installer itself has the following to say on this topic:

After a successful install, you can find most new things in /Developer. Specifically things will be located in the following places:

  • Qt Designer, Qt Linguist: /Developer/Applications/Qt
  • Qt Documentation: /Developer/Documentation/Qt
  • Qt Examples: /Developer/Examples/Qt
  • Qt Plugins: /Developer/Applications/Qt/Plugins
  • Qt Frameworks: /Library/Frameworks
  • Qt Libraries: /usr/lib
  • qmake, moc, uic, etc.: /Developer/Tools/Qt (symlink to /usr/bin)
  • Uninstall script: /Developer/Tools/uninstall-qt.py

So, it does put the libs into '/usr/lib', and it symlinks the essential Qt tools (like qmake) into '/usr/bin'. This suggests that QTDIR could be set to '/usr'. In practice however, this doesn't work because the qt headers remain buried in '/Library/Frameworks/Qt*/Headers/*.h', while builds that rely on $QTDIR will end up looking for the qt headers in "${QTDIR}/include/" instead.

The easiest way around all this is to build Qt from source. The install location will default to something like /usr/local/Trolltech/Qt-4.6.3 (note the version number, and adjust accordingly). You can override the default install location by using the -prefix option on ./configure.

A simpler approach is to let macports build it for you. This is the approach I ended up taking (and with good success). Just install macports, if you don't already have it. Then:

> sudo port selfupdate
> sudo port install qt4-mac

Macports will work its magic, and when it's done Qt will be installed, in its entirety, at /opt/local/libexec/qt4-mac.

Regardless of how you build Qt, expect a full build to take several hours. It's a very large code base.

讽刺将军 2024-09-19 18:34:53

我没有从安装程序安装Qt(而是自己编译的),所以我不知道默认位置。

然而,在你安装 Qt 的地方,就有你的 QTDIR。
搜索 qmake,它应该位于某个 bin/ 文件夹中。其中之一是 QTDIR ($QTDIR/bin/qmake)。
现在通常不再需要设置 QTDIR 来构建 Qt 项目,只需 qmake 必须在 PATH 中,然后找到其他所有内容。但有些项目可能需要它(如果他们使用仍使用 QTDIR 的自定义构建系统)。

I didn't install Qt from the installer (but compiled it myself), so I don't know the default location.

However, where you installed Qt, there is your QTDIR.
Search for qmake, it should reside in some bin/ folder. one up is QTDIR ($QTDIR/bin/qmake).
Usually it's not necessary anymore to set QTDIR these days to build a Qt project, just qmake must be in the PATH, everything else found then. But some projects might require it though (if they use a custom build system that still uses QTDIR).

天涯沦落人 2024-09-19 18:34:53

我需要在我的 Mac 上安装 LiteIDE ,在安装指南中,QTDIR 是必需的。我通过brew install qt --build-from-source用自制程序安装qt,在RMBP中大约需要2个小时。安装完成后,仍然没有QTDIR路径。通过检查 build_osx.sh,我知道它只是 bin 的父文件夹。所以我通过export QTDIR=/usr/local/Cellar/qt/4.8.6设置路径。然后再次运行./build_osx.sh。有用。

希望这会有所帮助。

I need to install LiteIDE on my mac and in the install guide, the QTDIR is necessary. I install the qt with the homebrew by brew install qt --build-from-source, it takes about 2 hours in RMBP. After the install finished, there is still no QTDIR path. By checking the build_osx.sh, i know it's just the parent folder of bin. so i set the path by export QTDIR=/usr/local/Cellar/qt/4.8.6. Then run the ./build_osx.sh again. it works.

Hope this will be helpful.

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