Progress: I assumed that I could use so I jumped to https://github.com/golang/go/wiki/GccgoCrossCompilation#symlink and followed those instructions. I then compiled with gcc, gccgo, and ar all symlinked to a place in my $PATH that occurs before the non-mips gcc etc programs.
After compiling by running $ gccgo -Wall -o hello-sym hello.go -static-libgo then running *hello-sym* on the target system, I get this error: *can't load library 'libgo.so.7'* Helpfully, in it says that I can compile the binary statically "by adding the *-static* switch to gccgo". Perfect! So then I compiled with $ gccgo -Wall -o hello-sym-static hello.go -static-libgo -static scp'd the resulting *hello-sym-static* binary to the target machine, and run it. The result? $ ./hello-sym-static Segmentation fault Any idea what could be causing the segfault? (hello.go is a trivial "Hello, world!" program.) On the target (mips) device, I see files like /lib/libuClibc-0.9.33.2.so, with /lib/libc.so.0 being a symlink to /lib/libuClibc-0.9.33.2.so, in case that's relevant. Thanks! --Steve On Friday, February 10, 2017 at 7:58:58 PM UTC-8, Steve Phillips wrote: > > I should add that my target device's kernel doesn't have FPU (floating > point) emulation, nor does it have a hardware FPU, and I therefore can't > just use go1.8r3's easy-to-use mips support; already tried it. > > --Steve > > > On Friday, February 10, 2017 at 7:56:40 PM UTC-8, Steve Phillips wrote: >> >> > Yes, crosscompiling to mips with gccgo has worked for a while. >> >> I'm having trouble getting this to work. I got gccgo-mips-linux-gnu to >> produce binaries, but the target machine doesn't have the right shared >> libraries to run them; I get *"can't load library 'libm.so.6'"* when >> trying to execute the built binary (here's that thread >> <https://github.com/golang/go/issues/18942>). >> >> In another thread I saw Dave Cheney tell people to cp -r $GOROOT to >> another place (call it ~/xgo), touch all the files in ~/xgo/src, make sure >> GOROOT isn't set, then run the following: >> >> $ go build -o xgo -compiler gccgo -x cmd/go >> >> This isn't producing a *xgo* binary at all. Also, running >> >> $ GOOS=linux GOARCH=mips go build -o xgo -compiler gccgo -x cmd/go >> >> also generates no *xgo *binary. >> >> Third attempt: https://github.com/golang/go/wiki/GccgoCrossCompilation >> makes it sounds like I should use crosstool-ng to build a version of GCC >> for my target architecture (mips), but can't I just use gccgo-mips-linux-gnu >> somehow? >> >> Some of these instructions are from 2 years ago, so at this point I don't >> know what will work now, in 2017. >> >> Any help would be great! Thanks. >> >> --Steve >> >> >> On Thursday, May 21, 2015 at 12:53:38 AM UTC-7, andrewc...@gmail.com >> wrote: >>> >>> Yes, crosscompiling to mips with gccgo has worked for a while. There are >>> issues with cross compiling and the bundled go tool. If you know how, you >>> can work around it. >>> >>> On Thursday, May 21, 2015 at 7:43:22 PM UTC+12, Ganbold Tsagaankhuu >>> wrote: >>>> >>>> >>>> >>>> On Thu, May 21, 2015 at 12:03 PM, <andrewc...@gmail.com> wrote: >>>> >>>>> Ok, Just confirming this, I will work on a patch that makes cross >>>>> compiling work, and make the GOARCH default to whatever gcc was built for. >>>>> >>>> >>>> Nice. So if gcc 5.x can be cross compiled for mips then for now maybe >>>> it is better for me just to try to cross compile gcc on Linux and then try >>>> to compile Go program for mips platform. >>>> >>>> Ganbold >>>> >>>> >>>> >>>>> >>>>> >>>>> On Thursday, May 21, 2015 at 2:21:57 PM UTC+12, andrewc...@gmail.com >>>>> wrote: >>>>>> >>>>>> Ok, I think I found a bug in the build scripts. >>>>>> >>>>>> This check is wrong imo. >>>>>> >>>>>> https://github.com/gcc-mirror/gcc/blob/gcc-5_1_0-release/gotools/configure.ac#L49 >>>>>> >>>>>> This doesn't currently make sense, NATIVE is always true. We aren't >>>>>> cross compiling the compiler itself. >>>>>> >>>>>> https://github.com/gcc-mirror/gcc/blob/gcc-5_1_0-release/gotools/Makefile.am#L31 >>>>>> >>>>>> >>>>>> And I think we should implement this: >>>>>> >>>>>> https://github.com/gcc-mirror/gcc/blob/gcc-5_1_0-release/gotools/Makefile.am#L128 >>>>>> >>>>>> Should I make a thread on golang-dev for this? I think we could make >>>>>> cross compiling using gccgo pretty nice which means people will use >>>>>> gccgo >>>>>> for most embedded things. >>>>>> With this I can get gccgo added to crosstool-ng, openwrt and >>>>>> buildroot I think. >>>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "golang-nuts" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to golang-nuts...@googlegroups.com. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.