Skip to main content
smrtkai
Associate III
December 13, 2018
Question

Compile with Makefile on Ubuntu 18.04 LTS

  • December 13, 2018
  • 4 replies
  • 2644 views

Hi,

I am trying to compile a generated Makefile project on an Ubuntu machine (18.04 LTS). The compilation works fine on Windows 10.

But on Ubuntu, I get the following error:

kai@ubuntu:~/workspace/makefile_test$ make
arm-none-eabi-gcc build/main.o build/stm32f4xx_it.o build/stm32f4xx_hal_msp.o build/stm32f4xx_hal_tim.o build/stm32f4xx_hal_tim_ex.o build/stm32f4xx_hal_rcc.o build/stm32f4xx_hal_rcc_ ex.o build/stm32f4xx_hal_flash.o build/stm32f4xx_hal_flash_ex.o build/stm32f4xx_hal_flash_ramfunc.o build/stm32f4xx_hal_gpio.o build/stm32f4xx_hal_dma_ex.o build/stm32f4xx_hal_dma.o b uild/stm32f4xx_hal_pwr.o build/stm32f4xx_hal_pwr_ex.o build/stm32f4xx_hal_cortex.o build/stm32f4xx_hal.o build/system_stm32f4xx.o build/startup_stm32f429xx.o -mcpu=cortex-m4 -mthumb - mfpu=fpv4-sp-d16 -mfloat-abi=hard -specs=nano.specs -TSTM32F429ZITx_FLASH.ld -lc -lm -lnosys -Wl,-Map=build/makefile_test.map,--cref -Wl,--gc-sections -o build/makefile_test.elf
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o: Conflicting CPU architectures 13/1
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/makefile_test.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib /libc_nano.a(lib_a-atexit.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(li b_a-atexit.o)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/makefile_test.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib /libc_nano.a(lib_a-exit.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(li b_a-exit.o)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/makefile_test.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib /libc_nano.a(lib_a-fini.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(li b_a-fini.o)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/makefile_test.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib /libc_nano.a(lib_a-impure.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(li b_a-impure.o)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/makefile_test.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib /libc_nano.a(lib_a-init.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(li b_a-init.o)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/makefile_test.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib /libc_nano.a(lib_a-memset.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(li b_a-memset.o)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/makefile_test.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib /libc_nano.a(lib_a-__atexit.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(li b_a-__atexit.o)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/makefile_test.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib /libc_nano.a(lib_a-__call_atexit.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(li b_a-__call_atexit.o)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/makefile_test.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib /libnosys.a(_exit.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libnosys.a(_ex it.o)
collect2: error: ld returned 1 exit status
Makefile:166: recipe for target 'build/makefile_test.elf' failed
make: *** [build/makefile_test.elf] Error 1

I have installed the compiler like this:

sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt-get update
sudo apt-get install gcc-arm-none-eabi

What might cause this problem?

This topic has been closed for replies.

4 replies

dhaselwood
Associate III
December 14, 2018

Most of the errors are a mismatch of libraries compiled to use software floating pt emulation with the compile code set to use hardware floating pt. Furthermore, the first error is saying there is mismatch in architectures, i.e. crt0 is the wrong one. If it worked on Win10 but not Ubuntu, my guess is that it is something having to do with PATH.

After Forever
Senior III
December 14, 2018

If you are using Ubuntu 18.04 's default newlib library then it has a known issue:

https://bugs.launchpad.net/ubuntu/+source/gcc-arm-none-eabi/+bug/1767223

There is a work-around:

https://github.com/bbcmicrobit/micropython/issues/514

smrtkai
smrtkaiAuthor
Associate III
December 14, 2018

Thank you! The following commands fix the error. With this everything compiles :)

wget http://de.archive.ubuntu.com/ubuntu/pool/universe/n/newlib/libnewlib-dev_3.0.0.20180802-2_all.deb
wget http://de.archive.ubuntu.com/ubuntu/pool/universe/n/newlib/libnewlib-arm-none-eabi_3.0.0.20180802-2_all.deb
 
sudo dpkg -i libnewlib-dev_2.4.0.20160527-4_all.deb libnewlib-arm-none-eabi_2.4.0.20160527-4_all.deb

Vasile Guta_Ciucur
Senior
December 20, 2018

I always get the toolchain from his parents https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads# . I unpack it in $HOME folder, make a symlink folder (with a smaller name) to it and make the changes in the Makefile.

Always the official distribution. Always the latest two or three versions - I can point the symlink to any of those. without the need to make the new changes in the Makefile.

Also Ubuntu 18.04 here...