flyover / imgui-js

JavaScript bindings for Dear ImGui using Emscripten and TypeScript
https://flyover.github.io/imgui-js/example/
MIT License
915 stars 98 forks source link

I tried to rebuild after enabling parameter ALLOW_MEMORY_GROWTH=1, but the build failed with the following error: #63

Open slicol opened 9 months ago

slicol commented 9 months ago

slicol@ubuntu:~/imgui-js$ make build mkdir -p build emcc -Os -D "IM_ASSERT(EXPR)=((void)(EXPR))" -D IMGUI_DISABLE_OBSOLETE_FUNCTIONS -D IMGUI_DISABLE_DEMO_WINDOWS -I imgui -c src/bind-imgui.cpp -o build/bind-imgui.o In file included from src/bind-imgui.cpp:14: In file included from /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/bind.h:23: /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:226:20: error: assigning to 'void ' from 'const ImVec2 ' discards qualifiers 226 | cursor->w[0].p = wt; | ^~ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:248:3: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireType' requested here 248 | writeGenericWireType(cursor, BindingType::toWireType(std::forward(first))); | ^ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:256:5: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireTypes<const ImVec2 &>' requested here 256 | writeGenericWireTypes(cursor, std::forward(args)...); | ^ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:389:21: note: in instantiation of member function 'emscripten::internal::WireTypePack<const ImVec2 &>::WireTypePack' requested here 389 | WireTypePack argv(std::forward(value)); | ^ src/bind-imgui.cpp:499:9: note: in instantiation of function template specialization 'emscripten::val::val<const ImVec2 &>' requested here 499 | CLASS_MEMBER_GET_RAW_REFERENCE(ImGuiSizeCallbackData, Pos) | ^ src/bind-imgui.cpp:47:39: note: expanded from macro 'CLASS_MEMBER_GET_RAW_REFERENCE' 47 | auto p = &that.MEMBER; return emscripten::val(p); \ | ^ In file included from src/bind-imgui.cpp:14: In file included from /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/bind.h:23: /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:226:20: error: assigning to 'void ' from 'const ImGuiTableColumnSortSpecs ' discards qualifiers 226 | cursor->w[0].p = wt; | ^~ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:248:3: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireType' requested here 248 | writeGenericWireType(cursor, BindingType::toWireType(std::forward(first))); | ^ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:256:5: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireTypes<const ImGuiTableColumnSortSpecs &>' requested here 256 | writeGenericWireTypes(cursor, std::forward(args)...); | ^ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:389:21: note: in instantiation of member function 'emscripten::internal::WireTypePack<const ImGuiTableColumnSortSpecs &>::WireTypePack' requested here 389 | WireTypePack argv(std::forward(value)); | ^ src/bind-imgui.cpp:541:20: note: in instantiation of function template specialization 'emscripten::val::val<const ImGuiTableColumnSortSpecs &>' requested here 541 | return emscripten::val(spec); | ^ In file included from src/bind-imgui.cpp:14: In file included from /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/bind.h:23: /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:226:20: error: assigning to 'void ' from 'const ImVec4 ' discards qualifiers 226 | cursor->w[0].p = wt; | ^~ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:248:3: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireType' requested here 248 | writeGenericWireType(cursor, BindingType::toWireType(std::forward(first))); | ^ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:256:5: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireTypes<const ImVec4 &>' requested here 256 | writeGenericWireTypes(cursor, std::forward(args)...); | ^ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:389:21: note: in instantiation of member function 'emscripten::internal::WireTypePack<const ImVec4 &>::WireTypePack' requested here 389 | WireTypePack argv(std::forward(value)); | ^ src/bind-imgui.cpp:555:9: note: in instantiation of function template specialization 'emscripten::val::val<const ImVec4 &>' requested here 555 | CLASS_MEMBER_GET_RAW_REFERENCE(ImDrawCmd, ClipRect) | ^ src/bind-imgui.cpp:47:39: note: expanded from macro 'CLASS_MEMBER_GET_RAW_REFERENCE' 47 | auto p = &that.MEMBER; return emscripten::val(p); \ | ^ In file included from src/bind-imgui.cpp:14: In file included from /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/bind.h:23: /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:226:20: error: assigning to 'void ' from 'const ImDrawCmd ' discards qualifiers 226 | cursor->w[0].p = wt; | ^~ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:248:3: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireType' requested here 248 | writeGenericWireType(cursor, BindingType::toWireType(std::forward(first))); | ^ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:256:5: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireTypes<const ImDrawCmd &>' requested here 256 | writeGenericWireTypes(cursor, std::forward(args)...); | ^ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:389:21: note: in instantiation of member function 'emscripten::internal::WireTypePack<const ImDrawCmd &>::WireTypePack' requested here 389 | WireTypePack argv(std::forward(value)); | ^ src/bind-imgui.cpp:567:26: note: in instantiation of function template specialization 'emscripten::val::val<const ImDrawCmd &>' requested here 567 | callback(emscripten::val(pcmd), emscripten::val(ElemStart)); | ^ In file included from src/bind-imgui.cpp:14: In file included from /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/bind.h:23: /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:226:20: error: assigning to 'void ' from 'const ImDrawList ' discards qualifiers 226 | cursor->w[0].p = wt; | ^~ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:248:3: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireType' requested here 248 | writeGenericWireType(cursor, BindingType::toWireType(std::forward(first))); | ^ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:256:5: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireTypes<const ImDrawList &>' requested here 256 | writeGenericWireTypes(cursor, std::forward(args)...); | ^ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:389:21: note: in instantiation of member function 'emscripten::internal::WireTypePack<const ImDrawList &>::WireTypePack' requested here 389 | WireTypePack argv(std::forward(value)); | ^ src/bind-imgui.cpp:815:26: note: in instantiation of function template specialization 'emscripten::val::val<const ImDrawList &>' requested here 815 | callback(emscripten::val(cmd_list)); | ^ In file included from src/bind-imgui.cpp:14: In file included from /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/bind.h:23: /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:226:20: error: assigning to 'void ' from 'const ImFontGlyph ' discards qualifiers 226 | cursor->w[0].p = wt; | ^~ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:248:3: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireType' requested here 248 | writeGenericWireType(cursor, BindingType::toWireType(std::forward(first))); | ^ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:256:5: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireTypes<const ImFontGlyph &>' requested here 256 | writeGenericWireTypes(cursor, std::forward(args)...); | ^ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:389:21: note: in instantiation of member function 'emscripten::internal::WireTypePack<const ImFontGlyph &>::WireTypePack' requested here 389 | WireTypePack argv(std::forward(value)); | ^ src/bind-imgui.cpp:945:9: note: in instantiation of function template specialization 'emscripten::val::val<const ImFontGlyph &>' requested here 945 | CLASS_MEMBER_GET_SET_RAW_POINTER(ImFont, FallbackGlyph) | ^ src/bind-imgui.cpp:40:76: note: expanded from macro 'CLASS_MEMBER_GET_SET_RAW_POINTER' 40 | auto p = that.MEMBER; return p == NULL ? emscripten::val::null() : emscripten::val(p); \ | ^ In file included from src/bind-imgui.cpp:14: In file included from /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/bind.h:23: /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:226:20: error: assigning to 'void ' from 'const ImFontConfig ' discards qualifiers 226 | cursor->w[0].p = wt; | ^~ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:248:3: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireType' requested here 248 | writeGenericWireType(cursor, BindingType::toWireType(std::forward(first))); | ^ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:256:5: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireTypes<const ImFontConfig &>' requested here 256 | writeGenericWireTypes(cursor, std::forward(args)...); | ^ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:389:21: note: in instantiation of member function 'emscripten::internal::WireTypePack<const ImFontConfig &>::WireTypePack' requested here 389 | WireTypePack argv(std::forward(value)); | ^ src/bind-imgui.cpp:963:26: note: in instantiation of function template specialization 'emscripten::val::val<const ImFontConfig &>' requested here 963 | callback(emscripten::val(cfg)); | ^ In file included from src/bind-imgui.cpp:14: In file included from /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/bind.h:23: /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:239:20: error: static_cast from 'const ImVec2 ' to 'unsigned int' is not allowed 239 | cursor->w[0].u = static_cast(wt); | ^~~~~~~~~ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:248:3: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireType<const ImVec2 >' requested here 248 | writeGenericWireType(cursor, BindingType::toWireType(std::forward(first))); | ^ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:256:5: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireTypes<const ImVec2 const &>' requested here 256 | writeGenericWireTypes(cursor, std::forward(args)...); | ^ /home/slicol/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:389:21: note: in instantiation of member function 'emscripten::internal::WireTypePack<const ImVec2 const &>::WireTypePack' requested here 389 | WireTypePack argv(std::forward(value)); | ^ src/bind-imgui.cpp:1533:70: note: in instantiation of function template specialization 'emscripten::val::val<const ImVec2 const &>' requested here 1533 | const auto p = &that->MouseClickedPos[index]; return emscripten::val(p); | ^ 8 errors generated. emcc: error: '/home/slicol/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -DEMSCRIPTEN --sysroot=/home/slicol/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -Os -D IM_ASSERT(EXPR)=((void)(EXPR)) -D IMGUI_DISABLE_OBSOLETE_FUNCTIONS -D IMGUI_DISABLE_DEMO_WINDOWS -Iimgui -c src/bind-imgui.cpp -o build/bind-imgui.o' failed (returned 1) Makefile:88: recipe for target 'build/bind-imgui.o' failed make: *** [build/bind-imgui.o] Error 1

slicol commented 9 months ago

Can you please help me create a branch, enable this parameter, and rebuild it?

slicol commented 9 months ago

I have already solved this problem.

thautwarm commented 9 months ago

How did you solve it? Besides, you can use npm run dist to bundle .umd.js files.

slicol commented 9 months ago

How did you solve it? Besides, you can use npm run dist to bundle .umd.js files.

I had tried to fix the compile errors one by one only