diff options
author | Aurelian Zanoschi <aurelian17@gmail.com> | 2017-08-20 12:25:19 +0300 |
---|---|---|
committer | Andrei Gherzan <andrei@gherzan.com> | 2017-09-01 13:59:51 +0100 |
commit | e59132bdcc092597ed5f08a77e7160b0f3bb3547 (patch) | |
tree | 2059d0ad24d2560622ab2848435c67402434ebb5 | |
parent | 7a7d871cc1e0a0c5d217ea4a2bca4f4a76e5a9c9 (diff) | |
download | meta-raspberrypi-e59132bdcc092597ed5f08a77e7160b0f3bb3547.tar.gz |
wiringpi: Fix linking problem
[github issue #105: wiringpi library is not linked correctly]
Incorrect order of compiler flags causing the libwiringpi.so library
to not have the required linking dependencies. The cross-compilation
patch needed to be reworked in order to fix this problem.
Fixes #105
Signed-off-by: Aurelian Zanoschi <aurelian17@gmail.com>
-rw-r--r-- | recipes-devtools/wiringPi/files/0001-Add-initial-cross-compile-support.patch | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/recipes-devtools/wiringPi/files/0001-Add-initial-cross-compile-support.patch b/recipes-devtools/wiringPi/files/0001-Add-initial-cross-compile-support.patch index a081b8d..01e0546 100644 --- a/recipes-devtools/wiringPi/files/0001-Add-initial-cross-compile-support.patch +++ b/recipes-devtools/wiringPi/files/0001-Add-initial-cross-compile-support.patch | |||
@@ -1,23 +1,18 @@ | |||
1 | From 4ed727aa9e528f130fdc8798df771037a1f22fc9 Mon Sep 17 00:00:00 2001 | 1 | From ca25788e2563bad0d554deb9f4300d1e7d062825 Mon Sep 17 00:00:00 2001 |
2 | From: Andrea Galbusera <gizero@gmail.com> | 2 | From: Aurelian Zanoschi <aurelian17@gmail.com> |
3 | Date: Mon, 3 Apr 2017 14:48:14 +0200 | 3 | Date: Mon, 31 Jul 2017 20:25:15 +0300 |
4 | Subject: [PATCH] =?UTF-8?q?Add=20initial=20cross=20compile=20support=20(re?= | 4 | Subject: [PATCH] Add initial cross compile support |
5 | =?UTF-8?q?base=20from=20Petter=20Mab=C3=A4cker=20<petter@technux.se>=20ve?= | ||
6 | =?UTF-8?q?rsion)?= | ||
7 | MIME-Version: 1.0 | ||
8 | Content-Type: text/plain; charset=UTF-8 | ||
9 | Content-Transfer-Encoding: 8bit | ||
10 | 5 | ||
11 | --- | 6 | --- |
12 | devLib/Makefile | 54 +++++++++++++++++++++++++-------------------- | 7 | devLib/Makefile | 54 +++++++++++++++++++++++++-------------------- |
13 | examples/Gertboard/Makefile | 20 +++++++++++------ | 8 | examples/Gertboard/Makefile | 22 +++++++++++------- |
14 | examples/Makefile | 20 +++++++++++------ | 9 | examples/Makefile | 22 +++++++++++------- |
15 | examples/PiFace/Makefile | 20 +++++++++++------ | 10 | examples/PiFace/Makefile | 22 +++++++++++------- |
16 | examples/PiGlow/Makefile | 4 ++-- | 11 | examples/PiGlow/Makefile | 4 ++-- |
17 | examples/q2w/Makefile | 4 ++-- | 12 | examples/q2w/Makefile | 4 ++-- |
18 | gpio/Makefile | 29 ++++++++++++------------ | 13 | gpio/Makefile | 29 ++++++++++++------------ |
19 | wiringPi/Makefile | 50 +++++++++++++++++++++++------------------ | 14 | wiringPi/Makefile | 52 ++++++++++++++++++++++++------------------- |
20 | 8 files changed, 116 insertions(+), 85 deletions(-) | 15 | 8 files changed, 120 insertions(+), 89 deletions(-) |
21 | 16 | ||
22 | diff --git a/devLib/Makefile b/devLib/Makefile | 17 | diff --git a/devLib/Makefile b/devLib/Makefile |
23 | index cf665d6..040c03a 100644 | 18 | index cf665d6..040c03a 100644 |
@@ -132,11 +127,12 @@ index 1939ad6..98d1415 100644 | |||
132 | -CC = gcc | 127 | -CC = gcc |
133 | -INCLUDE = -I/usr/local/include | 128 | -INCLUDE = -I/usr/local/include |
134 | -CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe | 129 | -CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe |
135 | +DESTDIR?=/usr | 130 | - |
136 | +PREFIX?=/local | ||
137 | |||
138 | -LDFLAGS = -L/usr/local/lib | 131 | -LDFLAGS = -L/usr/local/lib |
139 | -LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm | 132 | -LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm |
133 | +DESTDIR?=/usr | ||
134 | +PREFIX?=/local | ||
135 | + | ||
140 | +INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include | 136 | +INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include |
141 | +LIB_DIR?=$(DESTDIR)$(PREFIX)/lib | 137 | +LIB_DIR?=$(DESTDIR)$(PREFIX)/lib |
142 | + | 138 | + |
@@ -164,11 +160,12 @@ index 6d87885..8623816 100644 | |||
164 | -CC = gcc | 160 | -CC = gcc |
165 | -INCLUDE = -I/usr/local/include | 161 | -INCLUDE = -I/usr/local/include |
166 | -CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe | 162 | -CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe |
167 | +DESTDIR?=/usr | 163 | - |
168 | +PREFIX?=/local | ||
169 | |||
170 | -LDFLAGS = -L/usr/local/lib | 164 | -LDFLAGS = -L/usr/local/lib |
171 | -LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm -lcrypt -lrt | 165 | -LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm -lcrypt -lrt |
166 | +DESTDIR?=/usr | ||
167 | +PREFIX?=/local | ||
168 | + | ||
172 | +INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include | 169 | +INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include |
173 | +LIB_DIR?=$(DESTDIR)$(PREFIX)/lib | 170 | +LIB_DIR?=$(DESTDIR)$(PREFIX)/lib |
174 | + | 171 | + |
@@ -196,11 +193,12 @@ index f937c14..ad030b3 100644 | |||
196 | -CC = gcc | 193 | -CC = gcc |
197 | -INCLUDE = -I/usr/local/include | 194 | -INCLUDE = -I/usr/local/include |
198 | -CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe | 195 | -CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe |
199 | +DESTDIR?=/usr | 196 | - |
200 | +PREFIX?=/local | ||
201 | |||
202 | -LDFLAGS = -L/usr/local/lib | 197 | -LDFLAGS = -L/usr/local/lib |
203 | -LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm | 198 | -LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm |
199 | +DESTDIR?=/usr | ||
200 | +PREFIX?=/local | ||
201 | + | ||
204 | +INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include | 202 | +INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include |
205 | +LIB_DIR?=$(DESTDIR)$(PREFIX)/lib | 203 | +LIB_DIR?=$(DESTDIR)$(PREFIX)/lib |
206 | + | 204 | + |
@@ -305,10 +303,10 @@ index f41a005..22753ee 100644 | |||
305 | 303 | ||
306 | .PHONY: depend | 304 | .PHONY: depend |
307 | diff --git a/wiringPi/Makefile b/wiringPi/Makefile | 305 | diff --git a/wiringPi/Makefile b/wiringPi/Makefile |
308 | index e1868b9..e39f75a 100644 | 306 | index e1868b9..750d290 100644 |
309 | --- a/wiringPi/Makefile | 307 | --- a/wiringPi/Makefile |
310 | +++ b/wiringPi/Makefile | 308 | +++ b/wiringPi/Makefile |
311 | @@ -25,19 +25,23 @@ VERSION=$(shell cat ../VERSION) | 309 | @@ -25,21 +25,25 @@ VERSION=$(shell cat ../VERSION) |
312 | DESTDIR?=/usr | 310 | DESTDIR?=/usr |
313 | PREFIX?=/local | 311 | PREFIX?=/local |
314 | 312 | ||
@@ -336,19 +334,22 @@ index e1868b9..e39f75a 100644 | |||
336 | +CC ?= gcc | 334 | +CC ?= gcc |
337 | +INCLUDE ?= -I. | 335 | +INCLUDE ?= -I. |
338 | DEFS = -D_GNU_SOURCE | 336 | DEFS = -D_GNU_SOURCE |
339 | CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC | 337 | -CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC |
338 | +CFLAGS = $(DEBUG) $(DEFS) $(INCLUDE) -Wformat=2 -Wall -Wextra -Winline -pipe -fPIC | ||
339 | |||
340 | LIBS = -lm -lpthread -lrt -lcrypt | ||
340 | 341 | ||
341 | @@ -78,17 +82,17 @@ $(STATIC): $(OBJ) | 342 | @@ -78,17 +82,17 @@ $(STATIC): $(OBJ) |
342 | 343 | ||
343 | $(DYNAMIC): $(OBJ) | 344 | $(DYNAMIC): $(OBJ) |
344 | $Q echo "[Link (Dynamic)]" | 345 | $Q echo "[Link (Dynamic)]" |
345 | - $Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) $(LIBS) $(OBJ) | 346 | - $Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) $(LIBS) $(OBJ) |
346 | + $Q $(CC) $(LDFLAGS) -shared -Wl,-soname,$(BASE_NAME).so.$(DYN_VERS_MAJ) -o $(BASE_NAME).so $(LIBS) $(OBJ) | 347 | + $Q $(CC) $(LDFLAGS) -shared -Wl,-soname,$(BASE_NAME).so.$(DYN_VERS_MAJ) -o $(BASE_NAME).so $(OBJ) $(LIBS) |
347 | 348 | ||
348 | .c.o: | 349 | .c.o: |
349 | $Q echo [Compile] $< | 350 | $Q echo [Compile] $< |
350 | - $Q $(CC) -c $(CFLAGS) $< -o $@ | 351 | - $Q $(CC) -c $(CFLAGS) $< -o $@ |
351 | + $Q $(CC) -c $(CFLAGS) -fPIC $< -o $@ | 352 | + $Q $(CC) $(CFLAGS) $(LIBS) -c $< -o $@ |
352 | 353 | ||
353 | 354 | ||
354 | .PHONY: clean | 355 | .PHONY: clean |