Skip to content

Commit 5ecf1d0

Browse files
committed
reproduce bug qt6...metatypes.json: illegal value (windows nmake)
1 parent 45cc940 commit 5ecf1d0

File tree

10 files changed

+239
-0
lines changed

10 files changed

+239
-0
lines changed

.github/workflows/json_bug_repro.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: json_bug_repro
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: windows-2019
9+
10+
steps:
11+
- uses: actions/checkout@v1
12+
13+
- name: nmake_build
14+
shell: cmd
15+
run: |
16+
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
17+
"C:\Program Files\Git\bin\bash.exe" ./json_bug_repro/ci/win_ci.sh

json_bug_repro/CMakeLists.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
3+
project(Reproducejsonbug VERSION 0.1 LANGUAGES CXX)
4+
5+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6+
7+
find_package(Qt6 REQUIRED COMPONENTS Quick Bluetooth)
8+
9+
qt_standard_project_setup(REQUIRES 6.5)
10+
11+
12+
qt_add_executable(appReproducejsonbug
13+
main.cpp
14+
)
15+
16+
qt_add_qml_module(appReproducejsonbug
17+
URI Reproducejsonbug
18+
VERSION 1.0
19+
QML_FILES qml/Main.qml
20+
)
21+
22+
set_target_properties(appReproducejsonbug PROPERTIES
23+
WIN32_EXECUTABLE TRUE
24+
)
25+
26+
target_link_libraries(appReproducejsonbug
27+
PRIVATE Qt6::Quick
28+
)

json_bug_repro/ci/qtapps/ci.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
set -Eeuxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
4+
IFS=$'\n\t'
5+
6+
THISDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
7+
8+
source ${THISDIR}/utils.bash # will compute UTILS_WE_ARE_RUNNING_IN_CI
9+
10+
if [[ -n ${UTILS_WE_ARE_RUNNING_IN_CI-} ]];
11+
# The '-' hyphen above tests without angering the 'set -u' about unbound variables
12+
then
13+
echo "C.I. environment was detected."
14+
15+
# Try various ways to print OS version info.
16+
# This lets us keep a record of this in our CI logs,
17+
# in case the CI docker images change.
18+
uname -a || true
19+
lsb_release -a || true
20+
gcc --version || true # oddly, gcc often prints great OS information
21+
cat /etc/issue || true
22+
23+
# What environment variables did the C.I. system set? Print them:
24+
env
25+
26+
if [[ "$OSTYPE" != "cygwin" && "$OSTYPE" != "msys" ]]; then
27+
${THISDIR}/../verify_authors.sh
28+
29+
${THISDIR}/linux_apt_get_qt_deps.sh
30+
${THISDIR}/get_qt_libs.sh
31+
elif [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]]; then
32+
${THISDIR}/provision_win.sh
33+
fi
34+
35+
else
36+
echo "Assuming we are NOT in cloud C.I. environment."
37+
fi
38+
39+
40+
THIS_FILENAME=$(basename "$0")
41+
echo 'We assume this was run with '\''set -e'\'' (look at upper lines of this script).'
42+
echo 'Assuming so, then getting here means:'
43+
echo "${THIS_FILENAME} SUCCESS"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
set -Eeuxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
4+
5+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
6+
source "${DIR}/rootdirhelper.bash"
7+
8+
DL_FOLDER=$CUR_GUICODE_ROOT/dl_third_party
9+
if [[ -n ${MYAPP_TEMPLATE_DL_FOLDER_OVERRIDE-} ]]; then
10+
DL_FOLDER=${MYAPP_TEMPLATE_DL_FOLDER_OVERRIDE}
11+
fi
12+
13+
pip3 install -r ${DIR}/requirements.txt # https://github.com/miurahr/aqtinstall
14+
15+
python3 -m aqt install-qt --outputdir $DL_FOLDER/Qt_desktop \
16+
windows desktop 6.5.3 win64_msvc2019_64 \
17+
--modules \
18+
qtconnectivity \
19+
qtimageformats \
20+
qt5compat
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aqtinstall==3.1.12
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
if [ "${BASH_SOURCE[0]}" -ef "$0" ]
4+
then
5+
echo "Hey, you should source this script, not execute it!"
6+
exit 1
7+
fi
8+
9+
NESTED_GUI_ROOT="" # Populate this if you move the qt-qml-project beneath git root
10+
CUR_GIT_ROOT=$(git rev-parse --show-toplevel)
11+
12+
export CUR_GUICODE_ROOT="${CUR_GIT_ROOT}/${NESTED_GUI_ROOT}/"
13+
14+
DL_FOLDER=$CUR_GUICODE_ROOT/dl_third_party
15+
if [[ -n ${MYAPP_TEMPLATE_DL_FOLDER_OVERRIDE-} ]]; then
16+
DL_FOLDER=${MYAPP_TEMPLATE_DL_FOLDER_OVERRIDE}
17+
fi

