页次: 1
这是编译host相关工具时出的错,跟交叉编译器无关。找出重复定义的 yylloc ,删除其中一个即可。
谢谢大佬,但根据网上的各种方法,还是没解决。具体是这几种方法方法一 方法二 方法三都试过了,不是出现同样的错误,就是报一堆其他语法错误。
这篇文章总结了几种方式,现在我除了换系统和最新版u-boot外,其他都试过了。
一、注释或者加extern
scripts/dtc/dtc-parser.tab.c中1205行的 yyloc
、二、在Makefile文件中添加
HOSTCFLAGS += -fcommon
出现一样的编译报错:
/usr/include/libfdt_env.h:27:30: error: conflicting types for ‘fdt64_t’; have ‘uint64_t’ {aka ‘long unsigned int’}
27 | typedef uint64_t FDT_BITWISE fdt64_t;
| ^~~~~~~
In file included from <command-line>:
././include/libfdt_env.h:19:16: note: previous declaration of ‘fdt64_t’ with type ‘fdt64_t’ {aka ‘long long unsigned int’}
19 | typedef __be64 fdt64_t;
| ^~~~~~~
In file included from ././include/libfdt_env.h:12:
/usr/include/libfdt_env.h:47:24: error: expected ‘)’ before ‘x’
47 | static inline uint32_t fdt32_to_cpu(fdt32_t x)
| ^~~~~~~~~~~~
././include/compiler.h:71:16: error: expected ‘)’ before ‘&’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^
././include/compiler.h:71:30: error: expected ‘)’ before ‘>>’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^~
././include/compiler.h:71:37: error: expected ‘)’ before ‘|’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^
/usr/include/libfdt_env.h:51:23: error: expected ‘)’ before ‘x’
51 | static inline fdt32_t cpu_to_fdt32(uint32_t x)
| ^~~~~~~~~~~~
././include/compiler.h:71:16: error: expected ‘)’ before ‘&’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^
././include/compiler.h:71:30: error: expected ‘)’ before ‘>>’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^~
././include/compiler.h:71:37: error: expected ‘)’ before ‘|’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^
/usr/include/libfdt_env.h:56:24: error: expected ‘)’ before ‘x’
56 | static inline uint64_t fdt64_to_cpu(fdt64_t x)
| ^~~~~~~~~~~~
././include/compiler.h:76:16: error: expected ‘)’ before ‘&’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^
././include/compiler.h:76:43: error: expected ‘)’ before ‘>>’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^~
././include/compiler.h:76:50: error: expected ‘)’ before ‘|’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^
/usr/include/libfdt_env.h:60:23: error: expected ‘)’ before ‘x’
60 | static inline fdt64_t cpu_to_fdt64(uint64_t x)
| ^~~~~~~~~~~~
././include/compiler.h:76:16: error: expected ‘)’ before ‘&’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^
././include/compiler.h:76:43: error: expected ‘)’ before ‘>>’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^~
././include/compiler.h:76:50: error: expected ‘)’ before ‘|’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^
HOSTCC tools/atmelimage.o
WRAP tools/common/bootm.c
make[1]: *** [scripts/Makefile.host:116: tools/aisimage.o] Error 1
make[1]: *** Waiting for unfinished jobs....
HOSTCC tools/default_image.o
In file included from tools/../include/../lib/libfdt/libfdt.h:10,
from tools/../include/libfdt.h:1,
from tools/fdt_host.h:11,
from tools/imagetool.h:24,
from tools/atmelimage.c:8:
/usr/include/libfdt_env.h:27:30: error: conflicting types for ‘fdt64_t’; have ‘uint64_t’ {aka ‘long unsigned int’}
27 | typedef uint64_t FDT_BITWISE fdt64_t;
| ^~~~~~~
In file included from <command-line>:
././include/libfdt_env.h:19:16: note: previous declaration of ‘fdt64_t’ with type ‘fdt64_t’ {aka ‘long long unsigned int’}
19 | typedef __be64 fdt64_t;
| ^~~~~~~
In file included from ././include/libfdt_env.h:12:
/usr/include/libfdt_env.h:47:24: error: expected ‘)’ before ‘x’
47 | static inline uint32_t fdt32_to_cpu(fdt32_t x)
| ^~~~~~~~~~~~
././include/compiler.h:71:16: error: expected ‘)’ before ‘&’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^
././include/compiler.h:71:30: error: expected ‘)’ before ‘>>’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^~
././include/compiler.h:71:37: error: expected ‘)’ before ‘|’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^
/usr/include/libfdt_env.h:51:23: error: expected ‘)’ before ‘x’
51 | static inline fdt32_t cpu_to_fdt32(uint32_t x)
| ^~~~~~~~~~~~
././include/compiler.h:71:16: error: expected ‘)’ before ‘&’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^
././include/compiler.h:71:30: error: expected ‘)’ before ‘>>’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^~
././include/compiler.h:71:37: error: expected ‘)’ before ‘|’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^
/usr/include/libfdt_env.h:56:24: error: expected ‘)’ before ‘x’
56 | static inline uint64_t fdt64_to_cpu(fdt64_t x)
| ^~~~~~~~~~~~
././include/compiler.h:76:16: error: expected ‘)’ before ‘&’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^
././include/compiler.h:76:43: error: expected ‘)’ before ‘>>’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^~
././include/compiler.h:76:50: error: expected ‘)’ before ‘|’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^
/usr/include/libfdt_env.h:60:23: error: expected ‘)’ before ‘x’
60 | static inline fdt64_t cpu_to_fdt64(uint64_t x)
| ^~~~~~~~~~~~
././include/compiler.h:76:16: error: expected ‘)’ before ‘&’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^
././include/compiler.h:76:43: error: expected ‘)’ before ‘>>’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^~
././include/compiler.h:76:50: error: expected ‘)’ before ‘|’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^
make[1]: *** [scripts/Makefile.host:116: tools/atmelimage.o] Error 1
In file included from tools/../include/../lib/libfdt/libfdt.h:10,
from tools/../include/libfdt.h:1,
from tools/fdt_host.h:11,
from tools/imagetool.h:24,
from tools/default_image.c:17:
/usr/include/libfdt_env.h:27:30: error: conflicting types for ‘fdt64_t’; have ‘uint64_t’ {aka ‘long unsigned int’}
27 | typedef uint64_t FDT_BITWISE fdt64_t;
| ^~~~~~~
In file included from <command-line>:
././include/libfdt_env.h:19:16: note: previous declaration of ‘fdt64_t’ with type ‘fdt64_t’ {aka ‘long long unsigned int’}
19 | typedef __be64 fdt64_t;
| ^~~~~~~
In file included from ././include/libfdt_env.h:12:
/usr/include/libfdt_env.h:47:24: error: expected ‘)’ before ‘x’
47 | static inline uint32_t fdt32_to_cpu(fdt32_t x)
| ^~~~~~~~~~~~
././include/compiler.h:71:16: error: expected ‘)’ before ‘&’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^
././include/compiler.h:71:30: error: expected ‘)’ before ‘>>’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^~
././include/compiler.h:71:37: error: expected ‘)’ before ‘|’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^
/usr/include/libfdt_env.h:51:23: error: expected ‘)’ before ‘x’
51 | static inline fdt32_t cpu_to_fdt32(uint32_t x)
| ^~~~~~~~~~~~
././include/compiler.h:71:16: error: expected ‘)’ before ‘&’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^
././include/compiler.h:71:30: error: expected ‘)’ before ‘>>’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^~
././include/compiler.h:71:37: error: expected ‘)’ before ‘|’ token
71 | ((((x) & 0xff000000) >> 24) | \
| ^
/usr/include/libfdt_env.h:56:24: error: expected ‘)’ before ‘x’
56 | static inline uint64_t fdt64_to_cpu(fdt64_t x)
| ^~~~~~~~~~~~
././include/compiler.h:76:16: error: expected ‘)’ before ‘&’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^
././include/compiler.h:76:43: error: expected ‘)’ before ‘>>’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^~
././include/compiler.h:76:50: error: expected ‘)’ before ‘|’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^
/usr/include/libfdt_env.h:60:23: error: expected ‘)’ before ‘x’
60 | static inline fdt64_t cpu_to_fdt64(uint64_t x)
| ^~~~~~~~~~~~
././include/compiler.h:76:16: error: expected ‘)’ before ‘&’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^
././include/compiler.h:76:43: error: expected ‘)’ before ‘>>’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^~
././include/compiler.h:76:50: error: expected ‘)’ before ‘|’ token
76 | ((((x) & 0xff00000000000000##sfx) >> 56) | \
| ^
make[1]: *** [scripts/Makefile.host:116: tools/default_image.o] Error 1
make: *** [Makefile:1286: tools] Error 2
三、注释scripts/dtc/dtc-lexer.l的YYLTYPE yylloc;行,没有效果。
四、删除scripts/dtc/dtc-lexer.l中的YYLTYPE yylloc;和scripts/dtc/dtc-lexer.lex.c_shipped中的YYLTYPE yylloc;出现报错。
五、删除或注释两个相关文件的yyloc行,还是没找到解决办法。
已经在arch下安装了相应的替代品:
arm-linux-gnueabi-gcc75-linaro-bin ncurses lib32-ncurses python lib32-python openssl lib32-openssl python-distutils-extra mkbootimg swig dtc
对于arm-linux-guneabi-gcc这个工具,先后尝试了11.2.0-1版的,根据wiki下载的7.2.1版本,以及7.5.0 版本。但是
参考官方wiki,执行到# 开始编译 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j8这里的时候,报错:
❯ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j8
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/config.h
CFG u-boot.cfg
GEN include/autoconf.mk.dep
CFG spl/u-boot.cfg
GEN include/autoconf.mk
GEN spl/include/autoconf.mk
CHK include/config/uboot.release
CHK include/generated/timestamp_autogenerated.h
UPD include/generated/timestamp_autogenerated.h
HOSTLD scripts/dtc/dtc
PYMOD scripts/dtc/pylibfdt/_libfdt.so
/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [scripts/Makefile.host:108: scripts/dtc/dtc] Error 1
make[2]: *** Waiting for unfinished jobs....
CHK include/generated/version_autogenerated.h
UPD include/generated/version_autogenerated.h
CC lib/asm-offsets.s
CC arch/arm/lib/asm-offsets.s
In file included from include/config.h:5:0,
from include/common.h:21,
from lib/asm-offsets.c:15:
include/configs/suniv.h:26:0: warning: "CONFIG_BOOTCOMMAND" redefined
#define CONFIG_BOOTCOMMAND "sf probe 0 50000000; " \
In file included from include/configs/sunxi-common.h:487:0,
from include/configs/suniv.h:15,
from include/config.h:5,
from include/common.h:21,
from lib/asm-offsets.c:15:
include/config_distro_bootcmd.h:398:0: note: this is the location of the previous definition
#define CONFIG_BOOTCOMMAND "run distro_bootcmd"
In file included from include/config.h:5:0,
from include/common.h:21,
from arch/arm/lib/asm-offsets.c:15:
include/configs/suniv.h:26:0: warning: "CONFIG_BOOTCOMMAND" redefined
#define CONFIG_BOOTCOMMAND "sf probe 0 50000000; " \
In file included from include/configs/sunxi-common.h:487:0,
from include/configs/suniv.h:15,
from include/config.h:5,
from include/common.h:21,
from arch/arm/lib/asm-offsets.c:15:
include/config_distro_bootcmd.h:398:0: note: this is the location of the previous definition
#define CONFIG_BOOTCOMMAND "run distro_bootcmd"
CHK include/generated/asm-offsets.h
CHK include/generated/generic-asm-offsets.h
LDS u-boot.lds
CHK include/config.h
In file included from include/config.h:5:0,
from arch/arm/cpu/u-boot.lds:10:
include/configs/suniv.h:26:0: warning: "CONFIG_BOOTCOMMAND" redefined
#define CONFIG_BOOTCOMMAND "sf probe 0 50000000; " \
In file included from include/configs/sunxi-common.h:487:0,
from include/configs/suniv.h:15,
from include/config.h:5,
from arch/arm/cpu/u-boot.lds:10:
include/config_distro_bootcmd.h:398:0: note: this is the location of the previous definition
#define CONFIG_BOOTCOMMAND "run distro_bootcmd"
CFG u-boot.cfg
/home/xxx/.local/lib/python3.10/site-packages/setuptools/dist.py:530: UserWarning: The version specified ('u-boot-2018.01') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
warnings.warn(
make[1]: *** [scripts/Makefile.build:425: scripts/dtc] Error 2
make: *** [Makefile:491: scripts] Error 2
请问怎么解决这个问题呢?论坛和谷歌也搜过,但没找到解决的方法。可能是我看不懂
页次: 1