Re: avr/bin/ld: skipping incompatible /usr/lib/gcc/avr/4.9.0/libgcc.a when searching for -lgcc

Paolo Patruno <[email protected]>
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <[email protected]>
Thanks Senthil,
the library in the build tree is OK, so I found that the problem is in
the rpm build macros, I think in binary stripping in rpmbuild.
I have disabled it and it works well now !
The rpm macro __os_install_post is defined to execute these scripts. The
scripts used to compress the binary file size are as follows.
        $ rpm --showrc | grep -A 4 ': __os_install_post'
        -14: __os_install_post	
            %{_rpmconfigdir}/brp-compress 
            %{_rpmconfigdir}/brp-strip %{__strip} 
            %{_rpmconfigdir}/brp-strip-static-archive %{__strip} 
            %{_rpmconfigdir}/brp-strip-comment-note %{__strip}
        %{__objdump} 

To prevent binary stripping for this rpm, I have added the following
line at the top of the rpm spec file.
        %global __os_install_post %{nil}

Thanks

Paolo

Il giorno lun, 24/03/2014 alle 12.55 +0530, Senthil Kumar Selvaraj ha
scritto:
> On Sat, Mar 22, 2014 at 01:29:56PM +0100, Paolo Patruno wrote:
> > I want try to use gcc 4.9.
> > Starting from a working toolchain of Fedora 19 with avr-gcc 4.8; I get
> > the last snapshot and buid it inside rpm build system with:
> > ../gcc-4.9/configure --prefix=/usr --mandir=/usr/share/man
> > --infodir=/usr/share/info --target=avr --enable-languages=c,c++ -
> > -disable-nls --disable-libssp --with-system-zlib
> > --enable-version-specific-runtime-libs --with-pkgversion=Fedora
> > 4.9-1.fc19 --with-bugurl=https://bugzilla.redhat.com/
> > 
> > I install the rpm and compile works well but at link stage:
> > 
> > /usr/bin/avr-gcc -mmcu=atmega328p -Wl,--gc-sections -Wl,-Map -Wl,t.map -o .build/uno/firmware.elf .build/uno/src/helloworld_rx.o -v
> > Using built-in specs.
> > COLLECT_GCC=/usr/bin/avr-gcc
> > COLLECT_LTO_WRAPPER=/usr/libexec/gcc/avr/4.9.0/lto-wrapper
> > Target: avr
> > Configured with: ../gcc-4.9/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-system-zlib --enable-version-specific-runtime-libs --with-pkgversion='Fedora 4.9-1.fc19' --with-bugurl=https://bugzilla.redhat.com/
> > Thread model: single
> > gcc version 4.9.0 20140316 (experimental) (Fedora 4.9-1.fc19) 
> > COMPILER_PATH=/usr/libexec/gcc/avr/4.9.0/:/usr/libexec/gcc/avr/4.9.0/:/usr/libexec/gcc/avr/:/usr/lib/gcc/avr/4.9.0/:/usr/lib/gcc/avr/:/usr/lib/gcc/avr/4.9.0/../../../../avr/bin/
> > LIBRARY_PATH=/usr/lib/gcc/avr/4.9.0/avr5/:/usr/lib/gcc/avr/4.9.0/../../../../avr/lib/avr5/:/usr/lib/gcc/avr/4.9.0/:/usr/lib/gcc/avr/4.9.0/../../../../avr/lib/
> > COLLECT_GCC_OPTIONS='-mmcu=atmega328p' '-o' '.build/uno/firmware.elf' '-v'
> >  /usr/libexec/gcc/avr/4.9.0/collect2 -plugin /usr/libexec/gcc/avr/4.9.0/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/avr/4.9.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccaF7CSb.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lm -plugin-opt=-pass-through=-lc -m avr5 -Tdata 0x800100 -o .build/uno/firmware.elf /usr/lib/gcc/avr/4.9.0/../../../../avr/lib/avr5/crtm328p.o -L/usr/lib/gcc/avr/4.9.0/avr5 -L/usr/lib/gcc/avr/4.9.0/../../../../avr/lib/avr5 -L/usr/lib/gcc/avr/4.9.0 -L/usr/lib/gcc/avr/4.9.0/../../../../avr/lib --gc-sections -Map t.map .build/uno/src/helloworld_rx.o --start-group -lgcc -lm -lc --end-group
> > /usr/lib/gcc/avr/4.9.0/../../../../avr/bin/ld: skipping incompatible /usr/lib/gcc/avr/4.9.0/avr5/libgcc.a when searching for -lgcc
> > /usr/lib/gcc/avr/4.9.0/../../../../avr/bin/ld: skipping incompatible /usr/lib/gcc/avr/4.9.0/libgcc.a when searching for -lgcc
> > /usr/lib/gcc/avr/4.9.0/../../../../avr/bin/ld: cannot find -lgcc
> > collect2: error: ld returned 1 exit status
> > 
> > 
> > objdump results:
> > 
> > avr-objdump -f .build/uno/src/helloworld_rx.o
> > 
> > .build/uno/src/helloworld_rx.o:     file format elf32-avr
> > architecture: avr:5, flags 0x00000011:
> > HAS_RELOC, HAS_SYMS
> > start address 0x00000000
> > 
> > 
> > 
> > avr-objdump -f /usr/lib/gcc/avr/4.9.0/avr5/libgcc.a|head -n 20
> > In archive /usr/lib/gcc/avr/4.9.0/avr5/libgcc.a:
> > 
> > _absvhi2.o:     file format elf32-little
> > architecture: UNKNOWN!, flags 0x00000011:
> > HAS_RELOC, HAS_SYMS
> > start address 0x00000000
> > 
> 
> That's weird - can you check the configure/make logs in the build folder
> to see how this was compiled?
> 
> FWIW, with the latest sources of binutils and gcc, this is the output on
> my machine.
> 
> $ ~/scratch/avr/install/bin/avr-objdump -f
> /home/saaadhu/scratch/avr/install/lib/gcc/avr/4.9.0/avr5/libgcc.a | head -n20
> In archive /home/saaadhu/scratch/avr/install/lib/gcc/avr/4.9.0/avr5/libgcc.a:
> 
> _absvhi2.o:     file format elf32-avr
> architecture: avr:5, flags 0x00000011:
> HAS_RELOC, HAS_SYMS
> start address 0x00000000
> 
> 
> _addvhi3.o:     file format elf32-avr
> architecture: avr:5, flags 0x00000011:
> HAS_RELOC, HAS_SYMS
> start address 0x00000000
> 
> 
> _subvhi3.o:     file format elf32-avr
> architecture: avr:5, flags 0x00000011:
> HAS_RELOC, HAS_SYMS
> start address 0x00000000
> 
> 
> $ ~/scratch/avr/install/bin/avr-as -v
> GNU assembler version 2.24.51 (avr) using BFD version (GNU Binutils)
> 2.24.51.20131021
> ^C
> 
> Regards
> Senthil
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.