由于自己的linux系统比较新,导致编译个基于openwrt的sdk问题多多,在此记录解决过程
1.
问题:
freadahead.c: In function 'freadahead':
freadahead.c:91:3: error: #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
91 | #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
| ^~~~~
make[7]: *** [Makefile:1837: freadahead.o] Error 1
make[7]: Leaving directory '/opt/p2/openwrt/build_dir/host/m4-1.4.17/lib'
解决:
cd /opt/p2/openwrt/build_dir/host/m4-1.4.17/
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
2.
问题:
lib/fseterr.c: In function 'fseterr':
lib/fseterr.c:77:3: error: #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib."
77 | #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib."
| ^~~~~
make[6]: *** [Makefile:3461: lib/fseterr.o] Error 1
make[6]: Leaving directory '/opt/p2/openwrt/build_dir/host/bison-3.0.4'
解决:
cd /opt/p2/openwrt/build_dir/host/bison-3.0.4/
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
3.
问题:
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /opt/p2/openwrt/build_dir/host/mtd-utils-1.5.2/mkfs.jffs2.o: in function `write_special_file':
/opt/p2/openwrt/build_dir/host/mtd-utils-1.5.2/mkfs.jffs2.c:944: undefined reference to `major'
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /opt/p2/openwrt/build_dir/host/mtd-utils-1.5.2/mkfs.jffs2.c:944: undefined reference to `minor'
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /opt/p2/openwrt/build_dir/host/mtd-utils-1.5.2/mkfs.jffs2.o: in function `recursive_populate_directory':
/opt/p2/openwrt/build_dir/host/mtd-utils-1.5.2/mkfs.jffs2.c:1273: undefined reference to `minor'
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /opt/p2/openwrt/build_dir/host/mtd-utils-1.5.2/mkfs.jffs2.c:1273: undefined reference to `major'
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /opt/p2/openwrt/build_dir/host/mtd-utils-1.5.2/mkfs.jffs2.c:1263: undefined reference to `minor'
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /opt/p2/openwrt/build_dir/host/mtd-utils-1.5.2/mkfs.jffs2.c:1263: undefined reference to `major'
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /opt/p2/openwrt/build_dir/host/mtd-utils-1.5.2/mkfs.jffs2.o: in function `interpret_table_entry':
/opt/p2/openwrt/build_dir/host/mtd-utils-1.5.2/mkfs.jffs2.c:467: undefined reference to `makedev'
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /opt/p2/openwrt/build_dir/host/mtd-utils-1.5.2/mkfs.jffs2.c:503: undefined reference to `makedev'
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /opt/p2/openwrt/build_dir/host/mtd-utils-1.5.2/mkfs.jffs2.c:510: undefined reference to `makedev
解决:
/opt/p2/openwrt/build_dir/host/mtd-utils-1.5.2/mkfs.jffs2.c 中添加#include
4.
问题:
CC ubi-utils/libubi.o
ubi-utils/libubi.c: In function 'vol_node2nums':
ubi-utils/libubi.c:383:10: error: called object 'major' is not a function or function pointer
解决:
此问题与3号问题相似,打开文件发现二者都有#include , 暴力点可以直接修改/usr/include/sys/types.h添加#include
5.
问题:
/usr/include/asm-generic/int-ll64.h:31:42: error: conflicting types for ‘__u64’
31 | __extension__ typedef unsigned long long __u64;
| ^~~~~
In file included from :
././include/compiler.h:69:18: note: previous declaration of ‘__u64’ was here
69 | typedef uint64_t __u64;
解决:
修改build_dir/host/u-boot-2018.03/include/compiler.h
注释或者删除typedef uint64_t __u64;
6.
问题:
freadahead.c: In function 'freadahead':
freadahead.c:92:3: error: #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
92 | #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
| ^~~~~
make[9]: *** [Makefile:2225: freadahead.o] Error 1
make[9]: Leaving directory '/opt/p2/openwrt/build_dir/host/findutils-4.6.0/gl/lib'
解决:
进入出错目录:
cd /opt/p2/openwrt/build_dir/host/findutils-4.6.0
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' gl/lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> gl/lib/stdio-impl.h
sed -i '/unistd/a #include ' gl/lib/mountlist.c
7
问题:
hecking version of makeinfo... v. ?.??, bad
configure: WARNING:
*** These auxiliary programs are missing or incompatible versions: makeinfo
*** some features will be disabled.
*** Check the INSTALL file for required versions.
checking LD_LIBRARY_PATH variable... contains current directory
configure: error:
*** LD_LIBRARY_PATH shouldn't contain the current directory when
*** building glibc. Please change the environment variable
*** and run configure again.
make[3]: *** [Makefile:30: /opt/p2/openwrt/build_dir/toolchain-arm_cortex-a7+neon_gcc-5.3.0_glibc-2.22_eabi/glibc-2.22-b995d95-headers/.configured] Error 1
make[3]: Leaving directory '/opt/p2/openwrt/toolchain/glibc/headers'
解决:
系统中安装有makeinfo 6.7 真实指向的是texi2any /usr/bin/makeinfo -> texi2any
安装旧版的makeinfo4 发现无效
只能修改build_dir/toolchain-arm_cortex-a7+neon_gcc-5.3.0_glibc-2.22_eabi/glibc-2.22-b995d95/configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $MAKEINFO" >&5
$as_echo_n "checking version of $MAKEINFO... " >&6; }
ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* [0?9][0?9.]?[0?9][0?9.]?.*$/\1/p'`
test_info=`$MAKEINFO --version`
$as_echo "$test_info";
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
中的
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
改成
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=no;;
8
问题:
checking LD_LIBRARY_PATH variable... contains current directory
configure: error:
*** LD_LIBRARY_PATH shouldn t contain the current directory when
*** building glibc. Please change the environment variable
*** and run configure again.
解决:
echo $LD_LIBRARY_PATH 查看当前LD_LIBRARY_PATH变量
:/usr/lib64:/usr/local/lib:/usr/local/lib64:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:/usr/lib64:/usr/local/lib:/usr/local/lib64:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64
第一个字符是多余的,可以把它删除,或者暴力点直接把变量清空
export LD_LIBRARY_PATH=''
9
问题
./scripts/dtc-version.sh: line 17: dtc: command not found
./scripts/dtc-version.sh: line 18: dtc: command not found
*** Your dtc is too old, please upgrade to dtc 1.4 or newer
make[4]: *** [Makefile:1375: checkdtc] Error 1
make[4]: Leaving directory '/opt/p2/uboot'
解决:
系统中安装dtc这个软件
9
问题
make[8]: Entering directory '/opt/p2/openwrt/build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/host/glib-2.50.3/gio'
CC libgio_2_0_la-gdbusauth.lo
gdbusauth.c: In function '_g_dbus_auth_run_server':
gdbusauth.c:1304:11: error: '%s' directive argument is null [-Werror=format-overflow=]
1304 | debug_print ("SERVER: WaitingForBegin, read '%s'", line);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[8]: *** [Makefile:3531: libgio_2_0_la-gdbusauth.lo] Error 1
make[8]: Leaving directory '/opt/p2/openwrt/build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/host/glib-2.50.3/gio'
解决:
修改build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/host/glib-2.50.3/giog/dbusauth.c
debug_print ("SERVER: WaitingForBegin, read '%s'", line);
if (line == NULL)
goto out;
为
if (line == NULL)
goto out;
debug_print ("SERVER: WaitingForBegin, read '%s'", line);
10
问题:
gdbusmessage.c: In function 'g_dbus_message_to_blob':
gdbusmessage.c:2698:30: error: '%s' directive argument is null [-Werror=format-overflow=]
2698 | tupled_signature_str = g_strdup_printf ("(%s)", signature_str);
解决:
修改gdbusmessage.c 2698行
tupled_signature_str = g_strdup_printf ("(%s)", signature_str);
改为
if (signature_str)
tupled_signature_str = g_strdup_printf ("(%s)", signature_str);
11
问题:
make[8]: Entering directory '/opt/p2/openwrt/build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/host/glib-2.50.3/gio/tests'
GEN gdbus-test-codegen-generated.h
Traceback (most recent call last):
File "../../gio/gdbus-2.0/codegen/gdbus-codegen", line 37, in
from codegen import codegen_main
File "/opt/p2/openwrt/build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/host/glib-2.50.3/gio/gdbus-2.0/codegen/codegen_main.py", line 28, in
from . import parser
File "/opt/p2/openwrt/build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/host/glib-2.50.3/gio/gdbus-2.0/codegen/parser.py", line 23, in
import xml.parsers.expat
ImportError: No module named xml.parsers.expat
make[8]: *** [Makefile:4643: gdbus-test-codegen-generated.h] Error 1
解决:
系统中python安装defusedxml模块, 比如suse系统,在YaST2中搜索并安装python2-defusedxml
13
问题
make[4]: Entering directory '/opt/p2/openwrt/build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/host/Python-2.7.13'
running build
running build_ext
building dbm using ndbm
INFO: Can't locate Tcl/Tk libs and/or headers
building '_curses' extension
gcc -pthread -fPIC -fno-strict-aliasing -O2 -I/opt/p2/openwrt/staging_dir/host/include -I/opt/p2/openwrt/staging_dir/host/usr/include -I/opt/p2/openwrt/staging_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/host/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -I/opt/p2/openwrt/staging_dir/host/include -I/opt/p2/openwrt/staging_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/host/include -I/usr/local/include -I/opt/p2/openwrt/build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/host/Python-2.7.13/Include -I/opt/p2/openwrt/build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/host/Python-2.7.13 -c /opt/p2/openwrt/build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/host/Python-2.7.13/Modules/_cursesmodule.c -o build/temp.linux-x86_64-2.7/opt/p2/openwrt/build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/host/Python-2.7.13/Modules/_cursesmodule.o
/opt/p2/openwrt/build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/host/Python-2.7.13/Modules/_cursesmodule.c: In function 'PyCursesWindow_EchoChar':
/opt/p2/openwrt/build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/host/Python-2.7.13/Modules/_cursesmodule.c:809:18: error: dereferencing pointer to incomplete type 'WINDOW' {aka 'struct _win_st'}
809 | if (self->win->_flags & _ISPAD)
| ^~
/opt/p2/openwrt/build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/host/Python-2.7.13/Modules/_cursesmodule.c: In function 'PyCurses_setupterm':
*** WARNING: renaming "_ctypes" since importing it failed: libffi.so.6: cannot open shared object file: No such file or directory
Python build finished, but the necessary bits to build these modules were not found:
_sqlite3 _tkinter bsddb185
dl imageop nis
解决:
安装tcl-devel, tk-devel, sqlite3-devel, libffi-devel, 注意必须要有libffi.so.6这个文件,实在没有且有libffi.so.7的则可以ln -s libffi.so.7 libffi.so.6来做临时解决。
如果还是不行,则试下安装readline-devel,bzip2-devel,openssl-devel,gdbm-devel,libdbi-devel,ncurses-libs,zlib-devel, libnsl-devel
14
问题:
checking for refresh in -lncurses6... no
checking for refresh in -lncurses... no
checking for refresh in -lncurses6... (cached) no
checking for refresh in -lncurses... (cached) no
checking curses.h usability... yes
checking curses.h presence... yes
checking for curses.h... yes
configure: error: missing libraries: libncurses
make[3]: *** [Makefile:57: /opt/p2/openwrt/build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/htop-2.0.2/.configured_yyyyyyyy] Error
解决:
查看build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/htop-2.0.2/config.log
configure:13075: checking for refresh in -lncurses
configure:13100: arm-openwrt-linux-gnueabi-gcc -o conftest -Os -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -iremap /opt/p2/openwrt/build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/htop-2.0.2:htop-2.0.2 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -I/opt/p2/openwrt/staging_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/usr/include -I/opt/p2/openwrt/staging_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/include -I/opt/p2/openwrt/staging_dir/toolchain-arm_cortex-a7+neon_gcc-5.3.0_glibc-2.22_eabi/usr/include -I/opt/p2/openwrt/staging_dir/toolchain-arm_cortex-a7+neon_gcc-5.3.0_glibc-2.22_eabi/include -L/usr/lib64/ncurses5 -Wl,-O2 -Wl,-Bsymbolic-functions -Wl,--as-needed -lncurses -ltinfo -L/opt/p2/openwrt/staging_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/usr/lib -L/opt/p2/openwrt/staging_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/lib -L/opt/p2/openwrt/staging_dir/toolchain-arm_cortex-a7+neon_gcc-5.3.0_glibc-2.22_eabi/usr/lib -L/opt/p2/openwrt/staging_dir/toolchain-arm_cortex-a7+neon_gcc-5.3.0_glibc-2.22_eabi/lib -znow -zrelro conftest.c -lncurses -lm >&5
/lib64/libncurses.so.5: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
configure:13100: $? = 1
关键是这句 -L/usr/lib64/ncurse5, 加上/lib64/libncurses.so.5: file not recognized: File format not recognized, 可见是链接目录有问题,交叉编译时却链接上pc中的库,无法识别,出错。
系统中安装了ncurses-devel ncurses5-devel, 这里删除掉ncurses5-devel,问题解决。
15
问题:
+ mkdosfs /opt/p2/openwrt/build_dir/target-arm_cortex-a7+neon_glibc-2.22_eabi/linux-leo_gx8009b-ssd-lc-v1/cfg.img -C 1024
./gen_leo_sdcard_img.sh: line 40: mkdosfs: command not found
解决:
系统安装dosfstools, 如果是suse系统,又安装有dosfstools, 则是路径有问题(/usr/sbin/mkdosfs), 在/usr/bin/下创建软链接sudo ln -s /usr/sbin/mkdosfs /usr/bin/mkdosfs
作者:帅得不敢出门
阅读(10170) | 评论(0) | 转发(0) |