Opened 3 years ago

Last modified 2 years ago

#18611 new enhancement

Support GO language (as gccgo and libgo) in toolchain

Reported by: evgenyz Owned by: developers
Priority: normal Milestone:
Component: toolchain Version: Trunk
Keywords: Cc: geertjohan.riemer@…, cyrus@…


There are patches:

Status is unknown for almost half a year, so I'm creating ticket for tracking purposes. Please clarify if any assistance needed in applying this patch set.

Attachments (0)

Change History (8)

comment:1 Changed 3 years ago by cyrus

I tried to compile with that patch enabled under Debian testing, unfortunately it failed.

make[6]: Entering directory '/home/steven/workspace/openwrt/build_dir/toolchain-mips_34kc_gcc-4.9-linaro_musl-1.1.5/gcc-linaro-4.9-2014.10-final/gcc'
x86_64-linux-gnu-gcc   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H  -o go1 \
      go/ast-dump.o go/dataflow.o go/export.o go/expressions.o go/go-backend.o go/go-dump.o go/go-gcc.o go/go-lang.o go/go-linemap.o go/go-optimize.o go/go.o go/gogo-tree.o go/gogo.o go/import.o go/import-archive.o go/lex.o go/parse.o go/runtime.o go/statements.o go/types.o go/unsafe.o attribs.o libbackend.a main.o  libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a   ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -lstdc++  -L/home/steven/workspace/openwrt/staging_dir/host/lib -L/home/steven/workspace/openwrt/staging_dir/host/lib -L/home/steven/workspace/openwrt/staging_dir/host/lib -lmpc -lmpfr -lgmp -rdynamic -ldl -lstdc++ -L../zlib -lz
/usr/bin/ld: go/export.o: undefined reference to symbol 'ceilf@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/ error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
/home/steven/workspace/openwrt/build_dir/toolchain-mips_34kc_gcc-4.9-linaro_musl-1.1.5/gcc-linaro-4.9-2014.10/gcc/go/ recipe for target 'go1' failed
make[6]: *** [go1] Error 1
Last edited 3 years ago by cyrus (previous) (diff)

comment:2 Changed 3 years ago by cyrus

  • Cc cyrus@… added

comment:3 Changed 3 years ago by evgenyz

It looks like during cross-compilation for MIPS gcc tries to use local (i.e. host) ld and libm for linking. It's pretty strange that bug pops up only in relation with go.

I have no problems building trunk with these patches for MIPS and x86 on Mint 17.1.

comment:4 Changed 3 years ago by geertjohan.riemer@…

Patchwork seems to be down?
The patch can be found here:

comment:5 Changed 3 years ago by jdubjdub

Hi all,

I'm refreshing Geert-Johan's patches for the latest OpenWrt, and hoping to get them in.

Here's what I've hit so far:

  • The error above, but if you look closely, it's not a cross-compilation run, it's local (to build go1, which is one of the bootstrapping stages). Turns out there's just a -lm missing. Not sure where to put that in yet, but I'll poke around.
  • After that, I get the dreaded implicit declaration of function 'setcontext' (and getcontext, makecontext) errors. For now, I've just commented out -Werror in the Makefile to see what happens at run time. It may explode, but from the looks of it, uClibc has the legacy functions built in.

The good news is that it completes building after that. I'll do a run time test and report back.

(Oh, I should note that I'm building against uClibc, which will surely be more attractive to OpenWrt users.)

Last edited 3 years ago by jdubjdub (previous) (diff)

comment:6 Changed 3 years ago by jdubjdub

There is practically nothing useful around about the missing -lm issue, but I came up with a patch that works well enough.

Aaaaaand, boom, lots of good stuff:

I'll post as patches to the mailing list, too.

comment:7 Changed 3 years ago by GeertJohan

Hey jdubjdub,

Thanks for picking this up. I hope you'll be able to get the patches merged!


comment:8 Changed 2 years ago by miao1007@…

in gcc/Makefile

find GMPLIBS and add "-lm" flag fixed.

Add Comment

Modify Ticket

as new .

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.