在Mac上从源代码编译Qt Creator 4.7.0时找不到qbs.h

时间:2018-08-07 10:29:59

标签: macos qt qt-creator

我正在尝试从以下存储库的MacOS 10.13上的源代码编译Qt Creator: https://github.com/qt-creator/qt-creator

我按照README.md中的说明进行操作,但没有成功。 我很可能错过了一些东西。

我已经完成的步骤:

  • 安装了最新的Xcode
  • 使用brew install --with-toolchain llvm
  • 安装了LLVM
  • 使用brew install qbs安装了QBS (也将qt 5.11.1酿造为/usr/local/opt/qt的依赖项)
  • 安装了带有QtWebEngine的预编译Qt 5.11.1(无源)
  • 将Qt Creator存储库克隆到/Users/username/builds/qtcreator_src
  • 为源外版本创建的目录:/Users/username/builds/qtc_build

在该目录中运行以下命令:

export LLVM_INSTALL_DIR=/usr/local/opt/llvm
export QBS_INSTALL_DIR=/usr/local/opt/qbs

PATH=/usr/local/opt/qt/bin:/usr/local/opt/llvm/bin:$PATH

qmake -r /Users/username/builds/qtcreator_src/4.7 
    make

大约40分钟的编译后,出现以下错误:

../../../../qtcreator_src/4.7/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp:29:10: fatal error: 'qbs.h' file not found
#include <qbs.h>

(我检查了文件位于/usr/local/opt/qbs/include/qbs目录中。)

还有一个问题。如果我使用make -j8,则可以加快构建过程,但是 我最终遇到以下晦涩的错误:

mv -f libDebugger.dylib ../../../bin/Qt\ Creator.app/Contents/PlugIns/ 
make[1]: *** [sub-plugins-make_first-ordered] Error 2

我在上面的控制台输出中找不到其他错误消息,也找不到 任何error.log个文件。

P.S。这是来自github README.md的原始构建说明:

# Optional, needed for the Clang Code Model if llvm-config is not in PATH:
export LLVM_INSTALL_DIR=/path/to/llvm (or "set" on Windows)
# Optional, needed to let the QbsProjectManager plugin use system Qbs:
export QBS_INSTALL_DIR=/path/to/qbs
# Optional, needed for the Python enabled dumper on Windows
set PYTHON_INSTALL_DIR=C:\path\to\python

cd $SOURCE_DIRECTORY
qmake -r
make (or mingw32-make or nmake or jom, depending on your platform)

不需要安装(“进行安装”)。但是,可以使用

make install INSTALL_ROOT=$INSTALL_DIRECTORY

更新2:  从PATH排除Qt后,我收到另一个错误:

In file included from ../../../../qtcreator_src/4.7/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp:29:
/usr/local/Cellar/qbs/1.12.0/include/qbs/qbs.h:63:10: fatal error: 
      'tools/settingsrepresentation.h' file not found
#include "tools/settingsrepresentation.h"

更新3:我设法使用从构建目录发出的以下命令来构建Qt Creator:

export LLVM_INSTALL_DIR=/usr/local/opt/llvm
/usr/local/opt/qt/bin/qmake /Users/username/builds/qtcreator_src/4.7
make

但是,即使构建过程已完成且没有错误,该应用程序仍未运行:

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       EXC_I386_GPFLT
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libBookmarks.dylib              0x0000000115166cb0 Bookmarks::Internal::BookmarksPlugin::~BookmarksPlugin() + 32
1   libExtensionSystem.4.7.0.dylib  0x000000010b58b3eb ExtensionSystem::Internal::PluginSpecPrivate::kill() + 27
2   libExtensionSystem.4.7.0.dylib  0x000000010b576778 ExtensionSystem::Internal::PluginManagerPrivate::loadPlugins() + 888
3   org.qt-project.qtcreator        0x000000010b558159 main + 13353
4   libdyld.dylib                   0x00007fff7e352115 start + 1

1 个答案:

答案 0 :(得分:1)

Qt肯定不应该走这条路,它是多余的。您可以同时存在多个Qt版本,可以通过调用各自的qmake来选择它们。 LLVM是否应该-不确定。 qmake的-r选项用于项目模式,不需要。

cd build_dir
/qt/bin/qmake /path/to/sources
make

使用qbs的全部目的是仅用qbs代替qmake + make。首先,告诉qbs您要使用的Qt版本(只需执行一次):

qbs setup-qt /qt/bin/qmake myqt
qbs config defaultProfile myqt

当然myqt可以是您想要的任何形式。

然后创建创建者:

cd build_dir
qbs -f /path/to/sources
相关问题