Ian Lance Taylor <i...@golang.org> writes: > On Thu, Jan 15, 2015 at 8:30 AM, Rainer Orth > <r...@cebitec.uni-bielefeld.de> wrote: >> >> Apart from that, bootstrap fails in gotools: due to the use of >> -static-libgo, all commands there fail to link since the socket >> functions are missing. It seems like $LIBS from libgo needs to be added >> somewhere, but I'm unsure how best to handle this. To make any progress >> at all, I've just manually added -lsocket -lnsl to gotools/Makefile >> (AM_LDFLAGS). > > I also don't know what the best way is to handle this. For now I've > just added a configure test to check whether the libraries are needed. > Based on the libgo build, as far as I can tell, no other libraries > should be needed.
While this is true for Solaris 11, Solaris 10 needs librt for nanosleep, sched_yield and the sem_* functions. The following patch copies the corresponding libgo test and allows gotools to build even on Solaris 10. Rainer
diff --git a/gotools/Makefile.am b/gotools/Makefile.am --- a/gotools/Makefile.am +++ b/gotools/Makefile.am @@ -108,11 +108,11 @@ bin_PROGRAMS = go$(EXEEXT) gofmt$(EXEEXT libexecsub_PROGRAMS = cgo$(EXEEXT) go$(EXEEXT): $(go_cmd_go_files) zdefaultcc.go $(LIBGODEP) - $(GOLINK) $(go_cmd_go_files) zdefaultcc.go $(NET_LIBS) + $(GOLINK) $(go_cmd_go_files) zdefaultcc.go $(LIBS) $(NET_LIBS) gofmt$(EXEEXT): $(go_cmd_gofmt_files) $(LIBGODEP) - $(GOLINK) $(go_cmd_gofmt_files) $(NET_LIBS) + $(GOLINK) $(go_cmd_gofmt_files) $(LIBS) $(NET_LIBS) cgo$(EXEEXT): $(go_cmd_cgo_files) zdefaultcc.go $(LIBGODEP) - $(GOLINK) $(go_cmd_cgo_files) zdefaultcc.go $(NET_LIBS) + $(GOLINK) $(go_cmd_cgo_files) zdefaultcc.go $(LIBS) $(NET_LIBS) else diff --git a/gotools/configure.ac b/gotools/configure.ac --- a/gotools/configure.ac +++ b/gotools/configure.ac @@ -79,6 +79,10 @@ AC_CACHE_CHECK([for socket libraries], g NET_LIBS="$gotools_cv_lib_sockets" AC_SUBST(NET_LIBS) +dnl Test if -lrt is required for sched_yield and/or nanosleep. +AC_SEARCH_LIBS([sched_yield], [rt]) +AC_SEARCH_LIBS([nanosleep], [rt]) + AC_CONFIG_FILES(Makefile) AC_OUTPUT
-- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University