Skip to content

Always emit the header-free desktop_wx stub - #81

Merged
dominicletz merged 1 commit into
mainfrom
wx-hrl-robust
Aug 7, 2026
Merged

Always emit the header-free desktop_wx stub#81
dominicletz merged 1 commit into
mainfrom
wx-hrl-robust

Conversation

@dominicletz

@dominicletz dominicletz commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

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 the diode-drive Linux CI regressions after #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.

Follow-up to #80.

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
dominicletz merged commit 291602a into main Aug 7, 2026
2 checks passed
@dominicletz
dominicletz deleted the wx-hrl-robust branch August 7, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant