Skip to content

Commit 9de2883

Browse files
committed
fix(common): use Q_NAMESPACE without Q_CORE_EXPORT decoration
terminal_common is a static library, so its TerminalSim namespace metaobject must not carry dllexport/dllimport decoration. The previous Q_NAMESPACE_EXPORT(Q_CORE_EXPORT) caused MSVC to resolve the TerminalSim::staticMetaObject symbol as 'imported from QtCore.dll', which broke linking of every consumer (test_pathfound_contract, terminal_simulation.exe, etc.) under the Windows release build. Drop to plain Q_NAMESPACE so the metaobject has internal linkage appropriate for a static library. Also rewrites the Windows release CI to build rabbitmq-c from source against the same MSVC toolchain instead of pulling it from vcpkg. This mirrors how Container is handled, avoids vcpkg port-name / SSL-flake surprises, and keeps all native deps under one ABI.
1 parent d28fee0 commit 9de2883

2 files changed

Lines changed: 38 additions & 27 deletions

File tree

.github/workflows/release.yml

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ jobs:
172172

173173
env:
174174
DEPS_PREFIX: ${{ github.workspace }}\deps\install
175-
VCPKG_DEFAULT_TRIPLET: x64-windows
175+
RABBITMQ_C_REF: v0.15.0
176176

177177
steps:
178178
- name: Check out TerminalSim
@@ -229,39 +229,46 @@ jobs:
229229
"QTIFW_ROOT=$($ifwRoot.FullName)" | Out-File -FilePath $env:GITHUB_ENV -Append
230230
"$($ifwRoot.FullName)\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
231231
232-
- name: Install RabbitMQ-C via vcpkg
232+
- name: Check out rabbitmq-c
233+
# Build rabbitmq-c from source against the same MSVC toolchain we use
234+
# for Container and TerminalSim itself. This mirrors how Container is
235+
# handled and avoids vcpkg port name / SSL flake surprises.
236+
uses: actions/checkout@v4
237+
with:
238+
repository: alanxz/rabbitmq-c
239+
ref: ${{ env.RABBITMQ_C_REF }}
240+
path: deps/rabbitmq-c
241+
242+
- name: Configure rabbitmq-c
233243
shell: pwsh
234244
run: |
235-
# The vcpkg port is named 'librabbitmq' upstream; the resulting
236-
# CMake config still installs under share/rabbitmq-c. Retry on
237-
# transient network failures (SSL connect, DNS).
238-
$attempts = 0
239-
$maxAttempts = 4
240-
while ($attempts -lt $maxAttempts) {
241-
$attempts++
242-
vcpkg install librabbitmq:x64-windows
243-
if ($LASTEXITCODE -eq 0) { break }
244-
if ($attempts -ge $maxAttempts) {
245-
throw "vcpkg install librabbitmq failed after $attempts attempts"
246-
}
247-
Write-Warning "vcpkg attempt $attempts failed; retrying in 15s..."
248-
Start-Sleep -Seconds 15
249-
}
245+
cmake -S deps/rabbitmq-c -B deps/build/rabbitmq-c -G Ninja `
246+
-DCMAKE_BUILD_TYPE="$env:BUILD_TYPE" `
247+
-DCMAKE_INSTALL_PREFIX="$env:DEPS_PREFIX" `
248+
-DBUILD_SHARED_LIBS=ON `
249+
-DBUILD_EXAMPLES=OFF `
250+
-DBUILD_TESTS=OFF `
251+
-DBUILD_TOOLS=OFF `
252+
-DBUILD_TOOLS_DOCS=OFF `
253+
-DENABLE_SSL_SUPPORT=OFF
250254
251-
$vcpkgRoot = $env:VCPKG_INSTALLATION_ROOT
255+
- name: Install rabbitmq-c
256+
shell: pwsh
257+
run: cmake --build deps/build/rabbitmq-c --target install
258+
259+
- name: Resolve rabbitmq-c CMake config
260+
shell: pwsh
261+
run: |
252262
$rabbitCmakeDir = Get-ChildItem -Recurse `
253-
-Path "$vcpkgRoot\installed\x64-windows\share" `
263+
-Path "$env:DEPS_PREFIX" `
254264
-Filter 'rabbitmq-c-config.cmake' -ErrorAction SilentlyContinue |
255265
Select-Object -First 1 -ExpandProperty Directory
256266
if (-not $rabbitCmakeDir) {
257-
Write-Error "rabbitmq-c CMake config not found after vcpkg install."
258-
Get-ChildItem "$vcpkgRoot\installed\x64-windows\share" -Recurse -Depth 2 |
267+
Write-Error "rabbitmq-c CMake config not found after install."
268+
Get-ChildItem "$env:DEPS_PREFIX" -Recurse -Depth 3 -Filter '*.cmake' |
259269
Format-Table FullName
260270
exit 1
261271
}
262-
263-
"VCPKG_TOOLCHAIN_FILE=$vcpkgRoot\scripts\buildsystems\vcpkg.cmake" |
264-
Out-File -FilePath $env:GITHUB_ENV -Append
265272
"RABBITMQ_CMAKE_DIR=$($rabbitCmakeDir.FullName)" |
266273
Out-File -FilePath $env:GITHUB_ENV -Append
267274
@@ -286,7 +293,6 @@ jobs:
286293
cmake -S . -B build -G Ninja `
287294
-DCMAKE_BUILD_TYPE="$env:BUILD_TYPE" `
288295
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}\build\install" `
289-
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_TOOLCHAIN_FILE" `
290296
-DCMAKE_PREFIX_PATH="$env:DEPS_PREFIX" `
291297
-DCONTAINER_CMAKE_DIR="$env:DEPS_PREFIX\lib\cmake\Container" `
292298
-DRABBITMQ_CMAKE_DIR="$env:RABBITMQ_CMAKE_DIR" `

src/common/common.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@
77

88
namespace TerminalSim {
99

10-
// Define the namespace as a Qt namespace to enable meta-object features
11-
Q_NAMESPACE_EXPORT(Q_CORE_EXPORT)
10+
// Define the namespace as a Qt namespace to enable meta-object features.
11+
// terminal_common is a static library, so the metaobject must not carry any
12+
// dllexport/dllimport decoration. Q_NAMESPACE (without _EXPORT) emits the
13+
// metaobject with internal linkage suitable for static libraries; using
14+
// Q_NAMESPACE_EXPORT(Q_CORE_EXPORT) on MSVC made the symbol resolve as if
15+
// it lived in QtCore.dll and broke linking from consumers.
16+
Q_NAMESPACE
1217

1318
/**
1419
* @brief Defines supported transportation modes for terminals

0 commit comments

Comments
 (0)