diff mbox

[2/2] xen: Remove TARGET_CONFIGURE_OPTS from make

Message ID 1473799504-20372-2-git-send-email-alistair.francis@xilinx.com
State Changes Requested
Headers show

Commit Message

Alistair Francis Sept. 13, 2016, 8:45 p.m. UTC
The TARGET_CONFIGURE_OPTS variable resulted in a double definition
error:
<command-line>:0:0: error: "__OBJECT_FILE__" redefined [-Werror]

Remove the options to avoid the error.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
---
 package/xen/xen.mk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Arnout Vandecappelle Sept. 13, 2016, 11:23 p.m. UTC | #1
On 13-09-16 22:45, Alistair Francis wrote:
> The TARGET_CONFIGURE_OPTS variable resulted in a double definition
> error:
> <command-line>:0:0: error: "__OBJECT_FILE__" redefined [-Werror]
> 
> Remove the options to avoid the error.

 This doesn't look right. TARGET_CONFIGURE_OPTS definitely doesn't contain
-D__OBJECT_FILE__ (or you have some very weird stuff in BR2_TARGET_OPTIMIZATION).

 How did you get this error? Can you print the full command line (by setting
BR2_DEBUG_WRAPPER=1 in the environment) to find out how it gets defined twice?

 Regards,
 Arnout

> 
> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
> ---
>  package/xen/xen.mk | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/package/xen/xen.mk b/package/xen/xen.mk
> index e2c797f..8400a77 100644
> --- a/package/xen/xen.mk
> +++ b/package/xen/xen.mk
> @@ -22,8 +22,7 @@ XEN_CONF_OPTS = --disable-ocamltools
>  XEN_CONF_ENV = PYTHON=$(HOST_DIR)/usr/bin/python2
>  XEN_MAKE_ENV = \
>  	XEN_TARGET_ARCH=$(XEN_ARCH) \
> -	CROSS_COMPILE=$(TARGET_CROSS) \
> -	$(TARGET_CONFIGURE_OPTS)
> +	CROSS_COMPILE=$(TARGET_CROSS)
>  
>  ifeq ($(BR2_PACKAGE_XEN_HYPERVISOR),y)
>  XEN_MAKE_OPTS += dist-xen
>
Thomas Petazzoni Sept. 17, 2016, 2:09 p.m. UTC | #2
Hello,

On Wed, 14 Sep 2016 01:23:32 +0200, Arnout Vandecappelle wrote:
> On 13-09-16 22:45, Alistair Francis wrote:
> > The TARGET_CONFIGURE_OPTS variable resulted in a double definition
> > error:
> > <command-line>:0:0: error: "__OBJECT_FILE__" redefined [-Werror]
> > 
> > Remove the options to avoid the error.  
> 
>  This doesn't look right. TARGET_CONFIGURE_OPTS definitely doesn't
> contain -D__OBJECT_FILE__ (or you have some very weird stuff in
> BR2_TARGET_OPTIMIZATION).

It doesn't look right, but it's actually what happens. When we pass our
TARGET_CONFIGURE_OPTS, what happens is:

/home/thomas/projets/buildroot/output/host/usr/bin/aarch64-linux-gnu-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable
-Wno-unused-local-typedefs -DNDEBUG -nostdinc -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include /home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include/xen/config.h '-D__OBJECT_FILE__="/home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/xen"' -Wa,--strip-local-absolute -MMD -MF /home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/.xen.d -mcpu=generic -mgeneral-regs-only -I/home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include -fno-stack-protector -fno-exceptions -Wnested-externs -DGCC_HAS_VISIBILITY_ATTRIBUTE -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -DNDEBUG -nostdinc -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include /home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include/xen/config.h '-D__OBJECT_FILE__="asm-offsets.s"' -Wa,--strip-local-absolute -MMD -MF ./.asm-offsets.s.d -mcpu=generic -mgeneral-regs-only -I/home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include -fno-stack-protector -fno-exceptions -Wnested-externs -DGCC_HAS_VISIBILITY_ATTRIBUTE -S -o asm-offsets.s arm64/asm-offsets.c
<command-line>:0:0: error: "__OBJECT_FILE__" redefined [-Werror]
<command-line>:0:0: note: this is the location of the previous definition
cc1: all warnings being treated as errors
Makefile:103: recipe for target 'asm-offsets.s' failed
make[5]: *** [asm-offsets.s] Error 1

