-
Notifications
You must be signed in to change notification settings - Fork 3.4k
implicit instantiation of undefined template #11274
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
Comments
Hello again folks 👋 did anyone get the time to take a look at this? |
This might help in debugging the root cause. |
I can reproduce this error with emsdk 2.0.8. As mentioned, there is this patch file tries to use the internals of emscripten. Maybe there is something going on here. I am familiar with these API. Here is the reproduction:
Build (in bash): #!/usr/bin/env bash
mkdir -p build
## Compile pcre
emcc \
-O3 \
-I vendor/pcre/10.23/src \
-I vendor/pcre/include \
-D HAVE_CONFIG_H \
-D PCRE2_CODE_UNIT_WIDTH=16 \
-c \
vendor/pcre/pcre2_chartables.c \
vendor/pcre/10.23/src/pcre2_auto_possess.c \
vendor/pcre/10.23/src/pcre2_compile.c \
vendor/pcre/10.23/src/pcre2_config.c \
vendor/pcre/10.23/src/pcre2_context.c \
vendor/pcre/10.23/src/pcre2_dfa_match.c \
vendor/pcre/10.23/src/pcre2_error.c \
vendor/pcre/10.23/src/pcre2_find_bracket.c \
vendor/pcre/10.23/src/pcre2_jit_compile.c \
vendor/pcre/10.23/src/pcre2_maketables.c \
vendor/pcre/10.23/src/pcre2_match.c \
vendor/pcre/10.23/src/pcre2_match_data.c \
vendor/pcre/10.23/src/pcre2_newline.c \
vendor/pcre/10.23/src/pcre2_ord2utf.c \
vendor/pcre/10.23/src/pcre2_pattern_info.c \
vendor/pcre/10.23/src/pcre2_serialize.c \
vendor/pcre/10.23/src/pcre2_string_utils.c \
vendor/pcre/10.23/src/pcre2_study.c \
vendor/pcre/10.23/src/pcre2_substitute.c \
vendor/pcre/10.23/src/pcre2_substring.c \
vendor/pcre/10.23/src/pcre2_tables.c \
vendor/pcre/10.23/src/pcre2_ucd.c \
vendor/pcre/10.23/src/pcre2_valid_utf.c \
vendor/pcre/10.23/src/pcre2_xclass.c
mv *.o build/
emar \
rcs build/pcre.a \
build/*.o
rm build/*.o
### Compile superstring
em++ \
--bind \
-o browser.js \
-O3 \
-xc++ \
-std=c++11 \
-I src/bindings/em \
-I src/core \
-I vendor/libcxx \
-I vendor/pcre/include \
-D PCRE2_CODE_UNIT_WIDTH=16 \
--pre-js src/bindings/em/prologue.js \
--post-js src/bindings/em/epilogue.js \
src/core/*.cc \
src/bindings/em/*.cc \
build/pcre.a \
-s TOTAL_MEMORY=134217728 \
--memory-init-file 0 \
"$@"
|
Here is a minimal example to reproduce the issue. Can someone please look into this? It is not possible to make a class constructor that accepts a JavaScript object as the input! mwe.cpp #include<emscripten/bind.h>
struct MyStruct {
bool optionA;
MyStruct(bool _optionA): optionA{_optionA} {};
};
MyStruct *constructor_(emscripten::val value) {
bool optionA = false;
if (value.as<bool>() && value["optionA"].as<bool>()) {
optionA = true;
}
return new MyStruct(optionA);
}
EMSCRIPTEN_BINDINGS(MyStruct) {
emscripten::class_<MyStruct>("MyStruct")
.constructor<emscripten::val>(&constructor_);
} em++ --bind -o mwe.js -std=c++17 -O0 ./mwe.cpp --memory-init-file 0 |
Having met the same error text I came here. I reconstructed the example of class binding at embind and had a hard time... until I realized that there was a tiny little itch in my reproduction: the getter needs a const after it. I assume that this is to allow a safer js-view of the C-struct. This is independent of having a constructor or not. |
I want to embind a C++ class with its self pointer as constructor arg:
use
& have the same problem... |
Any update on this one? I have the same issue here. |
For anyone who lands here looking for solutions trying to overload a class constructor using the 'constructor<emscripten::val>' construct, which unfortunately comes up top in google search on the subject, this construct is not valid with recent emscripten, you have to use a factory function instead, as described in the docs, https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#external-constructors. |
Hello there 👋 I maintaining a core atom package and the CI looks like it's been stuck for a while, it was downloading a version-less portable emscripten sdk and activating version
sdk-1.37.9-64bit
implicit instantiation of undefined template 'emscripten::internal::RegisterClassConstructor<emscripten::val>'
Full Error (click to expand).
I saw another issue that looks related but sadly there are no answers from the community.
For reference that's the PR I created on the target repo to update the emscripten dependencies and resolve the build issues, in case you would like the setup before and after, feel free to build this locally by following the same steps in
.github/workflows/build.yml
that's the exact reference the compiler is complaining about, I am not entirely sure if the problem is related to this line or not but seems related to the way of overloading the constructor.
The text was updated successfully, but these errors were encountered: