wxGo icon indicating copy to clipboard operation
wxGo copied to clipboard

Build for ARM (e.g. Raspberry PI )

Open dtrehas opened this issue 9 years ago • 6 comments
trafficstars

Dear Sir,

Your work is amazing.

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

Thank you in advance.

dtrehas avatar Aug 31 '16 17:08 dtrehas

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.

dontpanic92 avatar Sep 01 '16 03:09 dontpanic92

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

neonsoftware avatar Oct 27 '16 12:10 neonsoftware

@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.

dontpanic92 avatar Oct 28 '16 12:10 dontpanic92

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

neonsoftware avatar Oct 28 '16 14:10 neonsoftware

@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 avatar Oct 28 '16 16:10 neonsoftware

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

neonsoftware avatar Nov 11 '16 13:11 neonsoftware