tinygo-org / tinygba

Tools and helpers for developing GBA programs using TinyGo.
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
17 stars 0 forks source link

Error during go get tinygo.org/x/tinygba #2

Open scraly opened 8 months ago

scraly commented 8 months ago

Hi,

I've tried to use this repo in order to create some GBA apps/games and I have an error:

$ go get tinygo.org/x/tinygba
go: tinygo.org/x/tinygba imports
        device/gba: package device/gba is not in std (/home/gitpod/go/src/device/gba)
go: tinygo.org/x/tinygba imports
        machine: package machine is not in std (/home/gitpod/go/src/machine)

Can you help me about it?

thanks

deadprogram commented 8 months ago

@scraly both of those packages are part of the tinygo-specific packages. Perhaps your tinygo env is not set correctly?

scraly commented 8 months ago

I am in a new environment, with go 1.21.

in my memories you fixed 7 month ago the go.mod because device/gba where in a dev branch, isn't it?

So I think the go.mod file of ths repo need to be updated.

image

WDYT?

deadprogram commented 8 months ago

what is the output when you run this command?

tinygo env
scraly commented 8 months ago

Here is the output:

$ tinygo env
GOOS="linux"
GOARCH="amd64"
GOROOT="/home/gitpod/go"
GOPATH="/workspace/go"
GOCACHE="/home/gitpod/.cache/tinygo"
CGO_ENABLED="1"
TINYGOROOT="/home/linuxbrew/.linuxbrew/Cellar/tinygo/0.30.0"
deadprogram commented 8 months ago

Last question, hopefully:

which tinygo
scraly commented 8 months ago
 $ which tinygo
/home/linuxbrew/.linuxbrew/bin/tinygo

And I just tested in another machine, same problem:

$ go version
go version go1.21.5 darwin/arm64

$ tinygo version
tinygo version 0.30.0 darwin/amd64 (using go version go1.21.5 and LLVM version 16.0.1)

$ tinygo env
GOOS="darwin"
GOARCH="amd64"
GOROOT="/Users/avache/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.21.5.darwin-arm64"
GOPATH="/Users/avache/go"
GOCACHE="/Users/avache/Library/Caches/tinygo"
CGO_ENABLED="1"
TINYGOROOT="/Users/avache/homebrew/Cellar/tinygo/0.30.0"

$ which tinygo
/Users/avache/homebrew/bin/tinygo

$ tinygo run -target=gameboy-advance gopher.go
go: downloading tinygo.org/x/tinyfont v0.4.0
go: downloading tinygo.org/x/drivers v0.25.0
gopher.go:13:2: no required module provides package tinygo.org/x/tinygba; to add it:
    go get tinygo.org/x/tinygba

$ go get tinygo.org/x/tinygba
go: downloading tinygo.org/x/tinygba v0.0.0-20231205145444-0d73574106af
go: tinygo.org/x/tinygba imports
    device/gba: package device/gba is not in std (/Users/avache/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.21.5.darwin-arm64/src/device/gba)
go: tinygo.org/x/tinygba imports
    machine: package machine is not in std (/Users/avache/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.21.5.darwin-arm64/src/machine)
JuanHeza commented 6 months ago

i have the same problem :(

tinygo env GOOS="windows" GOARCH="amd64" GOROOT="C:\Program Files\Go\" GOPATH="D:\DevDog\Go" GOCACHE="C:\Users\juane\AppData\Local\tinygo" CGO_ENABLED="1" TINYGOROOT="C:\Users\juane\scoop\apps\tinygo\current"

go get tinygo.org/x/tinygba go: downloading tinygo.org/x/tinygba v0.0.0-20231205145444-0d73574106af go: tinygo.org/x/tinygba imports device/gba: package device/gba is not in std (C:\Program Files\Go\src\device\gba) go: tinygo.org/x/tinygba imports machine: package machine is not in std (C:\Program Files\Go\src\machine)

scraly commented 6 months ago

my solution was to set in my environment that I am using go modules (instead of asking go to pull dependencies in a vendor folder):

$ GOFLAGS=-mod=mod tinygo build -o myapp.gba -target=gameboy-advance main.go
JuanHeza commented 6 months ago

Thank you, it worked 😸