Skip to contentSkip to conversation

package/pkg-golang: do not set static linking for host target

PATCH New Mirza Krak 3 participants 3 messages Jun 10, 2019 – Jun 23, 2019

lore
Share & tools
lore

Mirza Krak

author
#0 lore raw

PATCH 1/1 package/pkg-golang: do not set static linking for host target

The current logic will set the "-static" flag when building go host packages if BR2_STATIC_LIBS is set, this will not work as there is no support to link host packages statically.

Fix this by applying this logic only for target builds.

---

 package/pkg-golang.mk | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
package/pkg-golang.mk +5 -4
index 72e8f6b7af..e47de17aba 100644
@@ -58,10 +58,6 @@ define inner-golang-package
 
 $(2)_WORKSPACE ?= _gopath
 
-ifeq ($(BR2_STATIC_LIBS),y)
-$(2)_LDFLAGS += -extldflags '-static'
-endif
-
 $(2)_BUILD_OPTS += \
 	-ldflags "$$($(2)_LDFLAGS)" \
 	-tags "$$($(2)_TAGS)" \
@@ -106,6 +102,11 @@ endif
 # file.
 ifndef $(2)_BUILD_CMDS
 ifeq ($(4),target)
+
+ifeq ($(BR2_STATIC_LIBS),y)
+$(2)_LDFLAGS += -extldflags '-static'
+endif
+
 # Build package for target
 define $(2)_BUILD_CMDS
 	$$(foreach d,$$($(2)_BUILD_TARGETS),\

--
2.11.0

#1 lore raw

PATCH 1/1 package/pkg-golang: do not set static linking for host target

Quoted 7 lines · Mirza Krak

The current logic will set the "-static" flag when building go host packages if BR2_STATIC_LIBS is set, this will not work as there is no support to link host packages statically.

Fix this by applying this logic only for target builds.

Applied to master, thanks.

Quoted 3 lines

---

This should have gone above the --- and the Sob. Unfortunately, I hadn't
noticed, so now I pushed it without the fixes tag...

Regards,
Arnout

Quoted 34 lines
 package/pkg-golang.mk | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
package/pkg-golang.mk +5 -5
index 72e8f6b7af..e47de17aba 100644
@@ -58,10 +58,6 @@ define inner-golang-package
 
 $(2)_WORKSPACE ?= _gopath
 
-ifeq ($(BR2_STATIC_LIBS),y)
-$(2)_LDFLAGS += -extldflags '-static'
-endif
-
 $(2)_BUILD_OPTS += \
 	-ldflags "$$($(2)_LDFLAGS)" \
 	-tags "$$($(2)_TAGS)" \
@@ -106,6 +102,11 @@ endif
 # file.
 ifndef $(2)_BUILD_CMDS
 ifeq ($(4),target)
+
+ifeq ($(BR2_STATIC_LIBS),y)
+$(2)_LDFLAGS += -extldflags '-static'
+endif
+
 # Build package for target
 define $(2)_BUILD_CMDS
 	$$(foreach d,$$($(2)_BUILD_TARGETS),\
--

2.11.0

#2 lore raw

PATCH 1/1 package/pkg-golang: do not set static linking for host target

In reply to Mirza Krak
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Mirza" == Mirza Krak <[email protected]> writes:

The current logic will set the "-static" flag when building go host packages if BR2_STATIC_LIBS is set, this will not work as there is no support to link host packages statically.

Quoted 6 lines

Fix this by applying this logic only for target builds.

---

Committed to 2019.05.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard