Skip to content
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

Error during compilation #4545

Open
lasarocamargos opened this issue Oct 25, 2024 · 4 comments
Open

Error during compilation #4545

lasarocamargos opened this issue Oct 25, 2024 · 4 comments

Comments

@lasarocamargos
Copy link

lasarocamargos commented Oct 25, 2024

Opened an issue against the llvm-project (llvm/llvm-project#113672), but opening it here as well for awareness.
The error seems to happen when I import this project "github.com/tidwall/btree"

Please close if not appropriate

@aykevl
Copy link
Member

aykevl commented Oct 25, 2024

I cannot reproduce this issue.

Please provide a full reproducer that shows this problem. Ideally a small but complete code sample (including go.mod and go.sum). Also please share the output of tinygo version.

@lasarocamargos
Copy link
Author

lasarocamargos commented Oct 25, 2024

Sorry for the cryptic report. Here are the needed info.

The btree.Set example in https://github.com/tidwall/btree?tab=readme-ov-file#example is a repro, that is, this code

package main

import (
	"fmt"
	"github.com/tidwall/btree"
)

func main() {
	// create a map
	var users btree.Map[string, string]

	// add some users
	users.Set("user:4", "Andrea")
	users.Set("user:6", "Andy")
	users.Set("user:2", "Andy")
	users.Set("user:1", "Jane")
	users.Set("user:5", "Janet")
	users.Set("user:3", "Steve")

	// Iterate over the maps and print each user
	users.Scan(func(key, value string) bool {
		fmt.Printf("%s %s\n", key, value)
		return true
	})
	fmt.Printf("\n")

	// Delete a couple
	users.Delete("user:5")
	users.Delete("user:1")

	// print the map again
	users.Scan(func(key, value string) bool {
		fmt.Printf("%s %s\n", key, value)
		return true
	})
	fmt.Printf("\n")

	// Output:
	// user:1 Jane
	// user:2 Andy
	// user:3 Steve
	// user:4 Andrea
	// user:5 Janet
	// user:6 Andy
	//
	// user:2 Andy
	// user:3 Steve
	// user:4 Andrea
	// user:6 Andy
}

Compiled it with tinygo build -target wasi -o test.wasm

tinygo version 0.33.0 linux/arm64 (using go version go1.22.2 and LLVM version 18.1.3)

go.sum

github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI=
github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY=

go.mod

module test

go 1.22.2

require github.com/tidwall/btree v1.7.0

@aykevl
Copy link
Member

aykevl commented Oct 25, 2024

Unfortunately I still cannot reproduce this issue. This is with tinygo version 0.33.0 linux/arm64 (using go version go1.22.2 and LLVM version 18.1.2) so very similar to yours.

Can you tell me:

  • which OS are you using?
  • how did you get tinygo? (Distribution package, manual build, or our own binaries?)

@lasarocamargos
Copy link
Author

Sure. I am using ubuntu 24.04.1 LTS, on a multipass VM in OSX.
Linux dev-vmc 6.8.0-47-generic #47-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 22:03:50 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux

I manually built tinygo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants