Skip to contentSkip to conversation

package/olsr: needs -fPIC on Microblaze

PATCH New Giulio Benetti 3 participants 6 messages Jan 18, 2020 – Feb 3, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/olsr: needs -fPIC on Microblaze

When building on Microblaze package olsr needs to be compiled with -fPIC, so append -fPIC to CFLAGS when invoking make.

Fixes:
http://autobuild.buildroot.net/results/9d6/9d6d69133789aba16daeb6dc53721597e6be9806/

---
 package/olsr/olsr.mk | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
package/olsr/olsr.mk +11 -2
index 53bf874af0..ab4d5f1a76 100644
@@ -16,10 +16,19 @@ OLSR_LICENSE = BSD-3-Clause, LGPL-2.1+
 OLSR_LICENSE_FILES = license.txt lib/pud/nmealib/LICENSE
 OLSR_DEPENDENCIES = host-flex host-bison
 
+OLSR_CFLAGS = $(TARGET_CFLAGS)
+
+# microblaze needs -fPIC to link
+ifeq ($(BR2_microblaze),y)
+OLSR_CFLAGS += -fPIC
+endif
+
 define OLSR_BUILD_CMDS
-	$(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) -C $(@D) olsrd
+	$(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) \
+		CFLAGS="$(OLSR_CFLAGS)" -C $(@D) olsrd
 	$(foreach p,$(OLSR_PLUGINS), \
-		$(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) -C $(@D)/lib/$(p)
+		$(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) \
+			CFLAGS="$(OLSR_CFLAGS)" -C $(@D)/lib/$(p)
 	)
 endef
 
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/olsr: needs -fPIC on Microblaze

Hi Giulio,

Quoted 16 lines

When building on Microblaze package olsr needs to be compiled with -fPIC, so append -fPIC to CFLAGS when invoking make.

---
 package/olsr/olsr.mk | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
package/olsr/olsr.mk +0 -0
index 53bf874af0..ab4d5f1a76 100644
@@ -16,10 +16,19 @@ OLSR_LICENSE = BSD-3-Clause, LGPL-2.1+

OLSR_LICENSE_FILES = license.txt lib/pud/nmealib/LICENSE OLSR_DEPENDENCIES = host-flex host-bison

package/olsr/olsr.mk

Quoted 2 lines
package/olsr/olsr.mk +2 -0
+OLSR_CFLAGS = $(TARGET_CFLAGS)
+

This error appears for other architectures(ARC, RISCV, arm) as well:
http://autobuild.buildroot.net/results/0d3/0d3489b14f4f4f0d4837d00209b5c1ee8d6f6a98//
http://autobuild.buildroot.net/results/b85/b85d27b3a4bab5d68460401ff49e624177d55afa//

Could you please remove ifeq statement below so that the "-fPIC" option is applied for all purposes?

Quoted 16 lines
package/olsr/olsr.mk +5 -0
+# microblaze needs -fPIC to link
+ifeq ($(BR2_microblaze),y)
+OLSR_CFLAGS += -fPIC
+endif
+

define OLSR_BUILD_CMDS

package/olsr/olsr.mk +4 -2
-       $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) -C $(@D) olsrd
+       $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) \
+               CFLAGS="$(OLSR_CFLAGS)" -C $(@D) olsrd
        $(foreach p,$(OLSR_PLUGINS), \
-               $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) -C $(@D)/lib/$(p)
+               $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) \
+                       CFLAGS="$(OLSR_CFLAGS)" -C $(@D)/lib/$(p)
       )

endef

Quoted 2 lines

--
2.20.1

Best regards,
Evgeniy Didin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20200120/1fba3b37/attachment.html>

#2 lore raw

PATCH 1/1 package/olsr: needs -fPIC on Microblaze

Hi Evgeniy,

Quoted 18 lines · Evgeniy Didin

Hi Giulio,

Quoted 16 lines

When building on Microblaze package olsr needs to be compiled with -fPIC, so append -fPIC to CFLAGS when invoking make.

---
?package/olsr/olsr.mk | 13 +++++++++++--
?1 file changed, 11 insertions(+), 2 deletions(-)

package/olsr/olsr.mk +0 -0
index 53bf874af0..ab4d5f1a76 100644
@@ -16,10 +16,19 @@ OLSR_LICENSE = BSD-3-Clause, LGPL-2.1+

OLSR_LICENSE_FILES = license.txt lib/pud/nmealib/LICENSE OLSR_DEPENDENCIES = host-flex host-bison

Quoted 6 lines

package/olsr/olsr.mk

Quoted 2 lines
package/olsr/olsr.mk +2 -0
+OLSR_CFLAGS = $(TARGET_CFLAGS)
+

This error appears for other architectures(ARC, RISCV, arm) as well:
http://autobuild.buildroot.net/results/0d3/0d3489b14f4f4f0d4837d00209b5c1ee8d6f6a98//
http://autobuild.buildroot.net/results/b85/b85d27b3a4bab5d68460401ff49e624177d55afa//

You're right, and I've checked if there is something in common with all those architectures, but nothing, so it's better to append -fPIC as you suggest below.

Quoted 2 lines

Could you please remove ifeq statement below so that the "-fPIC" option is applied for all purposes?

Yes, I'm going to send a patch for this

Best regards

Signature · 2 lines
Giulio Benetti
Benetti Engineering sas
Quoted 26 lines
Quoted 7 lines
package/olsr/olsr.mk +5 -0
+# microblaze needs -fPIC to link
+ifeq ($(BR2_microblaze),y)
+OLSR_CFLAGS += -fPIC
+endif
+

