如何从源代码构建qt

发布于 2024-08-02 02:37:58 字数 980 浏览 4 评论 0原文

在过去的几天里,我通过 Qt 论坛和 Google 进行了大量搜索,但找不到这个问题的任何明显答案。

我发现可以提供 -prefix 选项(甚至在 Windows 上没有记录)来配置以指定不同的安装目录,但这根本无法清楚地分离源代码和二进制文件,因为构建是仍然在源目录中完成,然后将安装所需的文件复制到安装目录中。 我尝试了这个 -prefix 选项,但遇到了一些问题。 (即它不会将 .pdb 文件复制到安装目录。)

然后我发现 此链接 关于进行影子构建,但它有一个很大的限制,即构建目录必须与源目录处于同一级别。


我猜你没有尝试过 安装? 所以试试吧。 它应该 将 Qt 安装到单独的目录 远离源头。

你是说在我配置之后,我应该做 nmake install 而不是仅仅 nmake ? 我知道 nmake 将处理从 qmake 生成的 makefile 并将它们放置在源 Qt 目录中,但是 nmake install 到底会做什么,即在哪个目录中安装文件以及如何指定将安装文件的目录。

请注意,我已经这样做了:

configure -prefix builddir -platform win32-msvc2005
nmake install

上面两行的效果是 qt 是在源目录中编译的,而不是直接编译到使用前缀指定的 builddir 中。 然后编译后的文件被复制到我的builddir中。 我希望能够将我的 Qt 文件直接构建到构建目录,因为这样在编译期间我仍然需要 4 GB 空间用于我的源目录。 此外,pdb 文件没有复制到我的 buildir,这是另一个问题。

I was searching a lot through Qt forums and Google for the last few days, but I could not find any obvious answer to this question.

I found the -prefix option (not even documented on Windows) that can be supplied to configure to specify different install directory, but this is not clear separation of the sources and binaries at all, since the build is still done in the source directory and then the files needed for installation are copied to the install directoy. I tried this -prefix option, and came to some problems. (i.e It doesn't copy the .pdb files to the install directory.)

Then I found this link about doing shadow builds but it has the big limitation that the build dir must be at the same level as the source dir.


I'm guessing you didn't try make
install? So try that. It should
install Qt to a separate directory
away from the sources.

Are you saying that after I do configure, I should do nmake install instead just nmake? I know that nmake will process the generated makefiles from qmake and will place them in the source Qt dir, but what nmake install will exactly do i.e in which directory will install the files and how to specify the directory where the files will be installed.

Note that I already do this:

configure -prefix builddir -platform win32-msvc2005
nmake install

The effect of the above two lines was that qt was compiled in the source dir and not directly to my builddir specified with prefix. Then the compiled files were copied in my builddir. I was hoping for something that will build my Qt files directly to the build dir, cause this way I stil need 4 Gb space for my source dir during the compilation. Also the pdb files were not copied to my buildir which is another issue.

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

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

发布评论

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

评论(4

醉生梦死 2024-08-09 02:37:58

基本上,您只需从构建目录运行configure.exe。 例如:

mkdir \qt\4.5.2-build
cd \qt\4.5.2-build
set PATH=%cd%\bin;%PATH%
\qt\4.5.2-sources\configure.exe -platform win32-msvc2005

如果源位于 \qt\4.5.2-sources 中,这将导致构建进入当前驱动器上的 \qt\4.5.2-build

另外,您的 PATH 中必须有 perl,建议使用 ActiveState Perl。

我以前没有听说过这种限制,即构建目录和源目录必须位于同一级别。 如果您遇到此问题,您可以尝试通过创建符号链接来解决它(请参阅mklink命令)。

Basically, you just have to run configure.exe from your build directory. For example:

mkdir \qt\4.5.2-build
cd \qt\4.5.2-build
set PATH=%cd%\bin;%PATH%
\qt\4.5.2-sources\configure.exe -platform win32-msvc2005

Where sources are in \qt\4.5.2-sources, that would cause the build to go into \qt\4.5.2-build on the current drive.

Also, you must have perl in your PATH, ActiveState Perl is suggested.

I had not previously heard of this limitation where the build and source directories must be at the same level. If you hit this problem you could try working around it by creating a symbolic link (see mklink command).

z祗昰~ 2024-08-09 02:37:58

Windows 上的 IIRC,您必须执行沙箱安装,无法执行 UNIX 典型的“make install”。

通常有两个选项用于构建 Qt,-prefix-install 和 -prefix /foo

你选择一个,所以如果 -prefix 不允许你输入 make install,那么我想在 Windows 上你必须使用 -prefix-install Route,这是一个沙盒安装到您将 Qt 解压到的目录。

我猜你没有尝试过 make install 吗? 所以试试吧。 它应该将 Qt 安装到远离源代码的单独目录中。

IIRC on Windows, you have to do a sandbox install, you can't do the UNIX-typical "make install".

There are two options usually for building Qt, -prefix-install and -prefix /foo

You pick one, so if -prefix doesn't allow you to type make install, then I guess on Windows you have to use the -prefix-install route, which is a sandboxed install to the directory you extract Qt to.

I'm guessing you didn't try make install? So try that. It should install Qt to a separate directory away from the sources.

你丑哭了我 2024-08-09 02:37:58

至少可以通过临时将 \qt\4.5.2-sources\include\Qt 添加到包含路径来解决缺少包含文件(例如 qscriptengine.h)的问题。

At least the problem with the missing include files (e.g. qscriptengine.h) may by solved by temporary adding \qt\4.5.2-sources\include\Qt to the include path.

╭ゆ眷念 2024-08-09 02:37:58

我将影子构建从我的主文件夹移至 C: 中的文件夹中,并且它有效。 我知道这很奇怪,但事情就是这样发生的。 我怀疑这一定是syncqt中的一个错误。

I moved the shadow build out of my home folder to a folder in C: and it worked. I know it's weird, but that's what happened. I suspect it must be a bug in syncqt.

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