-
Notifications
You must be signed in to change notification settings - Fork 39
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
Emscripten compilation runs into undeclared Tm
when importing std/times
#1243
Comments
The Currently, the
If you want to use the |
Okay. For what I've currently got |
Similarly, things fail when the Error:
So I'm starting to wonder if we should have a larger discussion around wasm support because I think there's going to be a lot of stuff like this and I think we should get on the same page as to how much work it's going to be (both initial implementation and for maintenance). Of course, I'm willing to contribute but it would still require some efforts from the core team to guide me and review PRs, etc. So it may be worth estimating how much labor that would be. |
In order to have a productive discussion I think the first bit would be to gather/summarize what's provided/required in a wasm environment, as opposed to something like wasi or whatever distinctions that might exist, at which point we can figure out what sort of approach to take. Generally speak reviews and some guidance aren't an issue. There are two things that become costly:
In some ways the above are the same thing, the first more theory and docs, while the second is more practice and code. |
To be clear, I think wasi would be the best option. The specification appears to be evolving, but it's the best option for something like stability. And there's a browser shim available. Mostly what I'm thinking is just incrementally fixing modules so that nimskull can output code that emscripten can turn into wasi. The extent of my understanding right now is that there are some modules in the standard library that cause the compiler to error when attempting to compile nim->c with the flags that would make the c consumable by emscripten. And all I can speak to at the moment is the situation on macos. It may be better or worse on windows or linux. Providing functionality that emscripten already provides is a non-goal. One potential mismatch is that emscripten seems to like when nimskull compiles with
At the moment, I seem to be the only one with much interest. So I wouldn't think anybody from the core team would need to push this effort or champion it to the point of adding features/extending coverage. I know the core team is prioritizing correctness and simplicity at the moment, and I don't won't to undermine that.
I don't know much about what the nimskull testing approach looks like, yet. So from my perspective, this feels like the biggest effort and possible the area where I will need to most guidance to make sure that the test harness is something that fits into the general workflow. What I don't want to do is start bringing in PRs and adding to the core team's maintenance burden. I don't have the bandwidth to go whole hog, but I'd like to incrementally fix modules as I need them and make sure there's a test harness in place to make it easy-ish to maintain. But I don't want this to become something the core team has to continually work around if I'm no longer able to contribute in 3 months or something. |
Reading over what you wrote, @theSherwood here are a few things I noticed, which are basically what I identified in my previous message, just restated:
I think both these things need to be sorted out in order for any significant changes to stdlib, and possibly codegen. |
FWIW, my current thinking is:
|
Could you tell me more about what you mean about the differences between My understanding is that the only When you talk about a Another thing to consider is Edit: spelling and punctuation |
The defines are for the stdlib, these are compile time errors, not compiler errors. Anyhow, if this stuff is ambiguous that raises core dev workload because now we need to know lots of intricacies in order to reason about whether a define is ambiguous/sloppy or whether it's sensible.
All the above is stuff you should research and summarize, so we have a map we can discuss, but if I, or another compiler dev, are doing that, then we're back to the significantly increased workload. |
After discussing further with @zerbina here in matrix, a revised approach:
|
Sounds like a good plan. Thanks @saem . I'll start taking a look at testament sometime next week |
So, to me it sounds like there is:
Notably, the compiler called |
When compiling to wasm with emscripten, we get undeclared
Tm
when importingstd/times
. My understanding is that it should only be defined for Windows targets. This compilation error also happens when attempting to compile unit tests. I'm guessing there's a dependency there.Example
The necessary nim code at
code.nim
:This is the partial build script. You will need to supply paths to Emscripten, Nim, and to
nimbase.h
for linking purposes.Actual Output
Expected Output
Expected a successful build.
Possible Solution
Additional Information
References
The text was updated successfully, but these errors were encountered: