-
Notifications
You must be signed in to change notification settings - Fork 5
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
imgui: not found assert.h
on wasm32 target
#53
Comments
Is it possible to make |
That looks like the dcimgui dependency doesn't get the Emscripten system header search path set, e.g. in sokol-zig this needs to happen in the 'upstream' build.zig, e.g.: ...alternatively I also had the case that the Emscripten SDK setup was still pending when the C code was already being compiled, that's why there's also this dependency setup on the sokol C library (since the sokol C library depends on the Emscripten SDK setup, any C code compilation will only be attempted once the Emscripten SDK setup has finished): |
Based on sokol-d, the proccess is reversed! Lines 195 to 211 in 3faf1c0
Note Only the imgui is standalone, requiring a double emsdk import, unlike ldc2 which inherits all flags from libsokol. Lines 1200 to 1214 in 3faf1c0
|
I tried removing duplicate emsdk import: diff-patchdiff --git a/build.zig b/build.zig
index 118a7d5..586de7b 100644
--- a/build.zig
+++ b/build.zig
@@ -73,20 +73,19 @@ pub fn buildLibSokol(b: *Build, options: LibSokolOptions) !*CompileStep {
lib.root_module.root_source_file = b.path("src/handmade/math.zig");
if (options.optimize != .Debug)
lib.want_lto = true;
+
// make sure we're building for the wasm32-emscripten target, not wasm32-freestanding
if (lib.rootModuleTarget().os.tag != .emscripten) {
std.log.err("Please build with 'zig build -Dtarget=wasm32-emscripten", .{});
return error.Wasm32EmscriptenExpected;
}
// one-time setup of Emscripten SDK
- if (!options.with_sokol_imgui) {
- if (options.emsdk) |emsdk| {
- if (try emSdkSetupStep(b, emsdk)) |emsdk_setup| {
- lib.step.dependOn(&emsdk_setup.step);
- }
- // add the Emscripten system include seach path
- lib.addIncludePath(emSdkLazyPath(b, emsdk, &.{ "upstream", "emscripten", "cache", "sysroot", "include" }));
+ if (options.emsdk) |emsdk| {
+ if (try emSdkSetupStep(b, emsdk)) |emsdk_setup| {
+ lib.step.dependOn(&emsdk_setup.step);
}
+ // add the Emscripten system include seach path
+ lib.addSystemIncludePath(emSdkLazyPath(b, emsdk, &.{ "upstream", "emscripten", "cache", "sysroot", "include" }));
}
}
@@ -1197,21 +1196,6 @@ fn buildImgui(b: *Build, options: libImGuiOptions) !*CompileStep {
const imgui = dep.path(imguiver_path);
libimgui.addIncludePath(imgui);
- if (options.emsdk) |emsdk| {
- if (libimgui.rootModuleTarget().isWasm()) {
- if (try emSdkSetupStep(b, emsdk)) |emsdk_setup| {
- libimgui.step.dependOn(&emsdk_setup.step);
- }
- // add the Emscripten system include seach path
- libimgui.addIncludePath(emSdkLazyPath(b, emsdk, &.{
- "upstream",
- "emscripten",
- "cache",
- "sysroot",
- "include",
- }));
- }
- }
libimgui.addCSourceFiles(.{
.root = imgui,
.files = &.{ output-errorrun-droptest
└─ run /home/kassane/.cache/zig/p/12201185a3deb48d17035e6c619f2b28cef8cd6080afe88e061e326a6a3826a7a370/upstream/emscripten/emrun
└─ install generated/
└─ emcc
└─ zig build-lib imgui Debug wasm32-emscripten-none 6 errors
/home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/imgui.h:90:10: error: 'assert.h' file not found
#include <assert.h>
^~~~~~~~~~~
/home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/cimgui.cpp:5:10: note: in file included from /home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/cimgui.cpp:5:
#include "imgui.h"
^
/home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/imgui.h:90:10: error: 'assert.h' file not found
#include <assert.h>
^~~~~~~~~~~
/home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/imgui_tables.cpp:198:10: note: in file included from /home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/imgui_tables.cpp:198:
#include "imgui.h"
^
/home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/imgui.h:90:10: error: 'assert.h' file not found
#include <assert.h>
^~~~~~~~~~~
/home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/imgui_demo.cpp:106:10: note: in file included from /home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/imgui_demo.cpp:106:
#include "imgui.h"
^
/home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/imgui.h:90:10: error: 'assert.h' file not found
#include <assert.h>
^~~~~~~~~~~
/home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/imgui_draw.cpp:34:10: note: in file included from /home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/imgui_draw.cpp:34:
#include "imgui.h"
^
/home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/imgui.h:90:10: error: 'assert.h' file not found
#include <assert.h>
^~~~~~~~~~~
/home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/imgui_widgets.cpp:43:10: note: in file included from /home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/imgui_widgets.cpp:43:
#include "imgui.h"
^
/home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/imgui.h:90:10: error: 'assert.h' file not found
#include <assert.h>
^~~~~~~~~~~
/home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/imgui.cpp:1071:10: note: in file included from /home/kassane/.cache/zig/p/1220c640ad23d8800437166865e54f172c612fcfe6e000149a2b2af631c37b605f50/src/imgui.cpp:1071:
#include "imgui.h"
^
error: warning(compilation): failed to delete '/home/kassane/sokol-d/.zig-cache/tmp/b180ba3be8c1367-cimgui.o.d': FileNotFound
warning(compilation): failed to delete '/home/kassane/sokol-d/.zig-cache/tmp/7c5f4382b077c680-imgui_tables.o.d': FileNotFound
warning(compilation): failed to delete '/home/kassane/sokol-d/.zig-cache/tmp/2631f3da44f3d9a5-imgui_demo.o.d': FileNotFound
warning(compilation): failed to delete '/home/kassane/sokol-d/.zig-cache/tmp/353cd2b018dc0fd2-imgui_draw.o.d': FileNotFound
warning(compilation): failed to delete '/home/kassane/sokol-d/.zig-cache/tmp/81484e60b1b0734-imgui_widgets.o.d': FileNotFound
warning(compilation): failed to delete '/home/kassane/sokol-d/.zig-cache/tmp/1bb28bc0c30a803c-imgui.o.d': FileNotFound fixed by: b531649 However, returned previous error... |
source: https://github.com/floooh/dcimgui/blob/9356c08eb4d1d320e79e418a36d59a427627634a/src/cimgui.h#L92-L95
How to reproduce
Clean zig
global-cache
+zig-cache
packages and run any imgui sample in wasm32 target.The text was updated successfully, but these errors were encountered: