您尚未登录。

楼主 # 2023-02-13 09:53:54

Gentlepig
会员
注册时间: 2018-10-24
已发帖子: 1,363
积分: 1323.5

buildroot 如何指定 host-m4 版本?

在ubuntu22.04上打算编译下nuc972的bsp,结果报错:

c-stack.c:55:26: error: missing binary operator before token "("
   55 | #elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384

网上搜了下,搜到这个:
https://blog.csdn.net/weixin_45647912/article/details/123768601

提示升级host-m4版本即可,由m4-1.4.18升级为m4-1.4.19即可。

但是,如何升级这个host-m4呢?我删除dl目录下的m4-1.4.18.tar.xz,下载m4-1.4.19.tar.xz放进去,结果make时还是会自动下载1.4.18。
也不知道这个是在哪里指定版本的?

离线

#1 2023-02-13 11:05:27

山羊胡子
会员
注册时间: 2020-11-10
已发帖子: 22
积分: 14.5

Re: buildroot 如何指定 host-m4 版本?

修改package/m4下的m4.mk和m4.hash

离线

楼主 #2 2023-02-13 14:13:23

Gentlepig
会员
注册时间: 2018-10-24
已发帖子: 1,363
积分: 1323.5

Re: buildroot 如何指定 host-m4 版本?

山羊胡子 说:

修改package/m4下的m4.mk和m4.hash

感谢。修改后:
m4.mk:

################################################################################
#
# m4
#
################################################################################

M4_VERSION = 1.4.19
M4_SOURCE = m4-$(M4_VERSION).tar.xz
M4_SITE = $(BR2_GNU_MIRROR)/m4
M4_LICENSE = GPL-3.0+
M4_LICENSE_FILES = COPYING

$(eval $(host-autotools-package))

m4.hash:

# Locally calculated after checking pgp signature
sha256  63aede5c6d33b6d9b13511cd0be2cac046f2e70fd0a07aa9573a04a82783af96  m4-1.4.19.tar.xz
# License files, locally calculated
sha256  3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986  COPYING

手动下载m4-1.4.19.tar.xz放到dl目录下,能正确解压了,但是后续还是会有报错:

Applying 0001-fflush-adjust-to-glibc-2.28-libio.h-removal.patch using patch: 
Error: duplicate filename '0001-fflush-adjust-to-glibc-2.28-libio.h-removal.patch'
Conflicting files are:
  already applied: /home/xxx/NUC970_Buildroot/package/m4/0001-fflush-adjust-to-glibc-2.28-libio.h-removal.patch
  to be applied  : /home/xxx/NUC970_Buildroot/package/m4/0001-fflush-adjust-to-glibc-2.28-libio.h-removal.patch
make[1]: *** [package/pkg-generic.mk:184:/home/any/MPU/nuc970bsp/20200318/NUC970_Buildroot/output/build/host-m4-1.4.19/.stamp_patched] 错误 1
make: *** [Makefile:76:_all] 错误 2

意思三0001--fflush-adjust-to-glibc-2.28-libio.h-removal.pathch文件重复了?但是我搜了当前目录,只有一个文件。

-------------------------------------------------

不对,第一次报错时是这个错误:

Applying 0002-fflush-be-more-paranoid-about-libio.h-change.patch using patch: 
patching file lib/fflush.c
Reversed (or previously applied) patch detected!  Skipping patch.
3 out of 3 hunks ignored -- saving rejects to file lib/fflush.c.rej
patching file lib/fpending.c
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file lib/fpending.c.rej
patching file lib/fpurge.c
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file lib/fpurge.c.rej
patching file lib/freadahead.c
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file lib/freadahead.c.rej
patching file lib/freading.c
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file lib/freading.c.rej
patching file lib/fseeko.c
Reversed (or previously applied) patch detected!  Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file lib/fseeko.c.rej

再次make时才会报文件名重复这个错误。

-------------------------------------------------------------

手动把报错的那个文件删除,再次make,又有个类似的报错,但文件名不一样,再删再make,貌似可以了。

最近编辑记录 Gentlepig (2023-02-13 14:20:08)

离线

楼主 #3 2023-02-13 14:23:48

Gentlepig
会员
注册时间: 2018-10-24
已发帖子: 1,363
积分: 1323.5

Re: buildroot 如何指定 host-m4 版本?

往下继续,报错还是挺多:

../../gcc/reload1.c: In function ‘void init_reload()’:
../../gcc/reload1.c:89:24: error: use of an operand of type ‘bool’ in ‘operator++’ is forbidden in C++17
   89 |   (this_target_reload->x_spill_indirect_levels)
      |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
../../gcc/reload1.c:443:7: note: in expansion of macro ‘spill_indirect_levels’
  443 |       spill_indirect_levels++;

---------------------------------------------------

没搜到解决办法,gcc4.8.5换gcc4.9.0,暂时能往下进行。就是有个问题,我板子上的根文件系统,是用gcc4.8.5制作的,现在PC上交叉编译器环城gcc4.9.0,不知道会遇到什么问题。

-------------------------------------------------

晕,换gcc4.9.0,最后还是会报上边那个错误。

-----------------------------------------------------------

换gcc5,报同样错误。
换gcc6,报以下错误:

../../gcc/ubsan.c: In function ‘bool ubsan_use_new_style_p(location_t)’:
../../gcc/ubsan.c:1472:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
 1472 |       || xloc.file == '\0' || xloc.file[0] == '\xff'

最近编辑记录 Gentlepig (2023-02-13 15:07:58)

离线

楼主 #4 2023-02-21 14:03:42

Gentlepig
会员
注册时间: 2018-10-24
已发帖子: 1,363
积分: 1323.5

Re: buildroot 如何指定 host-m4 版本?

搜到了这个帖子:
http://fuqiang1986.com/2022/07/22/%E5%85%A8%E5%BF%97%E5%93%AA%E5%90%92d1%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BB%A3%E7%A0%81%E4%B8%8B%E8%BD%BD%E7%BC%96%E8%AF%91%E4%B8%8E%E8%B0%83%E8%AF%95/
buildroot提供了003xxxxxxx.pathc,打上这个补丁就可以解决这个问题。
我是下载到了output/build/host-m4xxx/这个目录下,然后git apply   xxxx.patch。

然后就是我在3#遇到的那个问题,还未解决:

../../gcc/reload1.c: In function ‘void init_reload()’:
../../gcc/reload1.c:89:24: error: use of an operand of type ‘bool’ in ‘operator++’ is forbidden in C++17
   89 |   (this_target_reload->x_spill_indirect_levels)

--------------------------------------------------------------------

在gcc/reload1.c里的443行,找到了对应的x_spill_indirect_levels++那一行,改成这样:

  while (memory_address_p (QImode, tem))
    {
//      spill_indirect_levels++;
      spill_indirect_levels = spill_indirect_levels + 1;
      tem = gen_rtx_MEM (Pmode, tem);
    }

-----------------------------------------

又遇到找不到 _STAT_VER 定义。

error: '_STAT_VER' undeclared (first use in this function)99 | #define INT_NEXT_STAT(a,b) NEXT_STAT64(_STAT_VER,a,b

和上上个问题类似,找fakeroot的002xxx.patch补丁。
https://git.buildroot.org/buildroot/tree/package/fakeroot?id=5a9504831f3fa1ef3be334036c93da30150fde55

最近编辑记录 Gentlepig (2023-02-21 16:13:04)

离线

页脚

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

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