veandco / go-sdl2

SDL2 binding for Go
https://godoc.org/github.com/veandco/go-sdl2
BSD 3-Clause "New" or "Revised" License
2.18k stars 219 forks source link

"undefined reference" #449

Closed deveshd020 closed 4 years ago

deveshd020 commented 4 years ago

when i do, go get -v github.com/veandco/go-sdl2/{sdl,img,mix,ttf}

/tmp/go-build182250740/b001/_x038.o: In function _cgo_16a2af4b4be1_Cfunc_SDL_ShowSimpleMessageBox': /tmp/go-build/cgo-gcc-prolog:1198: undefined reference toSDL_ShowSimpleMessageBox' /tmp/go-build182250740/b001/_x038.o: In function _cgo_16a2af4b4be1_Cfunc_SDL_ShowWindow': /tmp/go-build/cgo-gcc-prolog:1213: undefined reference toSDL_ShowWindow' /tmp/go-build182250740/b001/_x038.o: In function _cgo_16a2af4b4be1_Cfunc_SDL_UpdateWindowSurface': /tmp/go-build/cgo-gcc-prolog:1228: undefined reference toSDL_UpdateWindowSurface'

golang_projects/src/github.com/veandco/go-sdl2/sdl/events.c:18: undefined reference to SDL_FilterEvents' /tmp/go-build182250740/b001/_x040.o: In functionaddEventWatch': golang_projects/src/github.com/veandco/go-sdl2/sdl/events.c:23: undefined reference to SDL_AddEventWatch' /tmp/go-build182250740/b001/_x040.o: In functiondelEventWatch': golang_projects/src/github.com/veandco/go-sdl2/sdl/events.c:28: undefined reference to SDL_DelEventWatch' /tmp/go-build182250740/b001/_x040.o: In functionPollEvent': golang_projects/src/github.com/veandco/go-sdl2/sdl/events.c:33: undefined reference to SDL_PollEvent' /tmp/go-build182250740/b001/_x041.o: In functionaddHintCallback': golang_projects/src/github.com/veandco/go-sdl2/sdl/hints.c:13: undefined reference to SDL_AddHintCallback' /tmp/go-build182250740/b001/_x041.o: In functiondelHintCallback': golang_projects/src/github.com/veandco/go-sdl2/sdl/hints.c:18: undefined reference to SDL_DelHintCallback' /tmp/go-build182250740/b001/_x042.o: In functionLogSetOutputFunction': golang_projects/src/github.com/veandco/go-sdl2/sdl/log.c:5: undefined reference to `SDL_LogSetOutputFunction' collect2: error: ld returned 1 exit status

I'm getting undefined reference to....issue... my go env: GOARCH="386" GOBIN="" GOCACHE="/home/deveshd020/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="386" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/deveshd020/golang_projects" GOPROXY="" GORACE="" GOROOT="/usr/local/go" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_386" GCCGO="/usr/bin/gccgo" GO386="sse2" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build180285164=/tmp/go-build -gno-record-gcc-switches"

veeableful commented 4 years ago

Hi @deveshd020, did you install SDL2 and its additional libraries (such as SDL2_image,SDL2_mixerandSDL2_ttf`)? Which Linux distribution are you running this on?

deveshd020 commented 4 years ago

Hi @deveshd020, did you install SDL2 and its additional libraries (such as SDL2_image,SDL2_mixerandSDL2_ttf`)? Which Linux distribution are you running this on?

i m using ubuntu 18.04.0, and had installed : libsdl2{,-image,-mixer,-ttf,-gfx}-dev.

veeableful commented 4 years ago

Hi @deveshd020, what kind of device are you running this on? I noticed that you are running on a 32-bit version of Ubuntu. How did you get Ubuntu 18.04 32-bit version? The issue doesn't occur to me even when I set GOARCH to 386 and there is no 32-bit version of Ubuntu 18.04 on the official website as far as I can tell. Any additional information would be helpful as well!