如何从Cygwin中的命令行安装Qt 5.2.1? $wget——安静http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-windows-x86-msvc2012_64_opengl-5.2.1.exe $

如何从Cygwin中的命令行安装Qt 5.2.1? $wget——安静http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-windows-x86-msvc2012_64_opengl-5.2.1.exe $,qt,command-line,installation,cygwin,Qt,Command Line,Installation,Cygwin,如上所述,我首先在Cygwin Bash shell中下载了Visual Studio的Qt包 一个SeNoTo:在CygWin中打包的Qt库对我来说不太有用,因为我需要使用VisualStudioC++编译器。 首先,我对文件设置了正确的权限 $chmod 755 qt-opensource-windows-x86-msvc2012\u 64\u opengl-5.2.1.exe 如果我这样开始的话 $。/qt-opensource-windows-x86-msvc2012\u 64\u o

如上所述,我首先在Cygwin Bash shell中下载了Visual Studio的Qt包

一个SeNoTo:在CygWin中打包的Qt库对我来说不太有用,因为我需要使用VisualStudioC++编译器。 首先,我对文件设置了正确的权限

$chmod 755 qt-opensource-windows-x86-msvc2012\u 64\u opengl-5.2.1.exe
如果我这样开始的话

$。/qt-opensource-windows-x86-msvc2012\u 64\u opengl-5.2.1.exe
显示了一个图形窗口(GUI),但这不是我想要的,因为我稍后希望将安装过程写入可以在Cygwin中运行的Bash脚本中

如果我添加选项
--help
,如下所示

$。/qt-opensource-windows-x86-msvc2012\u 64\u opengl-5.2.1.exe——帮助
将打开一个新的终端窗口,其中包含以下文本

用法:SDKMaintenanceTool[选项]
用户:
--帮助显示命令行用法
--版本显示当前版本
--checkupdates检查更新并返回一个描述
可用的更新
--更新程序以更新程序模式启动。
--管理包以packagemanager模式启动。
--代理在Win和Mac上设置系统代理。
此选项对Linux没有影响。
--在控制台上详细显示调试输出
--仅创建脱机存储库脱机安装程序:在
基于脱机目录的安装目录
安装程序的内容。
开发商:
--runoperation[操作][参数…]使用参数列表执行操作
--undooperation[操作][参数…]使用参数列表撤消操作
--脚本[scriptName]执行脚本
--无强制安装可取消强制组件的选择
--addRepository[URI]将本地或远程回购添加到用户定义的回购列表中。
--addTempRepository[URI]将本地或远程repo添加到临时可用资源列表中
回购协议
--setTempRepository[URI]将本地或远程repo设置为tmp repo,它是唯一的一个
在提取期间使用。
注意:URI必须以协议为前缀,即文件:///
http://或ftp://。它可以由多个
仅用逗号分隔的地址。
--显示虚拟组件在包管理器和更新程序中显示虚拟组件
--binarydatafile[二进制数据文件]使用其他安装程序或维护工具的二进制数据。
--更新installerbase[new_installerbase]使用新的安装程序库修补完整的安装程序
--转储二进制数据-i[PATH]-o[PATH]将二进制内容转储到指定的输出路径(脱机)
仅适用于安装程序)。
指向二进制数据文件的输入路径(如果省略)
当前应用程序用作输入。
我不知道如何从这里继续下去。您知道如何从Cygwin中的Bash shell安装Qt 5.2.1库(用于Visual Studio)吗


更新:为Cygwin环境编写构建脚本的优点是可以使用诸如gitwgetscp之类的命令。这描述了如何从Cygwin bash脚本调用MSVC编译器。请注意,我正在构建的Qt应用程序不会依赖于Cygwin。

我没有使用Cygwin进行测试,但我使用脚本成功安装了Qt5.5。为此,必须使用普通安装程序的
--script

.\qt-opensource-windows-x86-msvc2013_64-5.5.1.exe --script .\qt-installer-noninteractive.qs
下面是我在上面的命令中使用的
qt安装程序noninteractive.qs
文件的一个示例

function Controller() {
  installer.autoRejectMessageBoxes();
  installer.installationFinished.connect(function() {
    gui.clickButton(buttons.NextButton);
  })
}

Controller.prototype.WelcomePageCallback = function() {
  gui.clickButton(buttons.NextButton);
}

Controller.prototype.CredentialsPageCallback = function() {
  gui.clickButton(buttons.NextButton);
}

Controller.prototype.IntroductionPageCallback = function() {
  gui.clickButton(buttons.NextButton);
}

Controller.prototype.TargetDirectoryPageCallback = function() {
  gui.currentPageWidget().TargetDirectoryLineEdit.setText("C:/Qt/Qt5.5.1");
  gui.clickButton(buttons.NextButton);
}

Controller.prototype.ComponentSelectionPageCallback = function() {
  var widget = gui.currentPageWidget();

  widget.deselectAll();
  widget.selectComponent("qt.55.win64_msvc2013_64");
  // widget.selectComponent("qt.55.qt3d");
  // widget.selectComponent("qt.55.qtcanvas3d");
  // widget.selectComponent("qt.55.qtquick1");
  // widget.selectComponent("qt.55.qtscript");
  // widget.selectComponent("qt.55.qtwebengine");
  // widget.selectComponent("qt.55.qtquickcontrols");
  // widget.selectComponent("qt.55.qtlocation");

  gui.clickButton(buttons.NextButton);
}

Controller.prototype.LicenseAgreementPageCallback = function() {
  gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true);
  gui.clickButton(buttons.NextButton);
}

Controller.prototype.StartMenuDirectoryPageCallback = function() {
  gui.clickButton(buttons.NextButton);
}

Controller.prototype.ReadyForInstallationPageCallback = function()
{
  gui.clickButton(buttons.NextButton);
}

Controller.prototype.FinishedPageCallback = function() {
  var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm
  if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox) {
    checkBoxForm.launchQtCreatorCheckBox.checked = false;
  }
  gui.clickButton(buttons.FinishButton);
}
棘手的部分是找到组件的
id
!我能够找到正确的id
qt.55.win64\u msvc2013\u 64
,方法是添加标志
--verbose
,并使用UI正常安装它,并在最后一页停止;您为安装选择的所有
id
都在那里

如果您需要更多详细信息,本文将提供更多信息


编辑(29-11-2017):对于安装程序
3.0.2-online
,“欢迎”页面中的“下一步”按钮被禁用1秒,因此您必须添加延迟

gui.clickButton(buttons.NextButton, 3000);

编辑(10-11-2019):有关更多陷阱和陷阱,请参阅“用户数据收集”表单、“存档”和“最新版本”复选框。

为MSVC编译的二进制文件与为Cygwin构建的二进制文件不兼容。也许你可以解释一下你到底想做什么?你最好不要把cygwin和这个混为一谈。只要写一个bat文件(如果你想做的是可能的话)。我现在更新了这个问题。至于“社区”编辑,只是我忘了登录,也许现在已经解决了。我还没有证实这一点,但在一份声明中,我写了这样一句话:迟到了