8ac3f121f0
Update patch 0001-Adjust-for-buildroot-build.patch to use real static linking (command line flag '-static' for target gpio-static). Fixes [1]: [Link] .../output/host/usr/lib/gcc/powerpc-buildroot-linux-uclibc/5.4.0/libgcc.a(unwind-dw2-fde-dip.o): In function `_Unwind_Find_FDE': ...output/build/host-gcc-final-5.4.0/build/powerpc-buildroot-linux-uclibc/libgcc/../../../libgcc/unwind-dw2-fde-dip.c:465: undefined reference to `dl_iterate_phdr' collect2: error: ld returned 1 exit status make[1]: *** [gpio-static] Error 1 make[1]: Leaving directory `.../output/build/wiringpi-2.32/gpio' [1] http://autobuild.buildroot.net/results/b905617dda0e120d04c54daf7cae2bad236ac767 Signed-off-by: Peter Seiderer <ps.report@gmx.net> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
128 lines
4.0 KiB
Diff
128 lines
4.0 KiB
Diff
From 10d5bde8d628a93993dd7305dc9a406da69f65a9 Mon Sep 17 00:00:00 2001
|
|
From: Peter Seiderer <ps.report@gmx.net>
|
|
Date: Wed, 2 Dec 2015 00:22:26 +0100
|
|
Subject: [PATCH] Adjust for buildroot build.
|
|
|
|
- enable CC override
|
|
- fix devLib/gpio include path for local build (without installing first)
|
|
- change CFLAGS from '=' to '+=' to honour buildroot given flags
|
|
- add linker name link for libwiringPiDev and libwiringPi for local linking
|
|
(without installing first)
|
|
- fix install linker name link (do not link with absolute path)
|
|
- add gpio-static linking target
|
|
|
|
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
|
|
---
|
|
devLib/Makefile | 9 +++++----
|
|
gpio/Makefile | 14 +++++++++-----
|
|
wiringPi/Makefile | 7 ++++---
|
|
3 files changed, 18 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/devLib/Makefile b/devLib/Makefile
|
|
index 1b1ebe0..84b4d2a 100644
|
|
--- a/devLib/Makefile
|
|
+++ b/devLib/Makefile
|
|
@@ -36,10 +36,10 @@ DYNAMIC=libwiringPiDev.so.$(VERSION)
|
|
|
|
#DEBUG = -g -O0
|
|
DEBUG = -O2
|
|
-CC = gcc
|
|
-INCLUDE = -I.
|
|
+CC ?= gcc
|
|
+INCLUDE = -I../wiringPi
|
|
DEFS = -D_GNU_SOURCE
|
|
-CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
|
|
+CFLAGS += $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
|
|
|
|
LIBS =
|
|
|
|
@@ -69,6 +69,7 @@ $(STATIC): $(OBJ)
|
|
$(DYNAMIC): $(OBJ)
|
|
$Q echo "[Link (Dynamic)]"
|
|
$Q $(CC) -shared -Wl,-soname,libwiringPiDev.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPiDev.so.$(VERSION) -lpthread $(OBJ)
|
|
+ $Q ln -sf libwiringPiDev.so.$(VERSION) libwiringPiDev.so
|
|
|
|
.c.o:
|
|
$Q echo [Compile] $<
|
|
@@ -93,7 +94,7 @@ install: $(DYNAMIC)
|
|
$Q echo "[Install Dynamic Lib]"
|
|
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
|
|
$Q install -m 0755 libwiringPiDev.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION)
|
|
- $Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION) $(DESTDIR)/lib/libwiringPiDev.so
|
|
+ $Q ln -sf libwiringPiDev.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so
|
|
$Q $(LDCONFIG)
|
|
|
|
.PHONY: install-static
|
|
diff --git a/gpio/Makefile b/gpio/Makefile
|
|
index 7dcd090..dc4be72 100644
|
|
--- a/gpio/Makefile
|
|
+++ b/gpio/Makefile
|
|
@@ -32,11 +32,11 @@ endif
|
|
|
|
#DEBUG = -g -O0
|
|
DEBUG = -O2
|
|
-CC = gcc
|
|
-INCLUDE = -I$(DESTDIR)$(PREFIX)/include
|
|
-CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
|
|
+CC ?= gcc
|
|
+INCLUDE = -I../wiringPi -I../devLib
|
|
+CFLAGS += $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
|
|
|
|
-LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
|
|
+LDFLAGS = -L../wiringPi -L../devLib
|
|
LIBS = -lwiringPi -lwiringPiDev -lpthread
|
|
|
|
# May not need to alter anything below this line
|
|
@@ -52,9 +52,13 @@ version.h: ../VERSION
|
|
$Q echo Need to run newVersion above.
|
|
|
|
gpio: $(OBJ)
|
|
- $Q echo [Link]
|
|
+ $Q echo "[Link (Dynamic)]"
|
|
$Q $(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
|
|
|
|
+gpio-static: $(OBJ)
|
|
+ $Q echo "[Link (Static)]"
|
|
+ $Q $(CC) -static -o gpio $(OBJ) ../wiringPi/libwiringPi.a ../devLib/libwiringPiDev.a -lpthread
|
|
+
|
|
.c.o:
|
|
$Q echo [Compile] $<
|
|
$Q $(CC) -c $(CFLAGS) $< -o $@
|
|
diff --git a/wiringPi/Makefile b/wiringPi/Makefile
|
|
index acb6e58..8b84dc6 100644
|
|
--- a/wiringPi/Makefile
|
|
+++ b/wiringPi/Makefile
|
|
@@ -36,10 +36,10 @@ DYNAMIC=libwiringPi.so.$(VERSION)
|
|
|
|
#DEBUG = -g -O0
|
|
DEBUG = -O2
|
|
-CC = gcc
|
|
+CC ?= gcc
|
|
INCLUDE = -I.
|
|
DEFS = -D_GNU_SOURCE
|
|
-CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
|
|
+CFLAGS += $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
|
|
|
|
LIBS =
|
|
|
|
@@ -90,6 +90,7 @@ $(STATIC): $(OBJ)
|
|
$(DYNAMIC): $(OBJ)
|
|
$Q echo "[Link (Dynamic)]"
|
|
$Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) -lpthread $(OBJ)
|
|
+ $Q ln -sf libwiringPi.so.$(VERSION) libwiringPi.so
|
|
|
|
.c.o:
|
|
$Q echo [Compile] $<
|
|
@@ -115,7 +116,7 @@ install: $(DYNAMIC)
|
|
$Q echo "[Install Dynamic Lib]"
|
|
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
|
|
$Q install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)
|
|
- $Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
|
|
+ $Q ln -sf libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so
|
|
$Q $(LDCONFIG)
|
|
|
|
.PHONY: install-static
|
|
--
|
|
2.11.0
|
|
|