|
| 1 | +name: Diagnose julia.exe sysimage bootstrap on real Windows |
| 2 | + |
| 3 | +# A from-source (USE_BINARYBUILDER=0) cross-build of Julia 1.12.6 in the |
| 4 | +# MXE dockcross image links libjulia.dll + libjulia-codegen.dll + julia.exe |
| 5 | +# successfully, but the sysimage bootstrap step requires running julia.exe |
| 6 | +# on the build host. Under wine inside the container, that exits silently |
| 7 | +# with rc=1 and no diagnostic output. This workflow runs the same step on |
| 8 | +# a real Windows runner so we can see what actually happens. |
| 9 | + |
| 10 | +on: |
| 11 | + workflow_dispatch: |
| 12 | + inputs: |
| 13 | + julia_tarball_url: |
| 14 | + description: 'URL of the patched Julia 1.12.6 source tarball' |
| 15 | + required: true |
| 16 | + default: 'https://github.com/casadi/debug/releases/download/julia-1.12.6-mxe-bootstrap/julia-1.12.6-mxe-patched.tar.gz' |
| 17 | + |
| 18 | +jobs: |
| 19 | + |
| 20 | + build-linux: |
| 21 | + runs-on: ubuntu-22.04 |
| 22 | + timeout-minutes: 180 |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Show disk before |
| 27 | + run: df -h / |
| 28 | + |
| 29 | + - name: Download patched Julia source tarball |
| 30 | + run: | |
| 31 | + curl -fsSL -o julia-src.tar.gz "${{ github.event.inputs.julia_tarball_url }}" |
| 32 | + ls -lh julia-src.tar.gz |
| 33 | + tar -xzf julia-src.tar.gz |
| 34 | + ls julia-1.12.6/Make.user |
| 35 | +
|
| 36 | + - name: Build extended dockcross image (cmake 3.29 + shims) |
| 37 | + run: | |
| 38 | + docker build -t julia-winbuild:latest julia-build |
| 39 | +
|
| 40 | + - name: Run the cross-build inside the container (link target only) |
| 41 | + run: | |
| 42 | + docker run --rm \ |
| 43 | + -u "$(id -u):$(id -g)" \ |
| 44 | + -v "$PWD/julia-1.12.6:/work" \ |
| 45 | + -e HOME=/tmp \ |
| 46 | + -e WINEPREFIX=/tmp/wineprefix \ |
| 47 | + -e WINEPATH='Z:\work\usr\bin;Z:\usr\src\mxe\usr\x86_64-w64-mingw32.shared.posix\bin' \ |
| 48 | + -e CMAKE_TOOLCHAIN_FILE= \ |
| 49 | + -e PKG_CONFIG_PATH=/work/usr/lib/pkgconfig \ |
| 50 | + -e PKG_CONFIG_LIBDIR=/work/usr/lib/pkgconfig \ |
| 51 | + -w /work \ |
| 52 | + --entrypoint bash julia-winbuild:latest \ |
| 53 | + -c 'set -o pipefail |
| 54 | + export PATH=/usr/src/mxe/usr/bin:/usr/local/bin:$PATH |
| 55 | + unset CMAKE_TOOLCHAIN_FILE |
| 56 | + mkdir -p /tmp/wineprefix usr/bin |
| 57 | + for d in libgcc_s_seh-1 libstdc++-6 libwinpthread-1 libgfortran-5 libquadmath-0 libgomp-1 libssp-0 libatomic-1; do |
| 58 | + cp -f /usr/src/mxe/usr/x86_64-w64-mingw32.shared.posix/bin/$d.dll usr/bin/ |
| 59 | + done |
| 60 | + # Stop *before* the sysimage step so the Windows job can drive it. |
| 61 | + make -j 4 julia-src-release 2>&1 | tail -200 |
| 62 | + echo "=== usr/bin layout ===" && ls -la usr/bin |
| 63 | + echo "=== usr/manifest ===" && ls usr/manifest' |
| 64 | +
|
| 65 | + - name: Tar Julia install tree |
| 66 | + run: | |
| 67 | + cd julia-1.12.6 |
| 68 | + # Ship the full usr tree plus Base.jl/sysimage scripts needed for the |
| 69 | + # sysimage bootstrap, plus the buildroot-relative scripts. |
| 70 | + tar -czf ../julia-winbuild-usr.tar.gz \ |
| 71 | + usr/ base/ stdlib/ sysimage.mk Makefile Make.user Make.inc VERSION \ |
| 72 | + src/Makefile contrib/windows |
| 73 | + ls -lh ../julia-winbuild-usr.tar.gz |
| 74 | +
|
| 75 | + - name: Upload artifact for Windows job |
| 76 | + uses: actions/upload-artifact@v4 |
| 77 | + with: |
| 78 | + name: julia-winbuild-usr |
| 79 | + path: julia-winbuild-usr.tar.gz |
| 80 | + retention-days: 7 |
| 81 | + |
| 82 | + - name: Show disk after |
| 83 | + if: always() |
| 84 | + run: df -h / |
| 85 | + |
| 86 | + |
| 87 | + run-windows: |
| 88 | + needs: build-linux |
| 89 | + runs-on: windows-2022 |
| 90 | + timeout-minutes: 30 |
| 91 | + steps: |
| 92 | + - name: Download Linux build artifact |
| 93 | + uses: actions/download-artifact@v4 |
| 94 | + with: |
| 95 | + name: julia-winbuild-usr |
| 96 | + |
| 97 | + - name: Extract |
| 98 | + shell: pwsh |
| 99 | + run: | |
| 100 | + mkdir julia-tree | Out-Null |
| 101 | + tar -xzf julia-winbuild-usr.tar.gz -C julia-tree |
| 102 | + Get-ChildItem julia-tree |
| 103 | + Get-ChildItem julia-tree\usr\bin\julia.exe, julia-tree\usr\bin\libjulia*.dll |
| 104 | +
|
| 105 | + - name: julia.exe --version (the smoke test that fails silently in wine) |
| 106 | + shell: pwsh |
| 107 | + continue-on-error: true |
| 108 | + run: | |
| 109 | + $exe = "$PWD\julia-tree\usr\bin\julia.exe" |
| 110 | + Write-Host "=== file info ===" |
| 111 | + Get-Item $exe | Format-List |
| 112 | + Write-Host "=== running --version ===" |
| 113 | + & $exe --version |
| 114 | + Write-Host "=== exit code: $LASTEXITCODE ===" |
| 115 | +
|
| 116 | + - name: julia.exe -e 'println(VERSION)' (no sysimage required for this) |
| 117 | + shell: pwsh |
| 118 | + continue-on-error: true |
| 119 | + run: | |
| 120 | + $exe = "$PWD\julia-tree\usr\bin\julia.exe" |
| 121 | + & $exe -e "println(VERSION)" |
| 122 | + Write-Host "=== exit code: $LASTEXITCODE ===" |
| 123 | +
|
| 124 | + - name: Enumerate DLL imports of julia.exe and libjulia*.dll |
| 125 | + shell: pwsh |
| 126 | + continue-on-error: true |
| 127 | + run: | |
| 128 | + $dumpbin = (Get-ChildItem "C:\Program Files*\Microsoft Visual Studio\2022\*\VC\Tools\MSVC\*\bin\Hostx64\x64\dumpbin.exe" -ErrorAction SilentlyContinue | Select-Object -First 1).FullName |
| 129 | + if (-not $dumpbin) { $dumpbin = (Get-Command dumpbin.exe -ErrorAction SilentlyContinue).Source } |
| 130 | + Write-Host "dumpbin: $dumpbin" |
| 131 | + foreach ($f in @('julia.exe','libjulia.dll','libjulia-internal.dll','libjulia-codegen.dll')) { |
| 132 | + $p = "$PWD\julia-tree\usr\bin\$f" |
| 133 | + if (Test-Path $p) { |
| 134 | + Write-Host "=== /dependents $f ===" |
| 135 | + & $dumpbin /dependents $p |
| 136 | + } |
| 137 | + } |
| 138 | +
|
| 139 | + - name: Run the actual sysimage bootstrap command (basecompiler-o.a) |
| 140 | + shell: bash |
| 141 | + continue-on-error: true |
| 142 | + run: | |
| 143 | + set -x |
| 144 | + cd julia-tree |
| 145 | + PRIVATE_LIBDIR="usr/lib/julia" |
| 146 | + mkdir -p "$PRIVATE_LIBDIR" |
| 147 | + cd base |
| 148 | + # Cargo-cult the same command the Makefile would invoke under wine |
| 149 | + # see sysimage.mk base_builder recipe |
| 150 | + "../usr/bin/julia.exe" -O1 \ |
| 151 | + -C "generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)" \ |
| 152 | + --output-o "..\\${PRIVATE_LIBDIR//\//\\}\\basecompiler-o.a.tmp" \ |
| 153 | + --startup-file=no --warn-overwrite=yes -g1 Base_compiler.jl \ |
| 154 | + --buildroot "..\\" --dataroot "..\\share\\julia\\" \ |
| 155 | + 2>&1 | tee ../basecompiler.log |
| 156 | + echo "=== exit code: $? ===" |
| 157 | + echo "=== output tail ===" |
| 158 | + tail -50 ../basecompiler.log |
| 159 | +
|
| 160 | + - name: Upload bootstrap log |
| 161 | + if: always() |
| 162 | + uses: actions/upload-artifact@v4 |
| 163 | + with: |
| 164 | + name: bootstrap-log |
| 165 | + path: julia-tree/basecompiler.log |
| 166 | + if-no-files-found: ignore |
0 commit comments