关于这个问题,官方的回答写在了Readme里面了
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
然而当我尝试的时候并没有成功,幸运的是我有两台电脑,相同的代码在另一台上面成功了,所以我怀疑到了arm-none-eabi-gcc的版本上。失败的电脑上面用的version是7.几的,成功的电脑上用的是4.9.3的,通过将arm-none-eabi-gcc替换到4.9.3后,另一台电脑也能成功编译。