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

"Undefined reference to" errors when compiling basic_window example on Ubuntu 22.04 #7

Open
TCroasdale opened this issue Sep 2, 2023 · 2 comments

Comments

@TCroasdale
Copy link

Output of go build or go run

# basic_window
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfBlendAlpha_get_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0xc9d): undefined reference to `sfBlendAlpha'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfBlendAdd_get_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0xced): undefined reference to `sfBlendAdd'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfBlendMultiply_get_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0xd3d): undefined reference to `sfBlendMultiply'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfBlendNone_get_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0xd8d): undefined reference to `sfBlendNone'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfBlack_set_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x1d70): undefined reference to `sfBlack'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfBlack_get_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x1da5): undefined reference to `sfBlack'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfWhite_set_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x1dee): undefined reference to `sfWhite'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfWhite_get_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x1e23): undefined reference to `sfWhite'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfRed_set_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x1e6c): undefined reference to `sfRed'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfRed_get_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x1ea1): undefined reference to `sfRed'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfGreen_set_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x1eea): undefined reference to `sfGreen'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfGreen_get_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x1f1f): undefined reference to `sfGreen'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfBlue_set_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x1f68): undefined reference to `sfBlue'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfBlue_get_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x1f9d): undefined reference to `sfBlue'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfYellow_set_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x1fe6): undefined reference to `sfYellow'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfYellow_get_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x201b): undefined reference to `sfYellow'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfMagenta_set_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x2064): undefined reference to `sfMagenta'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfMagenta_get_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x2099): undefined reference to `sfMagenta'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfCyan_set_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x20e2): undefined reference to `sfCyan'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfCyan_get_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x2117): undefined reference to `sfCyan'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfTransparent_set_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x2160): undefined reference to `sfTransparent'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfTransparent_get_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0x2195): undefined reference to `sfTransparent'
/usr/bin/ld: /tmp/go-link-1656247100/000002.o: in function `_wrap_sfTransform_Identity_get_graphics_0e245b41439e98a6':
Graphics_wrap.c:(.text+0xd528): undefined reference to `sfTransform_Identity'
collect2: error: ld returned 1 exit status

output of go env

GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/tomcroasdale/.cache/go-build"
GOENV="/home/tomcroasdale/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/tomcroasdale/go/pkg/mod"
GONOPROXY="github.com/Gigfinder-io/*"
GONOSUMDB="github.com/Gigfinder-io/*"
GOOS="linux"
GOPATH="/home/tomcroasdale/go"
GOPRIVATE="github.com/Gigfinder-io/*"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.7"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/tomcroasdale/go-sfml/examples/basic_window/go.mod"
GOWORK=""
CGO_CFLAGS="-I/home/tomcroasdale/SFML/2.5.1/include -w"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-L/home/tomcroasdale/SFML/2.5.1/lib/gcc"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1250995538=/tmp/go-build -gno-record-gcc-switches"
@propah
Copy link

propah commented Nov 4, 2023

I have the exact same issue. I'm running "Ubuntu 20.04.6 LTS" on WSL2 and my go env looks like yours, without the "-w" in the CGO_CFLAGS. Could anyone with a working setup on ubuntu paste its go env here?

@Telroshan
Copy link
Owner

Hey! Sorry for the late reply
So I'm a complete noob when it comes to compiling & running stuff on linux, I already had such a hard time bringing that README together lmao

Could you explain to me how you set up your SFML on Ubuntu? On Windows you just have to extract that CSFML archive and there you have the lib files, but it doesn't seem to be that easy here😅 I can't seem to manage to get that lib/gcc folder, I guess I must be missing something obvious? I ran make both in CSML and SFML folders, don't know what else I should do.
I'm really a slow learner on this so please go easy on me 😬

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

3 participants