1

I am trying to compile an SDK with the an embedded arm gcc compiler in cygwin. It is a makefile based SDK. My target is a cortex m3 device. My problem is, the SDK has a custom libc implementation for the target, and when I compile with the arm compiler (arm-none-eabi-gcc) it looks to pick up the gnu arm libc, not the SDK libc. This is resulting in a compilation error. I am positive the makefiles are correct (I copy and pasted the entire SDK from a computer where this was working). I no longer have access to that computer to try and verify / compare settings. I don't know how to prevent the arm gcc compiler from looking for its own implementation of the libc and instead point it to the correct implementation. Any help is greatly appreciated.

Ryan
  • 33
  • 1
  • 6
  • Probably your SDK has, somewhere, a script that set all environment variable to be used with gcc cross compiler. Something that you have to launch using `source setup environment`. This will set toolchain parameters, sysroot, etc... – LPs Feb 13 '16 at 10:37

1 Answers1

2

There are perhaps two solutions:

  1. Create an environment specific to your tool - the GNU toolchain uses a number of environment variables to define default behaviour. For a custom toolchain, you will need to set all necessary variables to override the system defaults.
  2. Use the -nostdlib linker option and explicitly link your desired library and C Runtime start-up code, so your linker command line might include the following:

    -nostdlib -L/usr/myarmtools/gcc/lib -lc crt0.o

Note that -nostdlib suppresses the default linking of libc libstdc++ and crt0.o, so you must provide search path (-L) to the libraries, or explicitly link them by their full path and file name and link the C runtime object code for your target.

I use option 2 for preference as it will work in any environment. However if you wish to use common makefiles for building for multiple targets, option 1 may be useful.

Clifford
  • 88,407
  • 13
  • 85
  • 165