neophob/ganother-world

Using go "modules"

Closed this issue · 3 comments

I'm trying to figure out the setup with go modules (with the go.mod) which should auto fetch and maintain the modules like go-sld2.

What I go so far:

  • Did the go init
  • next go build fetched and added the go-sdl to the go.mod
  • Installed a more go friendly version of pkg-config (required for cgo)

For pkg-config there's brew install pkg-config which complained about a bunch of stuff so I installed https://github.com/neophob/ganother-world/tree/module-setup:

  • go get github.com/rjeczalik/pkgconfig/cmd/pkg-config
  • Added ~/go/bin to my $PATH

Now when I run make i see this:

⟩ make
  >  BUILD
# pkg-config --cflags  -- sdl2
error $GOPATH: no library found in $GOPATH: sdl2
error github.com: PKG_CONDIF_GITHUB not exported, skipping github.com lookup
error $PKG_CONFIG_PATH: open sdl2.pc: no such file or directory
error <autogenerated>: no library found in $GOPATH: sdl2
pkg-config: exit status 1
make: *** [build] Error 2

The lib as go fetched it is in $GOPATH/pkg/mod/ (github.com/.../sdl) but I'm really puzzled as to why this doesn't work... should it find it in GOPATH? or is there some build flags missing in the Make file to work with pkg-config and go modules?

i went down the GOxxx path env settings, after wasting like 1h i gave up and moved my code too $HOME/go.

i thin a deps makefile target would make sense which does cd src && go get or similar

yea so on 1 laptop it doesn't work, check it out on another and it works...

wanna check out my branch and see if you can make?

the error you see is because a sdl2 dev lib is missing .. else the .pc file would be found