Building uClibc++

A version of uClibc++ has been ported to NuttX is available in the NuttX uClib++ GIT repository at Bitbucket.org. This version of uClibc++ was adapted for NuttX by the RGMP team.

This custom version of uClibc++ resides in the NuttX repository in the https://bitbucket.org/nuttx/uclibc/ directory rather than in the main NuttX source tree due to licensing issues: NuttX is licensed under the permissive modified BSD License; uClibc++, on the other hand, is licensed under the stricter GNU LGPL Version 3 license.

General build instructions are available in the uClibc++ README.txt file. Those instructions are not repeated here. This Wiki page is devoted to documenting resolution of issues with building this NuttX version of uClib++.

Undefined reference to _impure_ptr

Problem: When building uClibc++ I encounter an undefined reference to _impure_ptr like:

  LD: nuttx
  .../arm-none-eabi/lib/armv7e-m\libsupc++.a(vterminate.o): In function `__gnu_cxx::__verbose_terminate_handler()': vterminate.cc:(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0xfc): undefined reference to `_impure_ptr'

Solution: No good solution is known. The following works, however:

Locate Get the directory where you can find libsupc++:

  arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -print-file-name=libsupc++.a

Go to that directory and save a copy of vterminate.o (in case you want to restore it later):

  cd <the-directory-containing-libsupc++.a>
  arm-none-eabi-ar.exe -x libsupc++.a vterminate.o

Then remove vterminate.o from the library. At build time, the uClibc++ package will provide a usable replacement vterminate.o.

  arm-none-eabi-ar.exe -d libsupc++.a vterminate.o

Now NuttX should link with no problem. If you want to restore the vterminate.o that you removed from libsupc++, you can do that with:

  arm-none-eabi-ar.exe rcs libsupc++.a vterminate.o