Compilation gcc 4.6.2 (cannot compute suffix of object files)

前端 未结 2 944
春和景丽
春和景丽 2021-02-19 07:51

Problem when compiling gcc 4.6.2:

checking for avr-gcc... /data/data6/soft/src_build/gcc-4.6.2/host-x86_64-unknown-linux-gnu/gcc/xgcc -B/data/data6/soft/src_buil         


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-02-19 08:06

    I had the same problem cross-compiling for mips.

    Step one: Cross-compile the binutils for your target. Install them somewhere sane. I use /usr/local/[target]-gcc

    Make sure you configure them with --program-prefix=[target]-

    Something like (untested):

    configure --prefix=/usr/local/avr-gcc --program-prefix=avr- --target=avr
    

    Then you need to set up some environment variables so GCC can find them:

    export AR_FOR_TARGET=/usr/local/avr-gcc/bin/avr-ar
    export LD_FOR_TARGET=/usr/local/avr-gcc/bin/avr-ld
    export OBJDUMP_FOR_TARGET=/usr/local/avr-gcc/bin/avr-objdump
    export NM_FOR_TARGET=/usr/local/avr-gcc/bin/avr-nm
    export RANLIB_FOR_TARGET=/usr/local/avr-gcc/bin/avr-ranlib
    export READELF_FOR_TARGET=/usr/local/avr-gcc/bin/avr-readelf
    export STRIP_FOR_TARGET=/usr/local/avr-gcc/bin/avr-strip
    export AS_FOR_TARGET=/usr/local/avr-gcc/bin/avr-as
    

    Now you can configure and compile GCC. Ensure you start from a completely empty build directory, otherwise gcc/as etc won't get recreated.

提交回复
热议问题