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

static build in raspberry #394

Open
fopina opened this issue Mar 14, 2019 · 5 comments
Open

static build in raspberry #394

fopina opened this issue Mar 14, 2019 · 5 comments
Labels
build This issues describes a compilation problem

Comments

@fopina
Copy link

fopina commented Mar 14, 2019

I was trying to avoid opening an issue but I saw that the linux arm flags were added with a commit message saying Android and RPi specifically so I'd like to know what I'm doing wrong...

# uname -a
Linux retropie 4.14.30-v7+ #1102 SMP Mon Mar 26 16:45:49 BST 2018 armv7l GNU/Linux
# cat /etc/*release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
# go version
go version go1.7.4 linux/arm
# make bubbles
go build -tags static -ldflags "-s -w" -o bubbles
# github.com/veandco/go-sdl2/sdl
/usr/bin/ld: cannot find -liconv
collect2: error: ld returned 1 exit status

After removing -liconv from *_cgo_static files I get

...
(.text+0x244): undefined reference to `libiconv_close'
...

As functions in libc (replacement of libiconv) are now called iconv_close only...
How was that static library compiled? How did a libiconv get into that raspbian or was it done in arch (as that one seems to have a libiconv)?

After download libiconv tarball, compiling and installing it, I re-added -liconv to the flags and retried but

/tmp/go-build824492053/github.com/veandco/go-sdl2/sdl/_obj/_cgo_main.o:(.data.rel+0x0): undefined reference to `SDL_STANDARD_GRAVITY'
collect2: error: ld returned 1 exit status
@fopina
Copy link
Author

fopina commented Mar 14, 2019

Actually, just tried with a docker image of arch linux (for RPi, nice exercise in case anyone interested) and even arch does not bring libiconv. After installing it though, we do get it as dependency as it is not statically linked in the binary so we end up with a static binary that won't run in neither of these RPi distros..

@gen2brain
Copy link
Collaborator

All static libraries are cross-compiled on Gentoo (except for darwin). I have prepared different libraries for arm now, one for generic arm (GLES), one for RPi video driver and one for vivante, those will be available via tags, i.e. -tags rpi and default will be generic.

Not sure how what currently is in the repo is built, I removed recently all old toolchains I had, but this change, I want to push should fix the issue you have. Will push the change when I find the time, there is not too much work left but I am very busy currently.

@fopina
Copy link
Author

fopina commented Mar 14, 2019

Awesome news! If you care to share just the rpi lib adhoc somehow (if it’s already built), I’d give it a go in my setup :)

@gen2brain
Copy link
Collaborator

You can try with these, just rename them appropriately and I am not sure if any change is needed in SDL_config.h.

http://185.177.59.7/tmp/libs-arm.tar.gz
http://185.177.59.7/tmp/libs-rpi.tar.gz

@fopina
Copy link
Author

fopina commented Mar 15, 2019

Thanks for the quick share! There's something strange with the headers indeed as it keeps complaining about SDL_GRAVITY constant (which exists in the repo headers but not in libsdl installed in my raspberry). Replacing it yields other constants missing. And as I also need the gfx, I'll just wait for your release then, in the meantime I'll use dynamic linking :)

Thanks!

@veeableful veeableful added the build This issues describes a compilation problem label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build This issues describes a compilation problem
Projects
None yet
Development

No branches or pull requests

3 participants