Closed Patrick0308 closed 7 months ago
Well this led me down a rather deep rabbit hole to improve CGo compatibility: https://github.com/tinygo-org/tinygo/pull/3927
I'll look at the actual bug next.
Here is a fix: https://github.com/tinygo-org/tinygo/pull/3928
Reopening and tagging to close on next release.
I build dev branch on my own computer. I tested
package main
/*
#include "stdbool.h"
bool test() {
return true;
}
*/
import "C"
import "fmt"
func main() {
fmt.Printf("%s", C._Bool(C.test()))
}
It's ok.
However I tested https://github.com/fermyon/spin/pull/1794 example but building painc. The error log is
Building component tinygo-mysql with `/Users/patrick/projects/tinygo/build/tinygo build -target=wasi -gc=leaking -o main.wasm main.go`
# github.com/fermyon/spin/sdk/go/mysql
../../../tinygo/llvm-project/clang/lib/Headers/stdbool.h:20:14: undefined: C._Bool
Error: Build command for component tinygo-mysql failed with status Exited(1)
Is it another issue?
@aykevl Any idea?
@Patrick0308 my guess is that they're shipping their own TinyGo variant, that is still the latest release (and not the dev branch).
Environment:
tinygo version: 0.30.0 operating System: macOS architecture: aarch64
Description:
Compilation brakes with an undefined C._Bool
Steps to reproduce:
Given the following Go-code:
Run
tinygo run main.go
Expected behavior:
Actual behavior: