参考 https://zhuanlan.zhihu.com/p/70711446
参考https://stackoverflow.com/questions/62189662/error-compiling-coreutils-error-function-might-be-candidate-for-attribute-co
参考https://bug-grep.gnu.narkive.com/a2vn1h1t/bug-17501-arm-cast-align-error
1. 下载源码
git clone https://git.savannah.gnu.org/git/coreutils.git
#切换版本v.8.30
git checkout v8.30
2. 执行bootstrap
./bootstrap
3. 编译 make-prime-list
./configure && make
3.1报错宏定义 if 缺少参数
给它赋1 启用看要不要编译
4. 配置交叉编译环境
make clean && ./configure --host=arm-linux-gnueabihf && make
此处如果使用其他交叉编译工具链,需要在Makefile中重新指定
报错
Error compiling coreutils - error: function might be candidate for attribute ‘const’ [-Werror=suggest-attribute=const]
make CFLAGS=’-Wno-error=suggest-attribute=const’
ps:最后发现还是报别的警告,但没有语法错误,把警告关闭就可以了
make CFLAGS=’-w’ -j8