Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(emscripten): ensure EMSDK setup completes before WASM compilation #54

Merged
merged 8 commits into from
Feb 12, 2025

Conversation

kassane
Copy link
Owner

@kassane kassane commented Feb 11, 2025

@kassane kassane added the fix fixing bug label Feb 11, 2025
@kassane kassane requested a review from floooh February 11, 2025 14:23
build.zig Outdated Show resolved Hide resolved
build.zig Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
@floooh
Copy link
Collaborator

floooh commented Feb 11, 2025

IIRC the way it is supposed to work in the sokol-zig build.zig is that the sokol C library depends on the Emscripten setup step, and then all other C libraries depend on the sokol library.

E.g. the lib here is the sokol C library:

https://github.com/floooh/sokol-zig/blob/935ad0e05eeb6c223d06dcdd16a155c6be8ff49d/build.zig#L202-L204

...and the in the sokol-zig-imgui-sample project, the cimgui lib depends on sokol:

https://github.com/floooh/sokol-zig-imgui-sample/blob/4e09e59c95e04399a04d9e2f39aeb03057813aec/build.zig#L75

...so basically, Emscripten setup finishes first, then the sokol C library is compiled, and then all other C libraries.

@floooh
Copy link
Collaborator

floooh commented Feb 11, 2025

Oh... the errors here (assert.h not found):

https://github.com/kassane/sokol-d/actions/runs/13225929376/job/36916768510

...look entirely different then the CI error in this PR (those are all linker errors):

https://github.com/kassane/sokol-d/actions/runs/13265008351/job/37030179876

@kassane
Copy link
Owner Author

kassane commented Feb 11, 2025

Oh... the errors here (assert.h not found):

https://github.com/kassane/sokol-d/actions/runs/13225929376/job/36916768510

...look entirely different then the CI error in this PR (those are all linker errors):

https://github.com/kassane/sokol-d/actions/runs/13265008351/job/37030179876

Exactly! ldc2 replace libsokol to libimgui config. 🤦‍♂️ (I'll fix)

---edit

Why windows works?

@kassane
Copy link
Owner Author

kassane commented Feb 11, 2025

Evaluating the current build process involving imgui:

  • build libsokol
  • build libimgui + cimgui (if enabled)
  • build D example(s) - get libsokol and libimgui + cimgui.h (dcimgui.d)*

*ldc2/ldmd2 requires reading the header to autogenerate imgui-bindings. Unlike libsokol which has bindings generated in the sokol-upstream. Also ldc2/ldmd2 get all includes + flags/defines from libsokol!

for wasm32 - ldc2 step force libsokol-step dependOn
@kassane
Copy link
Owner Author

kassane commented Feb 11, 2025

Ok. I need help (MacOS user)!!

build.zig Show resolved Hide resolved
build.zig Show resolved Hide resolved
@kassane
Copy link
Owner Author

kassane commented Feb 11, 2025

Finally 96a06db ✔️ (need review)

@kassane
Copy link
Owner Author

kassane commented Feb 11, 2025

Why dub in windows tried linking sokol_imgui on non-imgui samples?
https://github.com/kassane/sokol-d/actions/runs/13271341447/job/37051226526?pr=54#step:6:31

@kassane kassane merged commit b2a1620 into main Feb 12, 2025
4 checks passed
@kassane kassane deleted the imgui_wasm branch February 12, 2025 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix fixing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

imgui: not found assert.h on wasm32 target
2 participants