build: stop enabling Asio separate compilation without an implementation - #928
Open
jcelerier wants to merge 1 commit into
Open
build: stop enabling Asio separate compilation without an implementation#928jcelerier wants to merge 1 commit into
jcelerier wants to merge 1 commit into
Conversation
On Windows, a shared build defined BOOST_ASIO_DYN_LINK=1 for every compiler. That macro, like BOOST_ASIO_SEPARATE_COMPILATION, turns off Asio's header-only default, so the separately compiled part of Asio has to come from somewhere. It only ever did on MSVC: src/ossia/context.cpp includes <boost/asio/impl/src.hpp> under _MSC_VER, and so do score's four puppet executables. With mingw-w64 the macro was therefore switched on while no translation unit compiled the implementation, and every Asio entry point that is not inline went undefined - 16467 references when linking libossia_x64.dll on MSYS2 UCRT64. Nothing had caught it because the reference build dirs were incremental, and libossia's sources do not change often enough for ninja to relink the DLL. Boost 1.91 only made it legible: BOOST_ASIO_ENABLE_VERSION_NAMESPACE places the missing symbols in an inline namespace tagged with the Asio configuration, so the diagnostics name boost::asio::v103801_bdemn:: rather than boost::asio::. The tag matches on both sides of the link - the symbols are missing, not mismatched. Move the definition into the MSVC branch next to BOOST_ASIO_SEPARATE_COMPILATION, so the macros and the src.hpp include agree. Non-MSVC Windows goes back to Asio's header-only default; MSVC is unchanged.
jcelerier
requested a deployment
to
Apple Certificate
August 18, 2026 20:44 — with
GitHub Actions
Queued
jcelerier
requested a deployment
to
Apple Certificate
August 18, 2026 20:44 — with
GitHub Actions
Queued
jcelerier
requested a deployment
to
Apple Certificate
August 18, 2026 20:44 — with
GitHub Actions
Queued
jcelerier
requested a deployment
to
Apple Certificate
August 18, 2026 20:44 — with
GitHub Actions
Queued
jcelerier
temporarily deployed
to
Apple Certificate
August 18, 2026 20:44 — with
GitHub Actions
Inactive
jcelerier
requested a deployment
to
Apple Certificate
August 18, 2026 20:44 — with
GitHub Actions
Queued
jcelerier
temporarily deployed
to
Apple Certificate
August 18, 2026 20:44 — with
GitHub Actions
Inactive
jcelerier
requested a deployment
to
Apple Certificate
August 18, 2026 20:44 — with
GitHub Actions
Queued
jcelerier
temporarily deployed
to
Apple Certificate
August 18, 2026 20:44 — with
GitHub Actions
Inactive
jcelerier
temporarily deployed
to
Apple Certificate
August 18, 2026 20:44 — with
GitHub Actions
Inactive
jcelerier
added a commit
to ossia/score
that referenced
this pull request
Aug 19, 2026
Windows shared builds could not link libossia at all: BOOST_ASIO_DYN_LINK was defined for every Windows compiler while only MSVC compiles the Asio implementation, so every non-inline Asio entry point went undefined. Both mingw toolchains were affected -- 16467 undefined references under UCRT64 gcc 16.2, and ld.lld reporting the same symbols under CLANG64. Pinning the fix at the root of the stack means every commit in it can be built on Windows, which is what the per-commit verification walk needs. Upstream as ossia/libossia#928; the pin moves to the merge commit once that lands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows, a shared build defined
BOOST_ASIO_DYN_LINK=1for every compiler. That macro, likeBOOST_ASIO_SEPARATE_COMPILATION, switches off Asio's header-only default, so the separately-compiled part of Asio has to come from somewhere. It only ever did on MSVC:src/ossia/context.cppincludes<boost/asio/impl/src.hpp>under_MSC_VER.With mingw-w64 the macro was therefore switched on while no translation unit compiled the implementation, and every non-inline Asio entry point went undefined.
The chain, from Asio's own headers
BOOST_ASIO_DYN_LINKdefined ⇒BOOST_ASIO_HEADER_ONLYnot defined —detail/config.hpp:38-44, "a DLL/shared library implies separate compilation".io_context.hpp:1356-1358:#if defined(BOOST_ASIO_HEADER_ONLY) # include <boost/asio/impl/io_context.ipp> #endif. With it undefined the.ippfiles are never included anywhere.detail/impl/winsock_init.ipp:34defineswinsock_init_base::startup— exactly the symbol both linkers report undefined.Note this is not "declarations became
dllimport": that branch is_MSC_VER || __BORLANDC__ || __CODEGEARC__only (config.hpp:50), so on MinGWBOOST_ASIO_DECLexpands to nothing at all.Boost 1.91 only made it legible —
BOOST_ASIO_ENABLE_VERSION_NAMESPACEputs the missing symbols in an inline namespace tagged with the Asio configuration, so the diagnostics nameboost::asio::v103801_bdemn::rather thanboost::asio::. The tag matches on both sides of the link: the symbols are missing, not mismatched.The fix
Move
BOOST_ASIO_DYN_LINKinto theif(MSVC)branch next toBOOST_ASIO_SEPARATE_COMPILATION, so the macros and thesrc.hppinclude agree. Non-MSVC Windows returns to Asio's header-only default; MSVC is unchanged.Why it went unnoticed
The block dates from
41bfc692a("Fix boost.asio separate compilation only working on windows"), the same commit that narrowed thesrc.hppinclude to_MSC_VER. It only shows up in a from-scratch build dir with dynamic plugins: libossia's sources change rarely enough that ninja does not relink the DLL in an incremental tree.Validation
Ten from-scratch configurations, three OSes.
DYN_LINKisgrep -c BOOST_ASIO_DYN_LINK build.ninja— the macro as the generator actually emitted it.boost::asiolibossia_x64.dlllibossia_x64.alibossia_x64.dlllibossia_x64.alibossia.solibossia.alibossia.dyliblibossia.aBoth mingw toolchains are affected, not just gcc — rows 1 and 4 are the negative controls. The differing counts are reporting granularity, not severity: GNU
ldreports every reference site,ld.lldreports each symbol once.Being explicit about what these rows prove: only rows 1-2 and 4-5 can distinguish patched from unpatched. The static rows are structurally blind (
OSSIA_STATICis ON, and theif(NOT OSSIA_STATIC)guard suppressed the macro in the original code too), and rows 7-10 are blind by construction —if(WIN32)spans lines 45-118 and both hunks fall inside it, so the patch cannot alter a non-Windows configure. Rows 3 and 6-10 are no-regression checks.Embedding safety unchanged
OSSIA_MAX_ONLY/OSSIA_PD_ONLYbothset(OSSIA_STATIC 1)(cmake/OssiaOptions.cmake:141,163), and the block is guardedif(NOT OSSIA_STATIC), soDYN_LINKnever fired for the Max/Pd externals before or after. Measured on the harder artifact anyway — the sharedlibossia_x64.dll: the PE export directory holds 3092 entries (CLANG64) / 3164 (UCRT64) and zero mangle as_ZN5boost4asio. The 131/135 exports containing the substringasioare allossia::oscquery_asio::*.