So _OBJECT_FILE_ is really defined twice, once incorrectly, and the
second time correctly.

When we stop passing $(TARGET_CONFIGURE_OPTS), the same compilation
step looks like this:

/home/thomas/projets/buildroot/output/host/usr/bin/aarch64-linux-gnu-gcc -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -DNDEBUG -nostdinc -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include /home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include/xen/config.h '-D__OBJECT_FILE__="asm-offsets.s"' -Wa,--strip-local-absolute -MMD -MF ./.asm-offsets.s.d -mcpu=generic -mgeneral-regs-only -I/home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include -fno-stack-protector -fno-exceptions -Wnested-externs -DGCC_HAS_VISIBILITY_ATTRIBUTE -S -o asm-offsets.s arm64/asm-offsets.c

And the build succeeds.

So apparently, the fact that we are passing our own CFLAGS confuses the
Xen build system, which then adds its own CFLAGS twice for some reason.

Thomas
Thomas Petazzoni Sept. 17, 2016, 2:44 p.m. UTC | #3
Hello,

On Sat, 17 Sep 2016 16:09:47 +0200, Thomas Petazzoni wrote:

> So apparently, the fact that we are passing our own CFLAGS confuses the
> Xen build system, which then adds its own CFLAGS twice for some reason.

Looking at the Xen Git history, this __OBJECT_FILE__ definition is new
in 4.7.0 and did not exist in 4.6.0. So, this "duplication" of CFLAGS
most likely already occurred with Xen 4.6.0, but was not noticed due to
the fact that all other options can be passed several times.

Thomas
Alistair Francis Sept. 19, 2016, 6:41 p.m. UTC | #4
On Sat, Sep 17, 2016 at 7:09 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Hello,
>
> On Wed, 14 Sep 2016 01:23:32 +0200, Arnout Vandecappelle wrote:
>> On 13-09-16 22:45, Alistair Francis wrote:
>> > The TARGET_CONFIGURE_OPTS variable resulted in a double definition
>> > error:
>> > <command-line>:0:0: error: "__OBJECT_FILE__" redefined [-Werror]
>> >
>> > Remove the options to avoid the error.
>>
>>  This doesn't look right. TARGET_CONFIGURE_OPTS definitely doesn't
>> contain -D__OBJECT_FILE__ (or you have some very weird stuff in
>> BR2_TARGET_OPTIMIZATION).
>
> It doesn't look right, but it's actually what happens. When we pass our
> TARGET_CONFIGURE_OPTS, what happens is:
>
> /home/thomas/projets/buildroot/output/host/usr/bin/aarch64-linux-gnu-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable
> -Wno-unused-local-typedefs -DNDEBUG -nostdinc -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include /home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include/xen/config.h '-D__OBJECT_FILE__="/home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/xen"' -Wa,--strip-local-absolute -MMD -MF /home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/.xen.d -mcpu=generic -mgeneral-regs-only -I/home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include -fno-stack-protector -fno-exceptions -Wnested-externs -DGCC_HAS_VISIBILITY_ATTRIBUTE -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall
> -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -DNDEBUG -nostdinc -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include /home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include/xen/config.h '-D__OBJECT_FILE__="asm-offsets.s"' -Wa,--strip-local-absolute -MMD -MF ./.asm-offsets.s.d -mcpu=generic -mgeneral-regs-only -I/home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include -fno-stack-protector -fno-exceptions -Wnested-externs -DGCC_HAS_VISIBILITY_ATTRIBUTE -S -o asm-offsets.s arm64/asm-offsets.c
> <command-line>:0:0: error: "__OBJECT_FILE__" redefined [-Werror]
> <command-line>:0:0: note: this is the location of the previous definition
> cc1: all warnings being treated as errors
> Makefile:103: recipe for target 'asm-offsets.s' failed
> make[5]: *** [asm-offsets.s] Error 1
>
> So _OBJECT_FILE_ is really defined twice, once incorrectly, and the
> second time correctly.
>
> When we stop passing $(TARGET_CONFIGURE_OPTS), the same compilation
> step looks like this:
>
> /home/thomas/projets/buildroot/output/host/usr/bin/aarch64-linux-gnu-gcc -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -DNDEBUG -nostdinc -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include /home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include/xen/config.h '-D__OBJECT_FILE__="asm-offsets.s"' -Wa,--strip-local-absolute -MMD -MF ./.asm-offsets.s.d -mcpu=generic -mgeneral-regs-only -I/home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include -fno-stack-protector -fno-exceptions -Wnested-externs -DGCC_HAS_VISIBILITY_ATTRIBUTE -S -o asm-offsets.s arm64/asm-offsets.c
>
> And the build succeeds.
>
> So apparently, the fact that we are passing our own CFLAGS confuses the
> Xen build system, which then adds its own CFLAGS twice for some reason.

