-
Notifications
You must be signed in to change notification settings - Fork 932
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
all: support Go 1.12 #211
all: support Go 1.12 #211
Conversation
414afa7
to
dfd0848
Compare
5165cf1
to
2eb6041
Compare
This PR is now in a state that tests pass for all platforms (including WebAssembly) except for microcontrollers. If needed, I can make a PR with just these changes (except for the last) so that at least the wasm target is supported with Go 1.12. |
Seems like awaiting the MCU functionality would be better to avoid having 2 versions in active release? |
Oh, no, we don't need multiple releases for that. It only means that TinyGo will still be able to produce wasm files when users have Go 1.12 installed. |
My plan for good Go 1.12 support is the following:
It looks like pretending to be wasm/js on MCUs gets too difficult. GOOS=nacl is also much more stable as it has been around for a long time now, so upgrades will need less work. We can then pretend that GOOS=nacl is the OS-less target we've wanted for a while, as I doubt anyone is still seriously interested in Chrome Native Client support. (Note: Native Client is still supported in Go as it is used in play.golang.org). |
That sounds like a very reasonable plan. As long as playground exists, then we should have a fixed target. |
Be aware that we plan to remove Go's Native Client (nacl) port soonish here. Probably in Go 1.14. We thought Go was the only user for the playground, but we want to move the playground to gvisor and then we'd have no need for it. It's an annoying maintenance burden on us to maintain for ~zero users or future. What do you want it for? Upstream tracking bug is golang/go#30439 |
@bradfitz thank you for the heads up! I was kind of afraid this would happen at some point, as GOOS=nacl is so little used.
The main target for TinyGo is bare metal systems (microcontrollers). So far, we've pretended to be GOOS=js GOARCH=wasm for these systems and added extra build tags so our runtime and machine packages know which chip it really is. For example, the BBC micro:bit uses build tags With Go 1.12, there were some changes to the Now I'm not so sure what to do. Ideally we'd like to have some non-OS or custom OS support in the stdlib. For example, we could have GOOS=posix that expects to be linked to a generic libc without making too much assumptions about the host OS except for POSIX compatibility. Or maybe make sure that the stdlib does not break with a custom GOOS (like GOOS=none) and just assumes the syscall package implements all required system calls. |
Okay, so you don't actually need to use nacl at all? You just want to use its build tags to select different files? |
Basically, yes. I just want to get stdlib packages to compile and somehow do OS calls (like syscall.Write) with the least amount of hacks. |
179c50a
to
5c4215a
Compare
2925f7f
to
f28ca87
Compare
Rebased on top of dev. Current status:
|
@bradfitz we switched towards pretending to be linux/arm on bare metal systems and overriding the syscall package to avoid an incompatibility with 16-bit uintptrs on AVR. This seems to work so far, but it's not ideal. However, I think linux/arm is less likely to change in significant ways than js/wasm. See #247 for more details. |
source code(Thu Mar 7 15:17:18 2019 +0100@46bc253)github.com/tinygo-org/tinygo/src/examples/wasm go versiongo version go1.12.1 linux/amd64 build commandGOROOT=/usr/local/go ../../../tinygo build -o wasm.wasm wasm.go build failedwasm-ld-8: error: /tmp/tinygo799621561/main.o: Unexpected metadata version: 1 (Expected: 2) |
@free1139 I don't think this is related to Go 1.12 support but to the LLVM version. I've seen this error before but I don't remember the exact cause. It was somehow related to a mismatch in LLVM version. |
Probably best to create an issue about it in the Go repo, so it can be discussed. Go 2 planning was happening a while back, so it might not be too late to get it into the minds of people working on that as well. 😄 |
It would be very useful to decouple the stdlib from the compiler/runtime, and in fact @ianlancetaylor has written about it before. See this page for more details: |
Yes, please open a Go bug with your problems/requirements. This need not be a Go 2 issue at all. |
What is the current status of this PR? Sorry, I did not determine if there was a clear resolution regarding the code in this specific PR. Thanks. |
From my POV it can be merged. That would be very useful, as it blocks some other changes. |
Passes all CI tests on both Travis and CircleCI, so appears to do what we expect. Now merging. |
@bradfitz I have opened golang/go#31330. |
Fixes #216.