a.cpp:
#include <iostream>int main(){ std::cout << "hello world" << std::endl; return 0;}
cmd input:
arm-none-eabi-g++ -specs=nosys.specs a.cpp
cmd output:
/usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/lib/thumb/nofp/libstdc++.a(random.o): in function `std::(anonymous namespace)::__libc_getentropy(void*)':/build/arm-none-eabi-gcc/src/gcc-12.2.0/libstdc++-v3/src/c++11/random.cc:179: undefined reference to `getentropy'/usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/lib/thumb/nofp/libstdc++.a(random.o): in function `std::random_device::_M_init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':/build/arm-none-eabi-gcc/src/gcc-12.2.0/libstdc++-v3/src/c++11/random.cc:452: undefined reference to `getentropy'/usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/lib/thumb/nofp/libc.a(lib_a-arc4random.o): in function `_rs_stir':/build/arm-none-eabi-newlib/src/build-newlib/arm-none-eabi/thumb/nofp/newlib/libc/stdlib/../../../../../../../newlib-4.2.0.20211231/newlib/libc/stdlib/arc4random.c:89: undefined reference to `getentropy'collect2: error: ld returned 1 exit status
I don't know why arm-none-eabi-g++ compilation fails, if I use arm-none-eabi-gcc to compile C language, it can be compiled successfully. Is there some missing parameter that is causing the compilation to fail?