gccarmcross-compilingstm32f4discoverylibsndfile

Compiling libsndfile for STM32F4xx Discovery Board


I'm trying to cross-compile libsndfile for the STM32F board. I found this SO question, but I'm having trouble in the configure step.

I have installed the cross-compiling tools with apt install gcc-arm-none-eabi.

I ran ./autogen.sh then export CC=arm-none-eabi-gcc and ./configure --host=arm-none-eabi. I have also tried other host options from the SO question mentioned above.

But configure returned:

checking for arm-none-eabi-gcc... arm-none-eabi-gcc
checking whether the C compiler works... no
configure: error: in `/home/arun/build/libsndfile':
configure: error: C compiler cannot create executables
See `config.log' for more details

config.log shows:

configure:4135: arm-none-eabi-gcc    conftest.c  >&5
 /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): In function `exit':
/build/newlib-5zwpxE/newlib-2.2.0+git20150830.5a3d536/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/exit.c:70: 
undefined reference to `_exit'
collect2: error: ld returned 1 exit status

This lead to another SO question so I manually edited configure and added --specs=nosys.specs to the ac_compile and ac_link variable. But I'm still seeing the error.

The author of libsndfile suggested setting CFLAGS and LDFLAGS, but I'm not sure what to set them to.

Not sure what else to try at this point. Can someone point me in the right direction?

Thanks


Solution

  • Solved the configure problem by setting export LDFLAGS="specs=nosys.specs" before running ./configure --host=arm-none-eabi