Search

Technical Discussion Group Forum

This forum is provided for user discussion. While Beacon EmbeddedWorks support staff and engineers participate, Beacon EmbeddedWorks does not guarantee the accuracy of all information within in the Technical Discussion Group (TDG).

The "Articles" forums provide brief Articles written by Beacon EmbeddedWorks engineers that address the most frequently asked technical questions.

To receive email notifications when updates are posted for a Beacon EmbeddedWorks product download, please subscribe to the TDG Forum of interest.

TDG Forum

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 06 Jul 2016 07:55 AM by  jduran.gm
Error compiling binutils
 8 Replies
Sort:
You are not authorized to post a reply.
Author Messages
jduran.gm
New Member
New Member
Posts:79


--
06 Jun 2016 05:49 AM

    Dear all,

    In the BSP 2.4-4 of torpedo wireless module, we select the gcc 4.6.1 compiler and the package 'oprofile'. Then, the compilation of binutils package (oprofile selects it) reports the following error:

     

    libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../bfd -I. -I. -I../../bfd -I../../bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../bfd/dwarf1.c -o dwarf1.o
    libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../bfd -I. -I. -I../../bfd -I../../bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../bfd/elf32-gen.c -o elf32-gen.o
    /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../bfd -I. -I. -I../../bfd -I../../bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c -o cpu-arm.lo ../../bfd/cpu-arm.c
    libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../bfd -I. -I. -I../../bfd -I../../bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../bfd/cpu-arm.c -o cpu-arm.o
    ../../bfd/elf-eh-frame.c: In function '_bfd_elf_eh_frame_section_offset':
    ../../bfd/elf-eh-frame.c:1220:29: error: variable 'hdr_info' set but not used [-Werror=unused-but-set-variable]
    cc1: all warnings being treated as errors

    make[4]: *** [elf-eh-frame.lo] Error 1
    make[4]: *** Waiting for unfinished jobs....
    ../../bfd/cpu-arm.c: In function 'arm_check_note':
    ../../bfd/cpu-arm.c:231:17: error: variable 'type' set but not used [-Werror=unused-but-set-variable]
    cc1: all warnings being treated as errors

    make[4]: *** [cpu-arm.lo] Error 1
    ../../bfd/elf.c: In function 'prep_headers':
    ../../bfd/elf.c:4854:23: error: variable 'i_shdrp' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf.c:4853:22: error: variable 'i_phdrp' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf.c: In function '_bfd_elf_write_object_contents':
    ../../bfd/elf.c:4971:22: error: variable 'i_ehdrp' set but not used [-Werror=unused-but-set-variable]
    cc1: all warnings being treated as errors

    ../../bfd/elf32-arm.c: In function 'record_cpu_erratum_veneer':
    ../../bfd/elf32-arm.c:3013:7: error: variable 'errcount' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'bfd_elf32_arm_vfp11_erratum_scan':
    ../../bfd/elf32-arm.c:4026:23: error: variable 'errcount' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'bfd_elf32_arm_janus_2cc_erratum_scan':
    ../../bfd/elf32-arm.c:4292:10: error: variable 'errcount' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'elf32_arm_final_link_relocate':
    ../../bfd/elf32-arm.c:4986:33: error: variable 'sym_hashes' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c:4985:23: error: variable 'symtab_hdr' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'elf32_arm_relocate_section':
    ../../bfd/elf32-arm.c:6942:16: error: variable 'warned' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'elf32_arm_check_relocs':
    ../../bfd/elf32-arm.c:8120:12: error: variable 'local_got_offsets' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'elf32_arm_ouput_plt_map_sym':
    ../../bfd/elf32-arm.c:10213:37: error: variable 'htab' set but not used [-Werror=unused-but-set-variable]
    cc1: all warnings being treated as errors

    make[4]: *** [elf.lo] Error 1

     

    How could we disable the compiler option '-Werror=unused-but-set-variable'?

     

    Thanks and Best Regards,

    Joaquim Duran

     

    jduran.gm
    New Member
    New Member
    Posts:79


    --
    08 Jun 2016 02:52 AM
    Have you reproduced the error?

    Joaquim Duran
    jduran.gm
    New Member
    New Member
    Posts:79


    --
    13 Jun 2016 07:37 AM
    Have you reproduced the issue?
    Adam Ford
    Advanced Member
    Advanced Member
    Posts:794


    --
    15 Jun 2016 11:05 AM
    Sorry about the delay. I just found out that the notifications from the forum were not getting sent, so we weren't notified anyone posted. I'm going to try and repoduce your problem, but I have a small backlog so it may take a bit.

    adam
    Adam Ford
    Advanced Member
    Advanced Member
    Posts:794


    --
    15 Jun 2016 12:14 PM
    I don't get the libtool error, but I do get a different message for a different package. When you switched to the 2.4-4 BSP, did you previously compile 2.4-3 on the same machine?

    Try rebuilding libtool with:

    ./ltib --hostcf -f -p libtool

    That still doesn't fix the issue I am seeing, but I am curious to see if that helps you get past that error.

    adam
    jduran.gm
    New Member
    New Member
    Posts:79


    --
    04 Jul 2016 08:58 AM
    Hello Adam,

    > When you switched to the 2.4-4 BSP, did you previously compile 2.4-3 on the same machine?

    No, I've compiled binutils from scratch. To reproduce the issue I follow the following steps:

    1 - Download the VM SDK from LogicPD (file 1027480_LogicPD_Linux_BSP_2.4-4.ova) and import them to the Virtual Box program.

    2 - Boot the new virtual machine and update the VirtualBox guest utils of the virtual machine to version 5.0.24. DO NOT update debian packages like libraries, linux kernel, programs,.... The version of libtool is:

    /usr/bin/libtool --help
    [...]
    host-triplet: x86_64-pc-linux-gnu
    shell: /bin/bash
    compiler: gcc
    compiler flags: -Wall -g -O2
    linker: /usr/bin/ld -m elf_x86_64 (gnu? yes)
    libtool: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1
    automake:
    autoconf:

    The virtual machine is ready.

    BSP 2.4-4 included in the VM

    Modify the BSP already included in the VM:

    1 - Open a terminal.
    2 - Change to BSP dir (cd ~/logic/Logic_BSPs/Linux_3.0/1027480_LogicPD_Linux_BSP_2.4-4)
    3 - Execute './ltib -c' to select gcc version 4.6.1 and select 'oprofile' package.

    Ltib rebuils all packages because the toolchain has been modified. The compilation of binutils fails:

     

    Download BSP 2.4-4

    Download the BSP 2.4-4 to the VM.

    1 - Download the file 1027480_LogicPD_Linux_BSP_2.4-4.tar.bz2 from LogicPD to the VM.
    2 - Uncompress the BSP.
    3 - Configure the BSP for a Wireless Torpedo module (./ltib -c --preconfig config/platform/omap_logic/defconfig), select gcc 4.6.1 as toolchain and select 'oprofile' package. Exit and save changes.

    When building binutils, the compilation fails:

    [CODE] /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../bfd -I. -I. -I../../bfd -I../../bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c -o elflink.lo ../../bfd/elflink.c ../../bfd/elf32-arm.c: In function 'record_cpu_erratum_veneer': ../../bfd/elf32-arm.c:3013:7: error: variable 'errcount' set but not used [-Werror=unused-but-set-variable] ../../bfd/elf32-arm.c: In function 'bfd_elf32_arm_vfp11_erratum_scan': ../../bfd/elf32-arm.c:4026:23: error: variable 'errcount' set but not used [-Werror=unused-but-set-variable] ../../bfd/elf32-arm.c: In function 'bfd_elf32_arm_janus_2cc_erratum_scan': ../../bfd/elf32-arm.c:4292:10: error: variable 'errcount' set but not used [-Werror=unused-but-set-variable] ../../bfd/elf32-arm.c: In function 'elf32_arm_final_link_relocate': ../../bfd/elf32-arm.c:4986:33: error: variable 'sym_hashes' set but not used [-Werror=unused-but-set-variable] ../../bfd/elf32-arm.c:4985:23: error: variable 'symtab_hdr' set but not used [-Werror=unused-but-set-variable] ../../bfd/elf32-arm.c: In function 'elf32_arm_relocate_section': ../../bfd/elf32-arm.c:6942:16: error: variable 'warned' set but not used [-Werror=unused-but-set-variable] ../../bfd/elf32-arm.c: In function 'elf32_arm_check_relocs': ../../bfd/elf32-arm.c:8120:12: error: variable 'local_got_offsets' set but not used [-Werror=unused-but-set-variable] ../../bfd/elf32-arm.c: In function 'elf32_arm_ouput_plt_map_sym': ../../bfd/elf32-arm.c:10213:37: error: variable 'htab' set but not used [-Werror=unused-but-set-variable] cc1: all warnings being treated as errors libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../bfd -I. -I. -I../../bfd -I../../bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../bfd/elf-vxworks.c -o elf-vxworks.o make[4]: *** [elf32-arm.lo] Error 1 make[4]: *** Waiting for unfinished jobs.... libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../bfd -I. -I. -I../../bfd -I../../bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../bfd/elf.c -o elf.o libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../bfd -I. -I. -I../../bfd -I../../bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../bfd/elflink.c -o elflink.o ../../bfd/elf.c: In function 'prep_headers': ../../bfd/elf.c:4854:23: error: variable 'i_shdrp' set but not used [-Werror=unused-but-set-variable] ../../bfd/elf.c:4853:22: error: variable 'i_phdrp' set but not used [-Werror=unused-but-set-variable] ../../bfd/elf.c: In function '_bfd_elf_write_object_contents': ../../bfd/elf.c:4971:22: error: variable 'i_ehdrp' set but not used [-Werror=unused-but-set-variable] cc1: all warnings being treated as errors


    I've rebuild libtool with the command that you included in the previous message in both BSPs, however the compilation of binutils has failed in both BSPs.

    Thanks and Best Regards,
    Joaquim Duran
    jduran.gm
    New Member
    New Member
    Posts:79


    --
    04 Jul 2016 09:08 AM
    (I reproduce the text contained in the frame of the previous message)

    libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../bfd -I. -I. -I../../bfd -I../../bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../bfd/elf-strtab.c -o elf-strtab.o
    ../../bfd/elf.c: In function 'prep_headers':
    ../../bfd/elf.c:4854:23: error: variable 'i_shdrp' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf.c:4853:22: error: variable 'i_phdrp' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf.c: In function '_bfd_elf_write_object_contents':
    ../../bfd/elf.c:4971:22: error: variable 'i_ehdrp' set but not used [-Werror=unused-but-set-variable]
    cc1: all warnings being treated as errors

    make[4]: *** [elf.lo] Error 1
    make[4]: *** Waiting for unfinished jobs....
    ../../bfd/elf32-arm.c: In function 'record_cpu_erratum_veneer':
    ../../bfd/elf32-arm.c:3013:7: error: variable 'errcount' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'bfd_elf32_arm_vfp11_erratum_scan':
    ../../bfd/elf32-arm.c:4026:23: error: variable 'errcount' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'bfd_elf32_arm_janus_2cc_erratum_scan':
    ../../bfd/elf32-arm.c:4292:10: error: variable 'errcount' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'elf32_arm_final_link_relocate':
    ../../bfd/elf32-arm.c:4986:33: error: variable 'sym_hashes' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c:4985:23: error: variable 'symtab_hdr' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'elf32_arm_relocate_section':
    ../../bfd/elf32-arm.c:6942:16: error: variable 'warned' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'elf32_arm_check_relocs':
    ../../bfd/elf32-arm.c:8120:12: error: variable 'local_got_offsets' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'elf32_arm_ouput_plt_map_sym':
    ../../bfd/elf32-arm.c:10213:37: error: variable 'htab' set but not used [-Werror=unused-but-set-variable]
    cc1: all warnings being treated as errors


    Download BSP 2.4-4

    1 - Download the file 1027480_LogicPD_Linux_BSP_2.4-4.tar.bz2 from LogicPD to the VM.
    2 - Uncompress the BSP.
    3 - Configure the BSP for a Wireless Torpedo module (./ltib -c --preconfig config/platform/omap_logic/defconfig), select gcc 4.6.1 as toolchain and select 'oprofile' package. Exit and save changes.

    When building binutils, the compilation fails:

    /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../bfd -I. -I. -I../../bfd -I../../bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c -o elflink.lo ../../bfd/elflink.c
    ../../bfd/elf32-arm.c: In function 'record_cpu_erratum_veneer':
    ../../bfd/elf32-arm.c:3013:7: error: variable 'errcount' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'bfd_elf32_arm_vfp11_erratum_scan':
    ../../bfd/elf32-arm.c:4026:23: error: variable 'errcount' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'bfd_elf32_arm_janus_2cc_erratum_scan':
    ../../bfd/elf32-arm.c:4292:10: error: variable 'errcount' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'elf32_arm_final_link_relocate':
    ../../bfd/elf32-arm.c:4986:33: error: variable 'sym_hashes' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c:4985:23: error: variable 'symtab_hdr' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'elf32_arm_relocate_section':
    ../../bfd/elf32-arm.c:6942:16: error: variable 'warned' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'elf32_arm_check_relocs':
    ../../bfd/elf32-arm.c:8120:12: error: variable 'local_got_offsets' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf32-arm.c: In function 'elf32_arm_ouput_plt_map_sym':
    ../../bfd/elf32-arm.c:10213:37: error: variable 'htab' set but not used [-Werror=unused-but-set-variable]
    cc1: all warnings being treated as errors

    libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../bfd -I. -I. -I../../bfd -I../../bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../bfd/elf-vxworks.c -o elf-vxworks.o
    make[4]: *** [elf32-arm.lo] Error 1
    make[4]: *** Waiting for unfinished jobs....
    libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../bfd -I. -I. -I../../bfd -I../../bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../bfd/elf.c -o elf.o
    libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../bfd -I. -I. -I../../bfd -I../../bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../bfd/elflink.c -o elflink.o
    ../../bfd/elf.c: In function 'prep_headers':
    ../../bfd/elf.c:4854:23: error: variable 'i_shdrp' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf.c:4853:22: error: variable 'i_phdrp' set but not used [-Werror=unused-but-set-variable]
    ../../bfd/elf.c: In function '_bfd_elf_write_object_contents':
    ../../bfd/elf.c:4971:22: error: variable 'i_ehdrp' set but not used [-Werror=unused-but-set-variable]
    cc1: all warnings being treated as errors
    Adam Ford
    Advanced Member
    Advanced Member
    Posts:794


    --
    05 Jul 2016 08:50 AM
    Reading through the logs, it appears to be caused by the default setting of -Werror.

    To disable this compiler flag, modify /home/logic/logic/Logic_BSPs/Linux_3.0/1027480_LogicPD_Linux_BSP_2.4-4/dist/lfs-5.1binutils/binutils.spec

    Line 73 needs to add the flag to disable treating errors as warnings. It should be modified to read:

    make CC_FOR_BUILD="${BUILDCC}" all CFLAGS="-Wno-error"


    This should fix the Binutils error.

    I ran into an additional error building oprofile and I found a find (at https://code.google.com/p/android/issues/detail?id=22003)


    If you get an error with oprofile, edit

    ./rpm/BUILD/oprofile-0.9.2/libpp/format_output.h


    Line 85 should be modified to read:
    counts_t & counts;


    From there it should be OK. Let me know if you have any issues.

    adam



    jduran.gm
    New Member
    New Member
    Posts:79


    --
    06 Jul 2016 07:55 AM
    Adam,

    Applying your changes it has been possible to compile oprofile.

    Great job!!

    Joaquim Duran
    You are not authorized to post a reply.