Skip to contentSkip to conversation

Fix building tools alone with host compiler

PATCH New François Revol 2 participants 4 messages Mar 18, 2011 – May 12, 2011 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix building tools alone with host compiler

- don't include config.h when building with host cc,
- HOSTCFLAGS was defined with the wrong name, so wasn't used,
- make sure make finds sources outside of tools/.

---
 tools/Makefile   |    6 +++---
 tools/imximage.h |    2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)
tools/Makefile +3 -3
index 623f908..1ca497e 100644
@@ -140,7 +140,7 @@ NOPEDOBJS := $(addprefix $(obj),$(NOPED_OBJ_FILES-y))
 # Use native tools and options
 # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
 #
-HOSTCPPFLAGS =	-idirafter $(SRCTREE)/include \
+HOSTCFLAGS =	-idirafter $(SRCTREE)/include \
 		-idirafter $(OBJTREE)/include2 \
 		-idirafter $(OBJTREE)/include \
 	        -I $(SRCTREE)/lib/libfdt \
@@ -201,10 +201,10 @@ $(obj)ubsha1$(SFX):	$(obj)os_support.o $(obj)sha1.o $(obj)ubsha1.o
 	$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
 
 # Some of the tool objects need to be accessed from outside the tools directory
-$(obj)%.o: $(SRCTREE)/common/%.c
+$(subst common/,,$(filter common/%,$(EXT_OBJ_FILES-y))): $(obj)%.o: $(SRCTREE)/common/%.c
 	$(HOSTCC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $<
 
-$(obj)%.o: $(SRCTREE)/lib/%.c
+$(subst lib/,,$(filter lib/%,$(EXT_OBJ_FILES-y))): $(obj)%.o: $(SRCTREE)/lib/%.c
 	$(HOSTCC) -g $(HOSTCFLAGS) -c -o $@ $<
 
 $(obj)%.o: $(SRCTREE)/lib/libfdt/%.c
tools/imximage.h +2 -0
index 38ca6be..38d8742 100644
@@ -24,7 +24,9 @@
 #ifndef _IMXIMAGE_H_
 #define _IMXIMAGE_H_
 
+#ifndef USE_HOSTCC
 #include <config.h>
+#endif
 
 #define MAX_HW_CFG_SIZE_V2 121 /* Max number of registers imx can set for v2 */
 #define MAX_HW_CFG_SIZE_V1 60  /* Max number of registers imx can set for v1 */
Signature · 1 line
1.7.2.2
#1 lore raw

PATCH 1/1 Fix building tools alone with host compiler

Dear =?UTF-8?q?Fran=C3=A7ois=20Revol?=,

which exact problem is your patch supposed to fix?

Quoted 3 lines · In message <[email protected]> you wrote:

- don't include config.h when building with host cc,
- HOSTCFLAGS was defined with the wrong name, so wasn't used,

What makes you think so? Top-level "config.mk" defines

	HOSTCFLAGS      = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \
			  $(HOSTCPPFLAGS)

?

Quoted 1 line

- make sure make finds sources outside of tools/.

Again, which exact problem are you trying to fix?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Another dream that failed.  There's nothing sadder.
	-- Kirk, "This side of Paradise", stardate 3417.3
#2 lore raw

PATCH 1/1 Fix building tools alone with host compiler

Hi,

Le 18 mars 2011 ? 23:38, Wolfgang Denk a ?crit :

Quoted 1 line

which exact problem is your patch supposed to fix?

Building mkimage alone without having to set up the rest, on OSX.

Quoted 9 lines
Quoted 3 lines · In message <[email protected]> you wrote:

- don't include config.h when building with host cc,
- HOSTCFLAGS was defined with the wrong name, so wasn't used,

What makes you think so? Top-level "config.mk" defines

	HOSTCFLAGS      = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \
			  $(HOSTCPPFLAGS)

Somehow it doesn't get used here:

$ make tools
make -C tools all
/Volumes/Data/devel/u-boot/u-boot/common/env_embedded.c:28:20: error: config.h: No such file or directory
/Volumes/Data/devel/u-boot/u-boot/tools/envcrc.c:35:20: error: config.h: No such file or directory
gcc  -g  -Os   -D__KERNEL__ -I/Volumes/Data/devel/u-boot/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /usr/lib/gcc/i686-apple-darwin10/4.2.1/include -pipe  -Wall -Wstrict-prototypes -fno-stack-protector   -o crc32.o crc32.c -c
i686-apple-darwin10-gcc-4.2.1: crc32.c: No such file or directory
i686-apple-darwin10-gcc-4.2.1: no input files
make[1]: *** [crc32.o] Error 1
make: *** [tools] Error 2

2nd pass (it doesn't like dep stuff):

$ make tools
make -C tools all
gcc  -g  -Os   -D__KERNEL__ -I/Volumes/Data/devel/u-boot/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /usr/lib/gcc/i686-apple-darwin10/4.2.1/include -pipe  -Wall -Wstrict-prototypes -fno-stack-protector   -o crc32.o crc32.c -c
i686-apple-darwin10-gcc-4.2.1: crc32.c: No such file or directory
i686-apple-darwin10-gcc-4.2.1: no input files
make[1]: *** [crc32.o] Error 1
make: *** [tools] Error 2

Been this way for a year at least, never managed to build it before.
I recall trying passing all sort of stuff to make, probably after asking on IRC but it didn't make it either.

Quoted 3 lines
Quoted 1 line

- make sure make finds sources outside of tools/.

Again, which exact problem are you trying to fix?

i686-apple-darwin10-gcc-4.2.1: crc32.c: No such file or directory

Fran?ois.

#3 lore raw

PATCH 1/1 Fix building tools alone with host compiler

In reply to François Revol

Dear =?UTF-8?q?Fran=C3=A7ois=20Revol?=,

Quoted 9 lines · In message <[email protected]> you wrote:

- don't include config.h when building with host cc,
- HOSTCFLAGS was defined with the wrong name, so wasn't used,
- make sure make finds sources outside of tools/.

---
 tools/Makefile   |    6 +++---
 tools/imximage.h |    2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Behind every great man, there is a woman -- urging him on.
	-- Harry Mudd, "I, Mudd", stardate 4513.3