That is exactly what I see as well.

It was surprising to me as well, but the only way I could figure out
how to fix this build issue was to remove the flags.

Is this an acceptable solution, or do I need to look at the Xen build
system and patch that to not add the duplicate options?

Thanks,

Alistair

>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Alistair Francis Oct. 3, 2016, 6:06 p.m. UTC | #5
On Mon, Sep 19, 2016 at 11:41 AM, Alistair Francis
<alistair.francis@xilinx.com> wrote:
> On Sat, Sep 17, 2016 at 7:09 AM, Thomas Petazzoni
> <thomas.petazzoni@free-electrons.com> wrote:
>> Hello,
>>
>> On Wed, 14 Sep 2016 01:23:32 +0200, Arnout Vandecappelle wrote:
>>> On 13-09-16 22:45, Alistair Francis wrote:
>>> > The TARGET_CONFIGURE_OPTS variable resulted in a double definition
>>> > error:
>>> > <command-line>:0:0: error: "__OBJECT_FILE__" redefined [-Werror]
>>> >
>>> > Remove the options to avoid the error.
>>>
>>>  This doesn't look right. TARGET_CONFIGURE_OPTS definitely doesn't
>>> contain -D__OBJECT_FILE__ (or you have some very weird stuff in
>>> BR2_TARGET_OPTIMIZATION).
>>
>> It doesn't look right, but it's actually what happens. When we pass our
>> TARGET_CONFIGURE_OPTS, what happens is:
>>
>> /home/thomas/projets/buildroot/output/host/usr/bin/aarch64-linux-gnu-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable
>> -Wno-unused-local-typedefs -DNDEBUG -nostdinc -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include /home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include/xen/config.h '-D__OBJECT_FILE__="/home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/xen"' -Wa,--strip-local-absolute -MMD -MF /home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/.xen.d -mcpu=generic -mgeneral-regs-only -I/home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include -fno-stack-protector -fno-exceptions -Wnested-externs -DGCC_HAS_VISIBILITY_ATTRIBUTE -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall
>> -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -DNDEBUG -nostdinc -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include /home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include/xen/config.h '-D__OBJECT_FILE__="asm-offsets.s"' -Wa,--strip-local-absolute -MMD -MF ./.asm-offsets.s.d -mcpu=generic -mgeneral-regs-only -I/home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include -fno-stack-protector -fno-exceptions -Wnested-externs -DGCC_HAS_VISIBILITY_ATTRIBUTE -S -o asm-offsets.s arm64/asm-offsets.c
>> <command-line>:0:0: error: "__OBJECT_FILE__" redefined [-Werror]
>> <command-line>:0:0: note: this is the location of the previous definition
>> cc1: all warnings being treated as errors
>> Makefile:103: recipe for target 'asm-offsets.s' failed
>> make[5]: *** [asm-offsets.s] Error 1
>>
>> So _OBJECT_FILE_ is really defined twice, once incorrectly, and the
>> second time correctly.
>>
>> When we stop passing $(TARGET_CONFIGURE_OPTS), the same compilation
>> step looks like this:
>>
>> /home/thomas/projets/buildroot/output/host/usr/bin/aarch64-linux-gnu-gcc -O2 -fomit-frame-pointer -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -DNDEBUG -nostdinc -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include /home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include/xen/config.h '-D__OBJECT_FILE__="asm-offsets.s"' -Wa,--strip-local-absolute -MMD -MF ./.asm-offsets.s.d -mcpu=generic -mgeneral-regs-only -I/home/thomas/projets/buildroot/output/build/xen-4.7.0/xen/include -fno-stack-protector -fno-exceptions -Wnested-externs -DGCC_HAS_VISIBILITY_ATTRIBUTE -S -o asm-offsets.s arm64/asm-offsets.c
>>
>> And the build succeeds.
>>
>> So apparently, the fact that we are passing our own CFLAGS confuses the
>> Xen build system, which then adds its own CFLAGS twice for some reason.
>
> That is exactly what I see as well.
>
> It was surprising to me as well, but the only way I could figure out
> how to fix this build issue was to remove the flags.
>
> Is this an acceptable solution, or do I need to look at the Xen build
> system and patch that to not add the duplicate options?

Any opinions? I would like to fix the build issue soon.

Thanks,

Alistair

>
> Thanks,
>
> Alistair
>
>>
>> Thomas
>> --
>> Thomas Petazzoni, CTO, Free Electrons
>> Embedded Linux and Kernel engineering
>> http://free-electrons.com
>> _______________________________________________
>> buildroot mailing list
>> buildroot@busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot
Thomas Petazzoni Oct. 22, 2016, 9:18 p.m. UTC | #6
Hello,

On Tue, 13 Sep 2016 13:45:04 -0700, Alistair Francis wrote:
> The TARGET_CONFIGURE_OPTS variable resulted in a double definition
> error:
> <command-line>:0:0: error: "__OBJECT_FILE__" redefined [-Werror]
> 
> Remove the options to avoid the error.
> 
> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>

Yann told me that you found the root cause of the problem during a
short investigation session at ELCE.

Could you share what the conclusion was? When do you expect to submit a
patch?

In the mean time, I've marked
https://patchwork.ozlabs.org/patch/669641/ as Rejected, since this is
clearly not the proper fix for the problem.

Thanks!

Thomas
Alistair Francis Oct. 24, 2016, 7:19 a.m. UTC | #7
On Sat, Oct 22, 2016 at 11:18 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Hello,
>
> On Tue, 13 Sep 2016 13:45:04 -0700, Alistair Francis wrote:
>> The TARGET_CONFIGURE_OPTS variable resulted in a double definition
>> error:
>> <command-line>:0:0: error: "__OBJECT_FILE__" redefined [-Werror]
>>
>> Remove the options to avoid the error.
>>
>> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
>
> Yann told me that you found the root cause of the problem during a
> short investigation session at ELCE.

Hey Thomas,

Yeah, I talked to Yann and we worked out the problem and a hopeful fix.

>
> Could you share what the conclusion was? When do you expect to submit a
> patch?

I'm still traveling at the moment, but I should be able to send out
the new patch this week with an explanation.

>
> In the mean time, I've marked
> https://patchwork.ozlabs.org/patch/669641/ as Rejected, since this is
> clearly not the proper fix for the problem.

Sounds good to me.

Thanks,

Alistair

>
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
diff mbox

Patch

diff --git a/package/xen/xen.mk b/package/xen/xen.mk
index e2c797f..8400a77 100644
--- a/package/xen/xen.mk
+++ b/package/xen/xen.mk
@@ -22,8 +22,7 @@  XEN_CONF_OPTS = --disable-ocamltools
 XEN_CONF_ENV = PYTHON=$(HOST_DIR)/usr/bin/python2
 XEN_MAKE_ENV = \
 	XEN_TARGET_ARCH=$(XEN_ARCH) \
-	CROSS_COMPILE=$(TARGET_CROSS) \
-	$(TARGET_CONFIGURE_OPTS)
+	CROSS_COMPILE=$(TARGET_CROSS)
 
 ifeq ($(BR2_PACKAGE_XEN_HYPERVISOR),y)
 XEN_MAKE_OPTS += dist-xen