-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
Linking error. Undefined std::__2::__itoa::__u64toa(unsigned long long, char*) when compiling to WebAssembly #71
Comments
Oooh, linker issues, everybody's favourite!
One thing you can try is setting |
Here's a list of the places where the library does int-to-string conversions:
That's it as far as I can tell. I won't be able to attempt a repro for a few days at least, but if you want to try digging as bit deeper, that's where I'd start. Thanks for the bug report! |
Excellent, that did the trick! At a glance, seems that just disables a simpler code path inside TOML++, right? I will try to make a shorter test case with your hints, but I also will need some days to be able to try it out. Thank you very much, I can now work on TOML and WebAssembly support for my project at the same time. :-) <3 |
Awesome, good to hear.
Yup. Functionality should be identical, just that charconv is ' better'.
That probably isn't necessary; since charconv was to blame I can just switch it off for your environment. All I need is a way to uniquely identify that environment (a preprocessor macro set by the compiler, or similar). |
@suy You said that em++ is based on LLVM/Clang, would you be able to tell me what the value of |
Wait, never mind, I just realised that I actually needed |
Turns out the compiler defines |
Thanks to you for the quick fix! And again, thanks for the library. |
Environment
toml++ version and/or commit hash: v2.2.0
Compiler: em++ 1.39.8
C++ standard mode (e.g. 17, 20, 'latest'): Tried with c++17 and -std=c++2a
Target arch (e.g. x64): WebAssembly
Tried with:
TOML_UNRELEASED_FEATURES 1
in a test case which is one of the examples copied verbatim.TOML_EXCEPTIONS 0
in the application in which I actually wanted to use TOML.Relevant compilation flags: None that I know of
Describe the bug
I get a linking error when compiling an application to WebAssembly:
The symbol, according to c++filt is
std::__2::__itoa::__u64toa(unsigned long long, char*)
.Steps to reproduce (or a small repro code sample)
I've followed the instructions here: https://emscripten.org/docs/getting_started/downloads.html
This will get the WebAssembly compiler downloaded and in the PATH variable for easy access. I'm not a fan of this kind of installation methods, but this seems clean and safe enough. It should not leave files scattered outside the place where you cloned the repository.
Then I made a test case using the simple_parser.cpp file from tomlplusplus' examples directory, and copied the utf8_console.h file as well. I made a build using qmake, because that's what I'm familiar with (and what I'm using for the actual application where I wanted tomlplusplus), but the compiler invocation is simple enough to copy paste and reproduce the issue.
Additional information
First things first: thanks for this library!
I know that WebAssembly is fairly new. I personally don't have much experience with it. But from what I see, there is no reason why most library code like TOML++ should not work out of the box on WebAssembly. The compiler (if I understood correctly) is a sort of LLVM/Clang branch, so if it works in one, it should work on the other. For my application I needed to do minimal changes to account for the use of threads or files.
Since the missing symbol is in the standard library, it might be an issue in emsdk itself, so feel free to point me there if you are confident that this is the problem. But I would be very grateful if you could point me where in TOML++ this symbol might be used directly or indirectly, as I'm quite lost in the code. :) I suppose it comes from some stream that tries to convert an unsigned long long to text. But I tried making a simpler test case fail, and I can't (it links well in that case).
Thank you again!
The text was updated successfully, but these errors were encountered: