GOARCH and possibly GOOS, yes. With 6g and friends you're always
cross-compiling, in effect.
-rob
As Rob alluded to, your phone has to have a supported OS. The phone
has to support Linux, I think. So yes for Android and possibly Mameo
phones, probably not for Windows Mobile, RIM, Palm, or Apple phones.
The other thing is that you will probably have trouble with floating
point. The current versions of the ARM-architecture Go language
compiler, 5g, does not support the "softfp" EABI. It's being worked
on, but isn't there yet.
THis means that if your Go program uses floating point instructions,
it will compile, but you'll get a runtime error when your code
executes on ARM.
The reason is that Go's compilers are based on the Plan 9 C compilers,
which were written back when the ARM architecture supported a
different floating point standard than it does now. The ARM Go
compiler is still emitting code for the old no-longer-supported
floating point architecture.
As a temporary stopgap there is now code in the newest version that
skips over most (all?) float instructions in the instruction stream.
This lets you use packages like math that have static initializers
utilizing float that used to crash even if you didn't call any
explicit float instructions. The biggest benefit is probably that fmt
is now usable.
Kai
As long as Go doesn't have a problem running with a 2.6.29-rc3 kernel
then I have the OS part covered, I have a Neo FreeRunner running the
SHR distro.
This still doesn't exactly answer my question though, I know that with
Go you are always cross compiling but I want to compile for x86_64 and
ARM arch on the same machine if this is possible with Go. If this is
possible I'm sure that means switching the settings in my .bashrc and
rebuilding Go but this is fine with me, unless the GOARCH field lets
you have multiple architectures specified.
> This still doesn't exactly answer my question though, I know that with
> Go you are always cross compiling but I want to compile for x86_64 and
> ARM arch on the same machine if this is possible with Go. If this is
> possible I'm sure that means switching the settings in my .bashrc and
> rebuilding Go but this is fine with me, unless the GOARCH field lets
> you have multiple architectures specified.
You don't have to rebuild Go, but you do have to set GOARCH to the
appropriate value before invoking 6l or 5l. So you will most likely
want to use a wrapper script.
Ian
Two questions:
1) If I don't have to rebuild Go then how do I get 5l? My GOARCH is
currently set to x86_64 and I only have 6l and friends (makes sense
though 6l is for 64 bit)
2) What is meant by a wrapper script?
It's not exactly a rebuild, just a build. You can change the value of
GOARCH and build the compilers and packages for arm. This will not
harm your 6g or 8g installation, since the command names differ (5g
vs. 6g) and the package files go into directories identified by
architecture and operating system. You can have a world that works
with both.
There's work underway so you don't have to specify GOARCH for 5l, but
for now, the linker you use must be the correct one for the value of
GOARCH.
-rob
Well I think I might have ran into a problem, when building the new
release so I would also have the compiler for ARM and I got this error
during the make all
%%%% making libcgo %%%%
make[1]: Entering directory `/home/vendion/go/src/libcgo'
gcc -O2 -fPIC -o linux_arm.o -c linux_arm.c
make[1]: *** No rule to make target `arm.o', needed by `libcgo.so'.
Stop.
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/home/vendion/go/src/libcgo'
make: *** [build] Error 1
Running make for amd64 went fine with no problems though.
I ran into that problem as well but running "make-arm.bash" instead as
rsc suggested in another thread worked.
Well, everything built, but I get "Illegal instruction" whatever I try
to run so it's not much better...
Well, I'm getting that whatever small example I try, without any (that
I know of) float involved. Like this:
package main
func main() {
var d int = 3
d++
}
Kai
That did it for me, now the code runs on the machine I'm building it on.
Next step is to try and have it running on the n900 but I think I'm
missing some deps there, I'll report on that later.
Kudos to you, Kai! :-)
Cheers,
Mathieu
Cheers,
Mathieu
Kai
Cheers,
Mathieu
Kai
On Jan 26, 11:06 pm, Mathieu Lonjaret <mathieu.lonja...@gmail.com>
wrote:
Glad somebody noticed :p
It took a few patches to the makefiles to make it compile under
scratchbox so if you have any problem/improvements just ask.
Greetings