您尚未登录。

楼主 # 2022-10-25 21:34:04

for_work
会员
注册时间: 2022-10-25
已发帖子: 4
积分: 6

[已解决]荔枝派nano Archlinux 下编译 u-boot 求助

已经在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

请问怎么解决这个问题呢?论坛和谷歌也搜过,但没找到解决的方法。可能是我看不懂

最近编辑记录 for_work (2022-10-26 14:59:55)

离线

#1 2022-10-25 23:33:40

海石生风
会员
所在地: 深圳
注册时间: 2019-07-02
已发帖子: 522
积分: 643
个人网站

Re: [已解决]荔枝派nano Archlinux 下编译 u-boot 求助

这是编译host相关工具时出的错,跟交叉编译器无关。找出重复定义的 yylloc ,删除其中一个即可。

最近编辑记录 海石生风 (2022-10-26 00:20:29)

离线

#2 2022-10-26 13:46:16

yuess133
会员
注册时间: 2020-12-10
已发帖子: 18
积分: 13.5

Re: [已解决]荔枝派nano Archlinux 下编译 u-boot 求助

使用最新的u-boot-2022.07 试试

离线

楼主 #3 2022-10-26 14:27:47

for_work
会员
注册时间: 2022-10-25
已发帖子: 4
积分: 6

Re: [已解决]荔枝派nano Archlinux 下编译 u-boot 求助

海石生风 说:

这是编译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行,还是没找到解决办法。

最近编辑记录 for_work (2022-10-26 14:30:25)

离线

楼主 #4 2022-10-26 14:59:32

for_work
会员
注册时间: 2022-10-25
已发帖子: 4
积分: 6

Re: [已解决]荔枝派nano Archlinux 下编译 u-boot 求助

yuess133 说:

使用最新的u-boot-2022.07 试试

谢谢大佬,用22.07版u-boot

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- licheepi_nano_defconfig
make ARCH=arm menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j8

编译成功了。

最近编辑记录 for_work (2022-10-26 15:06:12)

离线

#5 2022-10-26 15:08:14

海石生风
会员
所在地: 深圳
注册时间: 2019-07-02
已发帖子: 522
积分: 643
个人网站

Re: [已解决]荔枝派nano Archlinux 下编译 u-boot 求助

之前另外的编译错误是 include/configs/suniv.h 跟 include/config_distro_bootcmd.h 都定义了的相同的 宏 CONFIG_BOOTCOMMAND, 跟 -fcommon 没有半毛钱关系。
这些都是简单的编译阶段出现的语法问题,如果这些问题都不能找出问题的原因所在,后面的开发也是很难进行下去的。建议想办法提高下编译除错技能。

离线

楼主 #6 2022-10-26 16:06:32

for_work
会员
注册时间: 2022-10-25
已发帖子: 4
积分: 6

Re: [已解决]荔枝派nano Archlinux 下编译 u-boot 求助

@海石生风
谢谢提醒,不过那个只是warning,真正的问题是libfdt_env.h 的conflicting types问题。最后用新版本的u-boot就都解决了。

离线

#7 2022-10-27 09:26:35

QTbin
会员
注册时间: 2022-10-19
已发帖子: 2
积分: 2

Re: [已解决]荔枝派nano Archlinux 下编译 u-boot 求助

for_work 说:
yuess133 说:

使用最新的u-boot-2022.07 试试

谢谢大佬,用22.07版u-boot

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- licheepi_nano_defconfig
make ARCH=arm menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j8

编译成功了。

我想问一下在那里能下载到u-boot-2022.07呢?

离线

#8 2023-10-28 15:36:10

sxlyq_666
会员
注册时间: 2023-09-07
已发帖子: 70
积分: 66

Re: [已解决]荔枝派nano Archlinux 下编译 u-boot 求助

for_work 说:

@海石生风
谢谢提醒,不过那个只是warning,真正的问题是libfdt_env.h 的conflicting types问题。最后用新版本的u-boot就都解决了。


请问,新版本的u-boot 是不是需要用哪个版本的gcc?谢谢。

离线

#9 2024-03-20 18:57:12

BlinkWee
会员
注册时间: 2022-01-25
已发帖子: 7
积分: 7

Re: [已解决]荔枝派nano Archlinux 下编译 u-boot 求助

/usr/include/libfdt_env.h:27:30: error: conflicting types for ‘fdt64_t’ 错误

这是u-boot在编译本机程序(使用 HOSTCC)时出现的,出现这个问题是因为你的系统版本太新了, 然后系统中的 libfdt 是比较新的,u-boot 版本比较老,而 libfdt 库改动过,u-boot 调用该库时出现兼容问题,实际上 u-boot 内置有libfdt,你把系统新的 libfdt-dev 删除,u-boot 就会调用源代码自带的旧的 libfdt, 所以只需下面命令然后重新编译:

sudo apt-get remove libfdt-dev

后面想重新安装只需:

sudo apt-get install libfdt-dev

原文链接:https://www.jianshu.com/p/ad3619db9b3d

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn