Bug 8256

Summary: pointing to /usr/bin/objcopy old version (x86) instead of the generated one
Product: buildroot Reporter: CB <christophebricout>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: minor CC: buildroot
Priority: P5    
Version: 2015.05   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:
Attachments: gmake logfile (issue.txt)
configuration execution issue within grub2-2.00 directory
output/build/grub2-2.00/config.log (gzipped) content

Description CB 2015-08-05 10:43:26 UTC
using the default configuration file to target MINNOWMAX board, buildroot
unable to generate x86_64 binary as gmake process points to the host /usr/bin/objcopy (i586 architecture) and not the copyobj generated in the output directory.

Is a option available?
Best Regards
Comment 1 Thomas Petazzoni 2015-08-05 13:23:22 UTC
Thanks for your bug report. Can you first make sure that you can reproduce the issue after doing a full rebuild, i.e after doing "make clean all" ?

Once you have verified this, could you please give us:

 
 - The Buildroot version you're using
 - The exact steps to reproduce the issue

 - What you mean exactly by "gmake process points to the host /usr/bin/objcopy". make doesn't "point" to anything, so this sentence doesn't make a lot of sense.

Also, please attach the last 100 lines of the build output, which contain the build failure you're seeing. Thanks!
Comment 2 CB 2015-08-05 14:05:06 UTC
Host configuration
    [elinux]$echo ${HOSTTYPE}
    [elinux] i386-linux

Buildroot Inital step:
     the .config file is exactly the same as generated
     by 'gmake minnowboard_max_defconfig'

history:

    10  15:12   gmake
    11  15:41   history


checking if C symbols get an underscore after compilation... no
checking for __bswapsi2... no
checking for __bswapdi2... no
checking for __ashldi3... no
checking for __ashrdi3... no
checking for __lshrdi3... no
checking for __trampoline_setup... no
checking for __ucmpdi2... no
checking for _restgpr_14_x... no
checking for __ia64_trampoline... no
checking for __udivsi3... no
checking for __umoddi3... no
checking for __udivdi3... no
checking for __divsi3... no
checking for __modsi3... no
checking for __umodsi3... no
checking for __moddi3... no
checking for __divdi3... no
checking for __ctzdi2... no
checking for __ctzsi2... no
checking whether target compiler is working... yes
checking whether /usr/bin/objcopy works for absolute addresses... configure: error: /usr/bin/objcopy cannot create binary files
gmake: *** [/home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/build/grub2-2.00/.stamp_configured] Error 1


Further investigation results:

Before launcing gmake, I have  now executed the following command

setenv PATH "/home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/host/usr/x86_64-buildroot-linux-uclibc/bin:/home/elinu
x/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/host/usr/bin:${PATH}"
set PATH = "/home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/host/usr/x86_64-buildroot-linux-uclibc/bin:/home/elinux
/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/host/usr/bin:${PATH}"

The new result is

checking target system type... x86_64-pc-none
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for x86_64-buildroot-linux-uclibc-strip... /home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/host/usr/bin/x86_64-buildroot-linux-uclibc-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for cmp... cmp
checking for bison... bison
checking for x86_64-buildroot-linux-uclibc-ranlib... /home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/host/usr/x86_64-buildroot-linux-uclibc/bin/ranlib
checking for gawk... (cached) gawk
checking for style of include used by make... GNU
checking for x86_64-buildroot-linux-uclibc-gcc... /home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/host/usr/x86_64-buildroot-linux-uclibc/bin/gcc
checking whether the C compiler works... no
configure: error: in `/home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/build/grub2-2.00':
configure: error: C compiler cannot create executables
See `config.log' for more details
gmake: *** [/home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/build/grub2-2.00/.stamp_configured] Error 77

(In reply to comment #1)
> Thanks for your bug report. Can you first make sure that you can reproduce the
> issue after doing a full rebuild, i.e after doing "make clean all" ?
> 
> Once you have verified this, could you please give us:
> 
> 
>  - The Buildroot version you're using
>  - The exact steps to reproduce the issue
> 
>  - What you mean exactly by "gmake process points to the host
> /usr/bin/objcopy". make doesn't "point" to anything, so this sentence doesn't
> make a lot of sense.
> 
> Also, please attach the last 100 lines of the build output, which contain the
> build failure you're seeing. Thanks!

(In reply to comment #1)
> Thanks for your bug report. Can you first make sure that you can reproduce the
> issue after doing a full rebuild, i.e after doing "make clean all" ?
> 
> Once you have verified this, could you please give us:
> 
> 
>  - The Buildroot version you're using
>  - The exact steps to reproduce the issue
> 
>  - What you mean exactly by "gmake process points to the host
> /usr/bin/objcopy". make doesn't "point" to anything, so this sentence doesn't
> make a lot of sense.
> 
> Also, please attach the last 100 lines of the build output, which contain the
> build failure you're seeing. Thanks!
Comment 3 CB 2015-08-05 14:18:34 UTC
Created attachment 6131 [details]
gmake logfile (issue.txt)

Here the command executed in order to collect the information
===============================
gmake >! issue.txt
configure: WARNING: unrecognized options: --disable-gtk-doc, --disable-gtk-doc-html, --disable-doc, --disable-docs, --disable-documentation, --with-xmlto, --with-fop, --enable-ipv6, --disable-debug, --disable-static, --enable-shared, --enable-liblzma
configure: WARNING: cannot generate manual pages while cross compiling
configure: error: /usr/bin/objcopy cannot create binary files
gmake: *** [/home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/build/grub2-2.00/.stamp_configured] Error 1
===============================
The issue.txt file is enclosed.

I am available for futher concerns
Thanks a lot.
Comment 4 Thomas Petazzoni 2015-08-05 21:17:50 UTC
Why are you using 'gmake' instead of 'make' ? Are you perhaps building on a non-Linux system? If so, which one?
Comment 5 CB 2015-08-06 12:20:17 UTC
The OS is  RedHat 5 running on a X86 machine (32bits)

I am using "gmake" to build "buildroot 2005.05" but I could use "make". The result should be the same.

For information, I have already build successfully "buildroot" using the same procedure "gmake" and
I sucessfully generated toolchain, Uimage, uboot.bin for others targets like "freescale sabre board" and others.

So, this issue "could be" linked to Minnow Max Target or X86_64 toolchain running on a x86(32bits) host.   

Thanks again.

(In reply to comment #4)
> Why are you using 'gmake' instead of 'make' ? Are you perhaps building on a
> non-Linux system? If so, which one?
Comment 6 CB 2015-08-12 19:48:11 UTC
(In reply to comment #4)
> Why are you using 'gmake' instead of 'make' ? Are you perhaps building on a
> non-Linux system? If so, which one?

As you suggested, I executed the MakeFile using "make" instead of "gmake" command.
The result is exactly the same (same reports, same errors).

Do you have an idea for the next steps or experiments I need to do.

Thanks in advance for your support.
Comment 7 CB 2015-08-13 19:43:17 UTC
Created attachment 6136 [details]
configuration execution issue within grub2-2.00 directory

Updating PATH variable before running 'make'.
The compilation go further but an error is still occuring.
configure:4778: error: in `<...>/buildroot-2015.05/output/build/grub2-2.00'
Comment 8 Arnout Vandecappelle 2015-08-24 21:15:44 UTC
(In reply to comment #2)

> Before launcing gmake, I have  now executed the following command
> 
> setenv PATH
> "/home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/host/usr/x86_64-buildroot-linux-uclibc/bin:/home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/host/usr/bin:${PATH}"
> set PATH = "/home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/host/usr/x86_64-buildroot-linux-uclibc/bin:/home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/host/usr/bin:${PATH}"

I don't know why you think it's a good idea to add the target binaries to your PATH. Don't do that.

The config.log of attachment 6136 [details] is useless. Could you re-run a clean build without hacking PATH, and then attach the full output/build/grub2-2.00/config.log please?

My conjecture is that grub2 is using the wrong objcopy somewhere in configure.
Oh, indeed, now I see: we use HOST_CONFIGURE_OPTS, so it will have OBJCOPY=/usr/bin/objcopy explicitly. I guess we should override that with OBJCOPY=$(TARGET_OBJCOPY), but I'm not sure how that will affect other host,target combinations...
Comment 9 CB 2015-08-25 08:53:03 UTC
Thanks for your feedback.

I will execute the buildroot as requested and provide you with the config log.

In parallel, I launched buildroot using Virtual Box and CENTOS 7.
Buildroot is correcty working as the host 'objcopy' utility is using 
a compatible version allowing x86_64 binary.
It seem confirm your guess concerning 'objcopy' version differs between Host and Target. This is my case under RedHat Linux 5 (eq Centos 5). This issue doesn't exist under Centos 7. 


Thanks again.
 

(In reply to comment #8)
> (In reply to comment #2)
> 
> > Before launcing gmake, I have  now executed the following command
> > 
> > setenv PATH
> > "/home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/host/usr/x86_64-buildroot-linux-uclibc/bin:/home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/host/usr/bin:${PATH}"
> > set PATH = "/home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/host/usr/x86_64-buildroot-linux-uclibc/bin:/home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/host/usr/bin:${PATH}"
> 
> I don't know why you think it's a good idea to add the target binaries to your
> PATH. Don't do that.
> 
> The config.log of attachment 6136 [details] is useless. Could you re-run a clean build
> without hacking PATH, and then attach the full
> output/build/grub2-2.00/config.log please?
> 
> My conjecture is that grub2 is using the wrong objcopy somewhere in configure.
> Oh, indeed, now I see: we use HOST_CONFIGURE_OPTS, so it will have
> OBJCOPY=/usr/bin/objcopy explicitly. I guess we should override that with
> OBJCOPY=$(TARGET_OBJCOPY), but I'm not sure how that will affect other
> host,target combinations...
Comment 10 CB 2015-08-25 19:46:13 UTC
Created attachment 6146 [details]
output/build/grub2-2.00/config.log (gzipped) content

Please fine here after the sequence history

  
    97  20:51   make clean
    98  20:54   make
    99  21:32   cd /home/elinux/localinstall/buildroot-2015.05/install/buildroot-2015.05/output/build/grub2-2.00
   100  21:32   ls
   101  21:32   more config.log

The attachment is the config.log from grub2-2.00

Available for others experiments if necessary.
Tnanks.
Comment 11 Thomas Petazzoni 2015-09-20 12:56:09 UTC
Fixed by http://git.buildroot.net/buildroot/commit/?id=890c9e761b70f28c2f2d6c4cf389e418c6d2b32c. Thanks Arnout for the investigation and fix!