arm-none-eabi-gcc fails in configure generated by autoconf 2.69

Asked by Matt Wilson

Installed gcc-arm-none-eabi-4_6-2012q2 on ubuntu 12.10. Followed the steps in gcc-arm-none-eabi-4_6-2012q2/share/doc/pdf/etc/configure.pdf to create a Makefile for a test program. Used 'autoconf 2.69' to create 'configure'. 'configure' fails at step to verify compiler. Recreated failure by creating conftest.c and attempting compile independently of configure.
/* conftest.c */
int
main ()
{

  ;
  return 0;
}
/* end conftest.c */
compiled with
$ arm-none-eabi-gcc -O3 -mthumb -mcpu=cortex-m0plus conftest.c
fails with error messages including
<quote>gcc-arm-none-eabi-4_6-2012q4/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib/armv6-m/libc.a(lib_a-exit.o): In function `exit':
exit.c:(.text.exit+0x18): undefined reference to `_exit'
</quote>

Installed gcc-arm-none-eabi-4_6-2012q4, and changed the $PATH to suit. Same issue.

What have I missed? Is there a problem in gcc-arm-none-eabi-4_6? Is there a problem with C code generated by autoconf 2.69?

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
Matt Wilson
Solved:
Last query:
Last reply:
Revision history for this message
Terry Guo (terry.guo) said :
#1

At first glance, the configure is using improper command to build the conftest.c. At least it should be "arm-none-eabi-gcc -O3 -mthumb -mcpu=cortex-m0plus -lc -lrdimon -specs=rdimon.specs conftest.c". In addition the generated executable file shouldn't be run on your local machine directly. All are because we are doing cross build.

I have few knowledge on setting up cross build project using Autoconf like you just did, but I am willing to figure it out and get back to you once I get something.

Revision history for this message
Terry Guo (terry.guo) said :
#2

I think a quick solution is:

LDFLAGS="-lc -lrdimon -specs=rdimon.specs" ../poke/configure --build=i686-pc-gnu-linux --host=arm-none-eabi

But there is no problem related to tool chain and generated C code. It's all about the configure.in file. Probably your configure.in isn't good enough. Meanwhile I have to say that the example in that manual is kind of outdated and too simple for cross build project. If you really want to make your project more portable, suggest you to study configure.in inside Newlib/GLIBC and etc.

Revision history for this message
Matt Wilson (withrobots) said :
#3

Many thanks Terry. The following configure command worked. Basically just needed the libraries!
$./configure --build=i686-pc-linux-gnu --host=arm-none-eabi CFLAGS="-O3 -mthumb -mcpu=cortex-m0plus -lc -lrdimon -specs=rdimon.specs".

Similarly, the following compile worked:
$ arm-none-eabi-gcc -O3 -mthumb -mcpu=cortex-m0plus -lc -lrdimon -specs=rdimon.specs conftest.c

I've got more learning to do about the libraries; I had expected none were needed to be specifically identified for such a simple C program.