Browse Source

Refresh compiler runtime DLLs before Windows ChatGUI builds

master
evgeny 6 days ago
parent
commit
05064f7f3d
  1. 8
      build.sh
  2. 6
      check_cc.sh
  3. 15
      doc/tasks.md
  4. 18
      tools/chatgui/build.sh
  5. 43
      tools/chatgui/compiler_runtime.sh

8
build.sh

@ -200,7 +200,13 @@ if [ $BUILD_SUCCESS -eq 1 ]; then
echo "======================================"
echo "Rebuilding chatgui (CMake)"
echo "======================================"
(cd tools/chatgui/build && cmake --build . -j4 2>&1) || echo "WARNING: chatgui build failed"
(
if [ "${MSYSTEM:-}" = UCRT64 ]; then
source tools/chatgui/compiler_runtime.sh
chatgui_refresh_compiler_runtime tools/chatgui/build /ucrt64/bin || exit 1
fi
cd tools/chatgui/build && cmake --build . -j4 2>&1
) || echo "WARNING: chatgui build failed"
fi
else
echo ""

6
check_cc.sh

@ -115,7 +115,7 @@ if [ "${MSYSTEM:-}" = UCRT64 ]; then
probe_cc1_script=$(cygpath -w "$probe_dir/cc1.cmd") || { printf '[ERROR] Cannot resolve the cc1 script path.\n'; exit 1; }
for probe_cwd in "$probe_root" "$probe_build"; do
cd -- "$probe_cwd" || { printf '[ERROR] Cannot open probe directory: %s\n' "$probe_cwd"; exit 1; }
MSYS2_ARG_CONV_EXCL='*' probe_step 'Launch cc1 directly' "$probe_cmd" /d /c call "$probe_cc1_script"
MSYS2_ARG_CONV_EXCL='*' probe_step 'Launch cc1 before runtime refresh' "$probe_cmd" /d /c call "$probe_cc1_script"
# При ошибке продолжаем сравнение каталогов и DLL, затем повторяем исходный сбой.
done
cd -- "$probe_root" || { printf '[ERROR] Cannot open the repository directory.\n'; exit 1; }
@ -125,8 +125,10 @@ if [ "${MSYSTEM:-}" = UCRT64 ]; then
}
printf '\n[INFO] cc1 DLL imports:\n'
sed -n '/DLL Name:/p' "$probe_dir/cc1-imports.txt" || { printf '[ERROR] Cannot read cc1 imports.\n'; exit 1; }
source "$probe_root/tools/chatgui/compiler_runtime.sh"
for probe_dll in "$probe_build/"*.dll; do
[ -f "$probe_dll" ] || continue
chatgui_is_compiler_runtime_dll "${probe_dll##*/}" || continue
probe_system_dll="${probe_cc%/*}/${probe_dll##*/}"
[ -f "$probe_system_dll" ] || continue
cmp -s "$probe_dll" "$probe_system_dll"
@ -138,7 +140,9 @@ if [ "${MSYSTEM:-}" = UCRT64 ]; then
*) printf '[ERROR] Cannot compare DLL: %s, exit code: %d\n' "$probe_dll" "$probe_result"; exit "$probe_result" ;;
esac
done
probe_step 'Refresh compiler runtime DLLs' chatgui_refresh_compiler_runtime "$probe_build" "${probe_cc%/*}" || exit $?
cd -- "$probe_build" || { printf '[ERROR] Cannot open the ChatGUI build directory.\n'; exit 1; }
MSYS2_ARG_CONV_EXCL='*' probe_step 'Launch cc1 after runtime refresh' "$probe_cmd" /d /c call "$probe_cc1_script" || exit $?
MSYS2_ARG_CONV_EXCL='*' probe_step 'Replay Ninja bands.c command with GCC verbose output' \
"$probe_cmd" /d /c call "$probe_replay" || exit $?
fi

15
doc/tasks.md

@ -3,6 +3,21 @@
Сюда пишется список задач с короткой аннотацией. Если задача большая и имеет ТЗ - то ТЗ оформляется отдельным файлом, а сюда помещается аннотация и ссылка на ТЗ.
## Текущая задача
[ ] **ChatGUI Windows: подтверждение обновления runtime компилятора** — 05.10.2026:
`cc-probe.log`: cc1 запускается из корня, но в `tools/chatgui/build` завершается
с `0xC0000139`; локальные DLL GCC/math/runtime отличаются от UCRT64.
Перед обеими точками сборки добавлено обновление существующих копий этих DLL;
раскладка FFmpeg использует для них UCRT64. Проверены обновление, повторный вызов,
сохранение кодеков и ошибки. Требуется Windows-прогон `check_cc.bat`: cc1 после
обновления, повтор команды Ninja и сборка Opus должны завершиться с кодом 0.
[ ] **ChatGUI Windows: обновление остальных DLL приложения после обновления MSYS2** — 05.10.2026:
в `cc-probe.log` также отличаются Qt и другие DLL. `tools/chatgui/build.sh`
пропускает раскладку при наличии основного комплекта, без сравнения версий;
рекурсивная раскладка копирует только отсутствующие зависимости.
Runtime GCC обновляется отдельно; для остальных DLL нужно продумать обновление
с сохранением приоритета собственной сборки FFmpeg и проверить запуск приложения.
[+] **Открытие HTTP/HTTPS в сообщениях Android и Qt** — 04.10.2026:
общая обработка ссылок по диапазонам текста; веб-адреса открываются системным
обработчиком, `utun://` сохраняет JOIN и короткое отображение PM-приглашений.

