diff --git a/package/go/Config.in.host b/package/go/Config.in.host index 92c1f4cdc3..11ce6df369 100644 --- a/package/go/Config.in.host +++ b/package/go/Config.in.host @@ -25,6 +25,10 @@ config BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS # Go doesn't support CGO linking on MIPS64x platforms # See: https://github.com/karalabe/xgo/issues/46 depends on !BR2_mips64 && !BR2_mips64el + # go uses dlfcn.h + cgo for its plugin module + depends on !BR2_STATIC_LIBS + # cgo supports uses threads + depends on BR2_TOOLCHAIN_HAS_THREADS # Host go packages should depend on BR2_PACKAGE_HOST_GO_HOST_ARCH_SUPPORTS config BR2_PACKAGE_HOST_GO_HOST_ARCH_SUPPORTS diff --git a/package/go/go.mk b/package/go/go.mk index bfbe997911..660c7a9bad 100644 --- a/package/go/go.mk +++ b/package/go/go.mk @@ -78,23 +78,24 @@ HOST_GO_TARGET_ENV = \ CGO_LDFLAGS="$(TARGET_LDFLAGS)" \ GOTOOLDIR="$(HOST_GO_TOOLDIR)" -# The go compiler's cgo support uses threads. If BR2_TOOLCHAIN_HAS_THREADS is -# set, build in cgo support for any go programs that may need it. Note that -# any target package needing cgo support must include -# 'depends on BR2_TOOLCHAIN_HAS_THREADS' in its config file. -ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y) +# Allow packages to use cgo support if it is available for the target. They +# will need the toolchain for cgo support; for convenence, include that +# dependency here. +# +# Note that any target package needing cgo support must include 'depends on +# BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS' in its config file. +ifeq ($(BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS),y) HOST_GO_DEPENDENCIES_CGO += toolchain HOST_GO_CGO_ENABLED = 1 else HOST_GO_CGO_ENABLED = 0 endif - else # !BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS -# host-go can still be used to build packages for the host. No need to set all -# the arch stuff since we will not be cross-compiling. +# If the target arch does not support go, host-go can still be used to build +# packages for the host, and enable cgo. No need to set all the arch stuff +#since we will not be cross-compiling. HOST_GO_CGO_ENABLED = 1 endif # BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS - # Ensure the toolchain is available, whatever the provider HOST_GO_DEPENDENCIES += $(HOST_GO_DEPENDENCIES_CGO)