json_bug_repro/ci/qtapps/utils.bash

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
if [ "${BASH_SOURCE[0]}" -ef "$0" ]
4+
then
5+
echo "Hey, you should source this script, not execute it!"
6+
exit 1
7+
fi
8+
9+
if [[ -n ${TERM-} && ${TERM-} != "dumb" && ${TERM-} != "emacs" ]]; then
10+
# https://stackoverflow.com/a/20983251/10278
11+
u_red=`tput setaf 1`
12+
u_green=`tput setaf 2`
13+
u_resetcolor=`tput sgr0` # keep reset LAST. The above do change the output.
14+
else
15+
u_red=''
16+
u_green=''
17+
u_resetcolor=''
18+
fi
19+
20+
# https://web.archive.org/web/20191121235402/https://confluence.atlassian.com/bitbucket/variables-in-pipelines-794502608.html
21+
if [[ -n ${GITHUB_ACTIONS-} || -n ${BITBUCKET_REPO_OWNER-} || -n ${BITBUCKET_REPO_FULL_NAME-} ]];
22+
# The '-' hyphens above test without angering the 'set -u' about unbound variables
23+
then
24+
export UTILS_WE_ARE_RUNNING_IN_CI=1
25+
echo "Assuming C.I. environment."
26+
echo "Found at least one of GITHUB_ACTIONS, BITBUCKET_REPO_OWNER, BITBUCKET_REPO_FULL_NAME in env."
27+
fi

json_bug_repro/ci/win_ci.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
3+
set -Eeuo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
4+
IFS=$'\n\t'
5+
6+
THISDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
7+
CUR_GIT_ROOT=$(git rev-parse --show-toplevel)
8+
9+
if [[ "$OSTYPE" != "cygwin" && "$OSTYPE" != "msys" ]]; then
10+
echo "This script is for use on Microsoft Windows"
11+
exit 1
12+
fi
13+
14+
if [[ -z ${VCToolsInstallDir-} ]]; then
15+
echo "WHOOPS. vcvars64 (or vcvarsall) was not called yet."
16+
echo "You MUST start a VISUAL STUDIO command prompt. (Then start git-bash from within it.)"
17+
echo "Read the above and try again."
18+
exit 1
19+
fi
20+
21+
22+
"${THISDIR}"/qtapps/ci.sh
23+
24+
source "${THISDIR}"/qtapps/rootdirhelper.bash
25+
26+
MSVCPATHFORBUILDING=$(cygpath -u "${VCToolsInstallDir}/bin/HOSTx64/x64")
27+
export PATH="${MSVCPATHFORBUILDING}:$PATH" # make sure MSVC link.exe is found (not bash/unix 'link' tool)
28+
29+
WINDLPATH=$(cygpath -u $DL_FOLDER)
30+
31+
# Variables used by CMakeLists
32+
export Qt6_DIR="${WINDLPATH}/Qt_desktop/6.5.3/msvc2019_64/lib/cmake/Qt6/"
33+
34+
# Put qmake on the PATH:
35+
export PATH="${WINDLPATH}/Qt_desktop/6.5.3/msvc2019_64/bin:$PATH"
36+
37+
38+
39+
mkdir -p cbuild
40+
pushd cbuild
41+
42+
cmake "-G" "NMake Makefiles" -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON $THISDIR/..
43+
44+
# See: https://forum.qt.io/topic/146961/building-qt6-5-with-nmake-error
45+
# Workaround for bug in Qt6CoreMacros.cmake:
46+
#buggy_genfile=meta_types/qt6appreproducejsonbug_debug_metatypes.json
47+
#if [ ! -s "$buggy_genfile" ]; then
48+
# echo "{}" >> "$buggy_genfile"
49+
#fi
50+
51+
nmake
52+
53+
54+
popd # pushd cbuild
55+
56+
57+
58+
THIS_FILENAME=$(basename "$0")
59+
echo 'We assume this was run with '\''set -e'\'' (look at upper lines of this script).'
60+
echo 'Assuming so, then getting here means:'
61+
echo "${THIS_FILENAME} SUCCESS"

json_bug_repro/main.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <QGuiApplication>
2+
#include <QQmlApplicationEngine>
3+
#include <QQuickView>
4+
#include <QQmlContext>
5+
#include <QQmlEngine>
6+
7+
#include <QObject>
8+
9+
10+
int main(int argc, char *argv[])
11+
{
12+
QGuiApplication app(argc, argv);
13+
14+
QQmlApplicationEngine engine;
15+
engine.loadFromModule("Reproducejsonbug", "Main");
16+
17+
app.exec();
18+
}

json_bug_repro/qml/Main.qml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import QtQuick
2+
3+
Window {
4+
width: 1200
5+
height: 600
6+
visible: true
7+
}

0 commit comments

Comments
 (0)