package/olsr: needs -fPIC to avoid build failure
authorGiulio Benetti <giulio.benetti@benettiengineering.com>
Mon, 20 Jan 2020 14:51:47 +0000 (15:51 +0100)
committerPeter Korsgaard <peter@korsgaard.com>
Mon, 3 Feb 2020 10:24:26 +0000 (11:24 +0100)
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/

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/olsr/olsr.mk

index 31c601f80e9781320246acda749731a54e0c05e1..f930b3cacf118613f04e7d8f3f2823dd40706ebf 100644 (file)
@@ -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