Always emit the header-free desktop_wx stub - #81
Merged
Conversation
On some host installs (e.g. the erlef/setup-beam GHA Linux CI used by diode-drive), :code.lib_dir(:wx) reports a valid path AND wx.hrl exists on disk, yet the erlc that mix invokes fails with: can't find include lib "wx/include/wx.hrl" This is the root cause of diode-drive's Linux CI regressions after PR #80. The previous wx_headers_exist?/0 check (File.exists? on the reported lib path) was not strict enough — the file is present yet erlc's include_lib search path does not see it. Replace it with wx_headers_resolvable?/0, which actually invokes erlc against a throwaway module that includes wx.hrl. The probe is the only way to mirror the real compilation step that mix will run. When the probe fails we fall through to the integer-fallback stub, which is sufficient because every host wx call site is now guarded by Code.ensure_loaded?(:wx). The probe uses a stable module/filename pair so erlc's module-name check does not reject the throwaway source. Co-authored-by: Cursor <[email protected]>
dominicletz
force-pushed
the
wx-hrl-robust
branch
from
August 7, 2026 01:44
1d8f59b to
8be0124
Compare
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 some host installs (e.g. the
erlef/setup-beamGHA Linux CI used bydiode-drive),:code.lib_dir(:wx)reports a valid path ANDwx.hrlexists on disk, yet theerlcthatmixinvokes fails with:This is the root cause of the
diode-driveLinux CI regressions after #80. The previouswx_headers_exist?/0check (File.exists?on the reported lib path) was not strict enough — the file is present yeterlc'sinclude_libsearch path does not see it.Replace it with
wx_headers_resolvable?/0, which actually invokeserlcagainst a throwaway module that includeswx.hrl. The probe is the only way to mirror the real compilation step thatmixwill run. When the probe fails we fall through to the integer-fallback stub, which is sufficient because every host wx call site is now guarded byCode.ensure_loaded?(:wx).The probe uses a stable module/filename pair so
erlc's module-name check does not reject the throwaway source.Follow-up to #80.