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

Build for ARM (e.g. Raspberry PI ) #4

Open
dtrehas opened this issue Aug 31, 2016 · 6 comments
Open

Build for ARM (e.g. Raspberry PI ) #4

dtrehas opened this issue Aug 31, 2016 · 6 comments

Comments

@dtrehas
Copy link

dtrehas commented Aug 31, 2016

Dear Sir,

Your work is amazing.

Do you have any idea how this could be compiled in ARM?

Thank you in advance.

@dontpanic92
Copy link
Owner

Hi dtrehas,

I'm not familiar with ARM but I think it will be hard to compile wxGo on a Raspberry PI considering its limited performance. Perhaps we can cross-compile it. However I'm not sure whether it will work, because I have no experience on cross-compiling a Go program.

@neonsoftware
Copy link

neonsoftware commented Oct 27, 2016

Hi dontpanic92,

first of all GREAT WORK 👍 thanks for sharing

Regarding cross compilation, it is quite beautiful and builtin in golang, this post from Dave Cheney shows it very well.
Basically it is mostly about playing with the variables GOOS and GOARCH.

here is a little example

# Let's say that hello.go prints "hello world". I'm on 64bit OSX
$ go build hello.go                          # compiles binary hello for my system
$ file hello                                 # checking binary type
hello: Mach-O 64-bit executable x86_64       # OK, it's mine

# now let's cross compile to linux arm
$ export GOOS=linux                          # I set 'linux as target OS' 
$ export GOARCH=arm                          # I set 'arm as target architecture'
$ go build hello.go                          # this time will cross-compile
$ file hello                                 # checking binary type
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
# arm !

Regarding this specific project, cross-compiling this library to ARM, I guess that some specific architecture-specific assets will be required for the SWIG, wxWidget toolchain to compile. (a file setup_linux_arm.go ?)

I might have time to take a look in the following weeks. In that case will post updates here.

cheers

@dontpanic92
Copy link
Owner

dontpanic92 commented Oct 28, 2016

@neonsoftware Yes, you are right. First of all we need a wxWidgets for arm, and after that the setup_linux_arm.go should contain the CPPFLAGS and LDFLAGS to make it work.

@neonsoftware
Copy link

Yep 👍 I'll grab my arm board and try to compile the static wxWidgets libraries for arm

@neonsoftware
Copy link

neonsoftware commented Oct 28, 2016

@dontpanic92 did you have to manually set the static libraries to be PIC enabled with -fPIC ?

Having that sort of error at first attempt of go get on ARM with the new libraries ...

/usr/bin/ld: ./linux_arm/lib/libwx_gtk2u_aui-3.1.a(auilib_framemanager.o): relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC

update: apparently yes, must be explicitly set, according to here and here

@neonsoftware
Copy link

been out for a week, will get back to it in the next days :bowtie:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants