Nintendo 3DS
解決"gcc.cc: undefined reference to host_detect_local_cpu(int, char const**)"問題
參考資訊:
1. cross-compilation-issue
問題:
g++ -no-pie -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc -o xgcc gcc.o gcc-main.o ggc-none.o \ c/gccspec.o libcommon-target.a \ libcommon.a ../libcpp/libcpp.a ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a /usr/bin/ld: gcc.o: in function `.LANCHOR1': gcc.cc:(.rodata+0x58c): undefined reference to `host_detect_local_cpu(int, char const**)' collect2: error: ld returned 1 exit status make[1]: *** [Makefile:2172: xgcc] Error 1 make[1]: Leaving directory 'buildscripts/.devkitARM/arm-none-eabi/gcc/gcc' make: *** [Makefile:4607: all-gcc] Error 2 Error building gcc stage1
解法:
$ export CROSSBUILD=arm-linux-gnueabihf $ ./build-devkit.sh
P.S. 如果在ARM CPU上面編譯devkitpro,需要指定CROSSBUILD