Skip to contentSkip to conversation

Set CFLAGS = $(TARGET_CFLAGS) for many packages

PATCH New Ulf Samuelsson 3 participants 5 messages Jan 23, 2007 – Jan 26, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Set CFLAGS = $(TARGET_CFLAGS) for many packages

If you make Buildroot from scratch, CFLAGS gets set during the build, but if you add packages later, then CFLAGS should be set in the makefile fragment of the new package.

I believe that TARGET_CFLAGS needs to include the Linux Include Directory or you will get compolie time errors.
Don't have a clean patch for that yet, but this is what I do:

TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)

should be changed to

TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) \
	-I$(TOOL_BUILD_DIR)/linux/include

Best Regards
Ulf Samuelsson

-------------- next part --------------
A non-text attachment was scrubbed...
Name: target_flags.patch
Type: text/x-patch
Size: 19474 bytes
Desc: not available
Url : http://busybox.net/lists/buildroot/attachments/20070124/0deebaf0/attachment-0001.bin

#1 lore raw

PATCH 1/1 Set CFLAGS = $(TARGET_CFLAGS) for many packages

Quoted 3 lines · Ulf Samuelsson

If you make Buildroot from scratch, CFLAGS gets set during the build, but if you add packages later, then CFLAGS should be set in the makefile fragment of the new package.

I don't understand what you mean here. Please elaborate

Quoted 3 lines

I believe that TARGET_CFLAGS needs to include the Linux Include Directory or you will get compolie time errors.

I don't have the linux include in my TARGET_CFLAGS AFAIK and do not get compile errors. What kernel-headers are you using? What errors are you seeing with what package?

#2 lore raw

PATCH 1/1 Set CFLAGS = $(TARGET_CFLAGS) for many packages

Quoted 7 lines · Bernhard Fischer
Quoted 3 lines · Ulf Samuelsson

If you make Buildroot from scratch, CFLAGS gets set during the build, but if you add packages later, then CFLAGS should be set in the makefile fragment of the new package.

I don't understand what you mean here. Please elaborate

Quoted 1 line

Some packages require kernel headers.
If you build from scratch, something sets CFLAGS to a good value.

If you come back the next day, reconfigure your system, to include a new package, and recompile, many packages will bomb out because they do not find the "asm-generic.h"

By adding this CFLAGS patch you can compile those packages.

Many packages have this already, many don't. Can you explain when you have it and when you don't?

Quoted 6 lines
Quoted 2 lines

I believe that TARGET_CFLAGS needs to include the Linux Include Directory or you will get compolie time errors.

I don't have the linux include in my TARGET_CFLAGS AFAIK and do not get compile errors. What kernel-headers are you using? What errors are you seeing with what package?

Best Regards,
Ulf Samuelsson
ulf at atmel.com

GSM:  +46 (706) 22 44 57
Tel:     +46  (8) 441 54 22
Fax:     +46 (8) 441 54 29
Mail: Box 2033  174 02 Sundbyberg
Visit: Kavalleriv?gen 24
          174 58 Sundbyberg'

Sweden

#3 lore raw

PATCH 1/1 Set CFLAGS = $(TARGET_CFLAGS) for many packages

Quoted 10 lines · Ulf Samuelsson
Quoted 7 lines · Bernhard Fischer
Quoted 3 lines · Ulf Samuelsson

If you make Buildroot from scratch, CFLAGS gets set during the build, but if you add packages later, then CFLAGS should be set in the makefile fragment of the new package.

I don't understand what you mean here. Please elaborate

Quoted 1 line

Some packages require kernel headers.

The few packages that really need kernel-internal or any other non-standard include path have to specify their include manually.

Quoted 5 lines

If you build from scratch, something sets CFLAGS to a good value.

If you come back the next day, reconfigure your system, to include a new package, and recompile, many packages will bomb out because they do not find the "asm-generic.h"

I cannot reproduce this. Can you paste an error and describe how i can reproduce this, locally?

Quoted 4 lines

By adding this CFLAGS patch you can compile those packages.

Many packages have this already, many don't. Can you explain when you have it and when you don't?

See above. If a package needs any headers that do not live in a standard place (see e.g. gmp/mpfr.h for gcc or openswan that has a broken makefile in this respect) have to specify that explicitely.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

I believe that TARGET_CFLAGS needs to include the Linux Include Directory or you will get compolie time errors.

I don't have the linux include in my TARGET_CFLAGS AFAIK and do not get compile errors. What kernel-headers are you using? What errors are you seeing with what package?

Please provide an example.

for me, e.g., my cross-compiler works. What do you see if you do the equivalent thing?

$ echo "#include <asm/unistd.h>" | \
/scratch/obj.x86_64/buildroot.mine/build_i586/staging_dir/bin/i586-linux-gcc \
-xc -dD -E - | grep unistd
# 1 "/scratch/obj.x86_64/buildroot.mine/build_i586/staging_dir/lib/gcc/i586-linux-uclibc/4.2.0/../../../../i586-linux-uclibc/sys-include/asm/unistd.h" 1 3 4
#4 lore raw

PATCH 1/1 Set CFLAGS = $(TARGET_CFLAGS) for many packages

Quoted 26 lines · Bernhard Fischer
Quoted 10 lines · Ulf Samuelsson
Quoted 7 lines · Bernhard Fischer
Quoted 3 lines · Ulf Samuelsson

If you make Buildroot from scratch, CFLAGS gets set during the build, but if you add packages later, then CFLAGS should be set in the makefile fragment of the new package.

I don't understand what you mean here. Please elaborate

Quoted 1 line

Some packages require kernel headers.

The few packages that really need kernel-internal or any other non-standard include path have to specify their include manually.

Quoted 5 lines

If you build from scratch, something sets CFLAGS to a good value.

If you come back the next day, reconfigure your system, to include a new package, and recompile, many packages will bomb out because they do not find the "asm-generic.h"

I cannot reproduce this. Can you paste an error and describe how i can reproduce this, locally?

Quoted 2 lines

By adding this CFLAGS patch you can compile those packages.

Quoted 15 lines
Quoted 2 lines

Many packages have this already, many don't. Can you explain when you have it and when you don't?

See above. If a package needs any headers that do not live in a standard
place (see e.g. gmp/mpfr.h for gcc or openswan that has a broken makefile in this respect) have to specify that explicitely.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

I believe that TARGET_CFLAGS needs to include the Linux Include Directory or you will get compolie time errors.

I don't have the linux include in my TARGET_CFLAGS AFAIK and do not get compile errors. What kernel-headers are you using? What errors are you seeing with what package?

As I mentioned yesterday, I have not been able to reproduce the failure to build due to lack of Linux/include,
but the patch I sent does not add anything to TARGET_CFLAGS.

The patch is only making sure that each package listed is compiled with CFLAGS=$(TARGET_CFLAGS).

Since the current buildroot does not use $(TARGET_CFLAGS) when compiling these package the optimization level and debug level specified in the ".config" file gets ignored.

If this is correct behaviour, then I am confused.
Is there a golden rule, which packages should apply TARGET_CFLAGS and which packages should not?

Best Regards,
Ulf Samuelsson