define OLSR_BUILD_CMDS
-?????? $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) -C $(@D)

olsrd

Quoted 4 lines

+?????? $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) \
+?????????????? CFLAGS="$(OLSR_CFLAGS)" -C $(@D) olsrd ??????? $(foreach p,$(OLSR_PLUGINS), \
-?????????????? $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH)

-C $(@D)/lib/$(p)

Quoted 7 lines

+?????????????? $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) \
+?????????????????????? CFLAGS="$(OLSR_CFLAGS)" -C $(@D)/lib/$(p) ?????? )
endef

--
2.20.1

Best regards,
Evgeniy Didin

#3 lore raw

PATCH v2 1/1 package/olsr: needs -fPIC to avoid build failure

In reply to Evgeniy Didin

When building on Arc, Microblaze, Riscv32, Riscv64, package olsr needs to be compiled with -fPIC, so append -fPIC to CFLAGS when invoking make by default, since it seems to be mandatory in general and it's harmless for other architectures.

Fixes:
http://autobuild.buildroot.net/results/9d6/9d6d69133789aba16daeb6dc53721597e6be9806/
http://autobuild.buildroot.net/results/b85/b85d27b3a4bab5d68460401ff49e624177d55afa/
http://autobuild.buildroot.net/results/0d3/0d3489b14f4f4f0d4837d00209b5c1ee8d6f6a98/
http://autobuild.buildroot.net/results/d9a/d9a143c8e9a175741acfafd17b63544d04744ac9/

---
 package/olsr/olsr.mk | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
package/olsr/olsr.mk +9 -2
index 31c601f80e..f930b3cacf 100644
@@ -14,10 +14,17 @@ OLSR_LICENSE = BSD-3-Clause, LGPL-2.1+
 OLSR_LICENSE_FILES = license.txt lib/pud/nmealib/LICENSE
 OLSR_DEPENDENCIES = host-flex host-bison
 
+OLSR_CFLAGS = $(TARGET_CFLAGS)
+
+# it needs -fPIC to link on lot of architectures
+OLSR_CFLAGS += -fPIC
+
 define OLSR_BUILD_CMDS
-	$(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) -C $(@D) olsrd
+	$(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) \
+		CFLAGS="$(OLSR_CFLAGS)" -C $(@D) olsrd
 	$(foreach p,$(OLSR_PLUGINS), \
-		$(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) -C $(@D)/lib/$(p)
+		$(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) \
+			CFLAGS="$(OLSR_CFLAGS)" -C $(@D)/lib/$(p)
 	)
 endef
 
Signature · 1 line
2.20.1
#4 lore raw

PATCH v2 1/1 package/olsr: needs -fPIC to avoid build failure

Quoted 5 lines · Giulio Benetti

When building on Arc, Microblaze, Riscv32, Riscv64, package olsr needs to be compiled with -fPIC, so append -fPIC to CFLAGS when invoking make by default, since it seems to be mandatory in general and it's harmless for other architectures.

Quoted 8 lines

Fixes:
http://autobuild.buildroot.net/results/9d6/9d6d69133789aba16daeb6dc53721597e6be9806/
http://autobuild.buildroot.net/results/b85/b85d27b3a4bab5d68460401ff49e624177d55afa/
http://autobuild.buildroot.net/results/0d3/0d3489b14f4f4f0d4837d00209b5c1ee8d6f6a98/
http://autobuild.buildroot.net/results/d9a/d9a143c8e9a175741acfafd17b63544d04744ac9/

---

V1->V2:
* append -fPIC to CFLAGS by default

Quoted 28 lines
  package/olsr/olsr.mk | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
package/olsr/olsr.mk +9 -2
index 31c601f80e..f930b3cacf 100644
@@ -14,10 +14,17 @@ OLSR_LICENSE = BSD-3-Clause, LGPL-2.1+
  OLSR_LICENSE_FILES = license.txt lib/pud/nmealib/LICENSE
  OLSR_DEPENDENCIES = host-flex host-bison
 
+OLSR_CFLAGS = $(TARGET_CFLAGS)
+
+# it needs -fPIC to link on lot of architectures
+OLSR_CFLAGS += -fPIC
+
  define OLSR_BUILD_CMDS
-	$(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) -C $(@D) olsrd
+	$(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) \
+		CFLAGS="$(OLSR_CFLAGS)" -C $(@D) olsrd
  	$(foreach p,$(OLSR_PLUGINS), \
-		$(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) -C $(@D)/lib/$(p)
+		$(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) \
+			CFLAGS="$(OLSR_CFLAGS)" -C $(@D)/lib/$(p)
  	)
  endef
 
Signature · 2 lines
Giulio Benetti
Benetti Engineering sas
#5 lore raw

PATCH v2 1/1 package/olsr: needs -fPIC to avoid build failure

In reply to Giulio Benetti
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Giulio" == Giulio Benetti <[email protected]> writes:

When building on Arc, Microblaze, Riscv32, Riscv64, package olsr needs to be compiled with -fPIC, so append -fPIC to CFLAGS when invoking make by default, since it seems to be mandatory in general and it's harmless for other architectures.

Quoted 7 lines

Fixes:
http://autobuild.buildroot.net/results/9d6/9d6d69133789aba16daeb6dc53721597e6be9806/
http://autobuild.buildroot.net/results/b85/b85d27b3a4bab5d68460401ff49e624177d55afa/
http://autobuild.buildroot.net/results/0d3/0d3489b14f4f4f0d4837d00209b5c1ee8d6f6a98/
http://autobuild.buildroot.net/results/d9a/d9a143c8e9a175741acfafd17b63544d04744ac9/

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard