在 OS X 上,$QTDIR 的正确设置是什么?
我正在尝试安装 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Qt 的 OSX 打包安装程序将内容分散在 /Developer 和 /Library 目录中,而不是像您在其他基于 UNIX 的系统上所期望的那样安装到 /usr/local 或 /opt/local 中的独立位置。
顺便说一句,Qt 在这方面遵循 Apple 的行事方式,因此它确实没有错,只是不同,但它确实使某些 3rd 方 Qt 应用程序有些困难在 OSX 上构建。
打包的 Qt 安装程序本身对这个主题有以下说明:
,它确实将库放入“/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,只需安装它即可。然后:
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:
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:
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.
我没有从安装程序安装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).
我需要在我的 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 thebuild_osx.sh
, i know it's just the parent folder of bin. so i set the path byexport QTDIR=/usr/local/Cellar/qt/4.8.6
. Then run the./build_osx.sh
again. it works.Hope this will be helpful.