18
tools/chatgui/build.sh

@ -26,6 +26,12 @@ if [ -f "$BUILD_DIR/CMakeCache.txt" ]; then
fi
fi
# Старые DLL приложения в build могут мешать запуску cc1/cc1plus после обновления MSYS2.
source "$SRC_DIR/compiler_runtime.sh"
if [ "${MSYSTEM:-}" = UCRT64 ]; then
chatgui_refresh_compiler_runtime "$BUILD_DIR" /ucrt64/bin 2>&1 | tee -a "$LOG_FILE"
fi
log "[1/4] Configuring CMake (generator: Ninja)..."
cmake -S "$SRC_DIR" -B "$BUILD_DIR" -G Ninja 2>&1 | tee -a "$LOG_FILE"
test ${PIPESTATUS[0]} -eq 0 || { log "CMake configure FAILED"; exit 1; }
@ -79,8 +85,12 @@ else
shopt -s nocasematch nullglob
# Обновляем весь комплект FFmpeg, включая DLL, не импортируемые напрямую приложением.
for src in "$FFMPEG_BIN/"*.dll; do
# Общий runtime берём из установленного UCRT64, а кодеки — из собственной сборки FFmpeg.
if chatgui_is_compiler_runtime_dll "${src##*/}"; then
src="/ucrt64/bin/${src##*/}"
fi
cp "$src" "$BUILD_DIR/" || { log " ERROR: failed to copy $src"; exit 1; }
log " OK: $(basename "$src") (ffmpeg)"
log " OK: $(basename "$src") (from $src)"
done
log " Resolving non-Qt dependencies recursively..."
# Проверяем также уже скопированные DLL: наличие файла не гарантирует наличие его зависимостей.
@ -128,7 +138,11 @@ else
esac
if [ ! -f "$BUILD_DIR/$dep" ]; then
dep_src=""
for dir in "$FFMPEG_BIN" /ucrt64/bin "$SRC_DIR/rlottie_build"; do
dep_dirs=("$FFMPEG_BIN" /ucrt64/bin "$SRC_DIR/rlottie_build")
if chatgui_is_compiler_runtime_dll "$dep"; then
dep_dirs=(/ucrt64/bin)
fi
for dir in "${dep_dirs[@]}"; do
if [ -f "$dir/$dep" ]; then
dep_src="$dir/$dep"
break

43
tools/chatgui/compiler_runtime.sh

@ -0,0 +1,43 @@
#!/bin/bash
# Общие DLL GCC и его внутренних компиляторов должны соответствовать установленному UCRT64.
chatgui_is_compiler_runtime_dll() {
case "${1,,}" in
libgcc_s_*.dll|libstdc++-6.dll|libwinpthread-1.dll|libgmp-*.dll|libisl-*.dll|libmpc-*.dll|libmpfr-*.dll|zlib1.dll|libzstd.dll)
return 0 ;;
*) return 1 ;;
esac
}
# Обновляем уже разложенные DLL до запуска CMake: Windows ищет их в рабочем каталоге cc1.
chatgui_refresh_compiler_runtime() {
local runtime_build="$1" runtime_bin="$2" runtime_dst runtime_name runtime_src runtime_rc
local runtime_updated=0 runtime_current=0
for runtime_dst in "$runtime_build/"*.dll; do
[ -f "$runtime_dst" ] || continue
runtime_name="${runtime_dst##*/}"
chatgui_is_compiler_runtime_dll "$runtime_name" || continue
runtime_src="$runtime_bin/$runtime_name"
if [ ! -f "$runtime_src" ]; then
printf '[ERROR] Compiler runtime source missing: %s (local copy: %s)\n' "$runtime_src" "$runtime_dst"
return 1
fi
if cmp -s "$runtime_src" "$runtime_dst"; then
runtime_current=$((runtime_current + 1))
continue
else
runtime_rc=$?
if [ "$runtime_rc" -ne 1 ]; then
printf '[ERROR] Cannot compare compiler runtime DLL: %s, exit code: %d\n' "$runtime_dst" "$runtime_rc"
return "$runtime_rc"
fi
fi
cp "$runtime_src" "$runtime_dst" || {
printf '[ERROR] Cannot refresh compiler runtime DLL: %s -> %s\n' "$runtime_src" "$runtime_dst"
return 1
}
printf '[INFO] Refreshed compiler runtime DLL: %s -> %s\n' "$runtime_src" "$runtime_dst"
runtime_updated=$((runtime_updated + 1))
done
printf '[INFO] Compiler runtime DLLs: updated=%d current=%d\n' "$runtime_updated" "$runtime_current"
}
Loading…
Cancel
Save