本文提供一种修复 Builroot 系统编译 perl 编译报错途径

- 2025-05-04T22:45:08 rm -f pod/perl5261delta.pod
- 2025-05-04T22:45:08 /usr/bin/ln -s perldelta.pod pod/perl5261delta.pod
- 2025-05-04T22:45:08 /usr/bin/gcc -c -DPERL_CORE -fwrapv -fpcc-struct-return -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -Wall op.c
- 2025-05-04T22:45:08 In file included from numeric.c:30:
- 2025-05-04T22:45:08 In function 'S_my_atof_infnan',
- 2025-05-04T22:45:08 inlined from 'Perl_my_atof2' at numeric.c:1428:21:
- 2025-05-04T22:45:08 perl.h:6262:29: warning: argument 1 null where non-null expected [-Wnonnull]
- 2025-05-04T22:45:08 6262 | # define Perl_strtod(s, e) strtod(s, e)
- 2025-05-04T22:45:08 | ^~~~~~~~~~~~
- 2025-05-04T22:45:08 numeric.c:1303:18: note: in expansion of macro 'Perl_strtod'
- 2025-05-04T22:45:08 1303 | nv = Perl_strtod(fake, &endp);
- 2025-05-04T22:45:08 | ^~~~~~~~~~~
- 2025-05-04T22:45:08 /usr/bin/gcc -c -DPERL_CORE -fwrapv -fpcc-struct-return -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -Wall perly.c
- 2025-05-04T22:45:08 In file included from perl.h:790,
- 2025-05-04T22:45:08 from numeric.c:30:
- 2025-05-04T22:45:08 numeric.c: In function 'Perl_my_atof2':
- 2025-05-04T22:45:08 /usr/include/stdlib.h:118:15: note: in a call to function 'strtod' declared 'nonnull'
- 2025-05-04T22:45:08 118 | extern double strtod (const char *__restrict __nptr,
- 2025-05-04T22:45:08 | ^~~~~~
- 2025-05-04T22:45:10 /usr/bin/gcc -fstack-protector-strong -L/usr/local/lib -o miniperl opmini.o perlmini.o gv.o toke.o perly.o pad.o regcomp.o dump.o util.o mg.o reentr.o mro_core.o keywords.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o doop.o doio.o regexec.o utf8.o taint.o deb.o universal.o globals.o perlio.o perlapi.o numeric.o mathoms.o locale.o pp_pack.o pp_sort.o caretx.o dquote.o time64.o miniperlmain.o -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
- 2025-05-04T22:45:10 ./miniperl -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
- 2025-05-04T22:45:10 Attempt to free unreferenced scalar: SV 0x563360ecf450.
- 2025-05-04T22:45:10 Segmentation fault (core dumped)
- 2025-05-04T22:45:10 Failed to build miniperl. Please run make minitest
- 2025-05-04T22:45:10 make[2]: *** [makefile:364: lib/buildcustomize.pl] Error 1
- 2025-05-04T22:45:10 make[1]: *** [package/pkg-generic.mk:231: /home/binwatson/rk3568/rk356x_linux/buildroot/output/rockchip_rk3568/build/host-perl-5.26.1/.stamp_built] Error 2
- 2025-05-04T22:45:10 make: *** [/home/binwatson/rk3568/rk356x_linux/buildroot/output/rockchip_rk3568/Makefile:16: _all] Error 2
- Command exited with non-zero status 1
- you take 49:19.11 to build builroot
- ERROR: Running build_buildroot failed!
- ERROR: exit code 1 from line 412:
- /usr/bin/time -f "you take %E to build builroot" $COMMON_DIR/mk-buildroot.sh $BOARD_CONFIG
复制代码 本篇办理思路与 Ubuntu22.04及以上版本buildroot SIGSTKSZ 报错题目 雷同,重要思路是通过升级 perl 来办理:
- perl-cross-.6.2:https://github.com/arsv/perl-cross/releases/tag/1.6.2
- perl-5.40.0:https://www.cpan.org/src/5.0/
修改 buildroot/package/perl 下面两个文件 perl.mk 和 perl.hash:
- ################################################################################
- #
- # perl
- #
- ################################################################################
- # When updating the version here, also update utils/scancpan
- # 修改 PERL_VERSION_MAJOR = 40 为 40 版本
- PERL_VERSION_MAJOR = 40
- # 修改 PERL_VERSION_MAJOR = 5.x.0 为 5.x.0 这里的 x 是上面的 40
- PERL_VERSION = 5.$(PERL_VERSION_MAJOR).0
- PERL_SITE = http://www.cpan.org/src/5.0
- PERL_SOURCE = perl-$(PERL_VERSION).tar.xz
- PERL_LICENSE = Artistic or GPL-1.0+
- PERL_LICENSE_FILES = Artistic Copying README
- PERL_INSTALL_STAGING = YES
- # 配置 perl-cross 的版本为 1.6.2
- PERL_CROSS_VERSION = 1.6.2
- # DO NOT refactor with the github helper (the result is not the same)
- PERL_CROSS_SITE = https://github.com/arsv/perl-cross/releases/download/$(PERL_CROSS_VERSION)
- PERL_CROSS_SOURCE = perl-cross-$(PERL_CROSS_VERSION).tar.gz
- PERL_EXTRA_DOWNLOADS = $(PERL_CROSS_SITE)/$(PERL_CROSS_SOURCE)
- # We use the perlcross hack to cross-compile perl. It should
- # be extracted over the perl sources, so we don't define that
- # as a separate package. Instead, it is downloaded and extracted
- # together with perl
- define PERL_CROSS_EXTRACT
- $(call suitable-extractor,$(PERL_CROSS_SOURCE)) $(DL_DIR)/$(PERL_CROSS_SOURCE) | \
- $(TAR) --strip-components=1 -C $(@D) $(TAR_OPTIONS) -
- endef
- PERL_POST_EXTRACT_HOOKS += PERL_CROSS_EXTRACT
- # Even though perl is not an autotools-package, it uses config.sub and
- # config.guess. Up-to-date versions of these files may be needed to build perl
- # on newer host architectures, so we borrow the hook which updates them from the
- # autotools infrastructure.
- PERL_POST_PATCH_HOOKS += UPDATE_CONFIG_HOOK
- ifeq ($(BR2_PACKAGE_BERKELEYDB),y)
- PERL_DEPENDENCIES += berkeleydb
- endif
- ifeq ($(BR2_PACKAGE_GDBM),y)
- PERL_DEPENDENCIES += gdbm
- endif
- # We have to override LD, because an external multilib toolchain ld is not
- # wrapped to provide the required sysroot options.
- PERL_CONF_OPTS = \
- --target=$(GNU_TARGET_NAME) \
- --target-tools-prefix=$(TARGET_CROSS) \
- --prefix=/usr \
- -Dld="$(TARGET_CC)" \
- -Dccflags="$(TARGET_CFLAGS)" \
- -Dldflags="$(TARGET_LDFLAGS) -lm" \
- -Dmydomain="" \
- -Dmyhostname="noname" \
- -Dmyuname="Buildroot $(BR2_VERSION_FULL)" \
- -Dosname=linux \
- -Dosvers=$(LINUX_VERSION) \
- -Dperladmin=root
- ifeq ($(shell expr $(PERL_VERSION_MAJOR) % 2), 1)
- PERL_CONF_OPTS += -Dusedevel
- endif
- ifeq ($(BR2_STATIC_LIBS),y)
- PERL_CONF_OPTS += --all-static --no-dynaloader
- endif
- PERL_MODULES = $(call qstrip,$(BR2_PACKAGE_PERL_MODULES))
- ifneq ($(PERL_MODULES),)
- PERL_CONF_OPTS += --only-mod=$(subst $(space),$(comma),$(PERL_MODULES))
- endif
- define PERL_CONFIGURE_CMDS
- (cd $(@D); $(TARGET_MAKE_ENV) HOSTCC='$(HOSTCC_NOCCACHE)' \
- ./configure $(PERL_CONF_OPTS))
- $(SED) 's/UNKNOWN-/Buildroot $(BR2_VERSION_FULL) /' $(@D)/patchlevel.h
- endef
- define PERL_BUILD_CMDS
- $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) all
- endef
- define PERL_INSTALL_STAGING_CMDS
- $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) DESTDIR="$(STAGING_DIR)" install.perl install.sym
- endef
- define PERL_INSTALL_TARGET_CMDS
- $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) DESTDIR="$(TARGET_DIR)" install.perl install.sym
- endef
- HOST_PERL_CONF_OPTS = \
- -des \
- -Dprefix="$(HOST_DIR)" \
- -Dcc="$(HOSTCC)"
- define HOST_PERL_CONFIGURE_CMDS
- (cd $(@D); $(HOST_MAKE_ENV) HOSTCC='$(HOSTCC_NOCCACHE)' \
- ./Configure $(HOST_PERL_CONF_OPTS))
- endef
- define HOST_PERL_BUILD_CMDS
- $(HOST_MAKE_ENV) $(MAKE) -C $(@D)
- endef
- define HOST_PERL_INSTALL_CMDS
- $(HOST_MAKE_ENV) $(MAKE) -C $(@D) INSTALL_DEPENDENCE='' install
- endef
- $(eval $(generic-package))
- $(eval $(host-generic-package))
- define PERL_FINALIZE_TARGET
- rm -rf $(TARGET_DIR)/usr/lib/perl5/$(PERL_VERSION)/pod
- rm -rf $(TARGET_DIR)/usr/lib/perl5/$(PERL_VERSION)/$(PERL_ARCHNAME)/CORE
- find $(TARGET_DIR)/usr/lib/perl5/ -name 'extralibs.ld' -print0 | xargs -0 rm -f
- find $(TARGET_DIR)/usr/lib/perl5/ -name '*.bs' -print0 | xargs -0 rm -f
- find $(TARGET_DIR)/usr/lib/perl5/ -name '.packlist' -print0 | xargs -0 rm -f
- endef
- PERL_TARGET_FINALIZE_HOOKS += PERL_FINALIZE_TARGET
复制代码 更新 perl.hash 文件内里压缩包的哈希值:
- # Hashes from: http://www.cpan.org/src/5.0/perl-5.26.1.tar.xz.{md5,sha1,sha256}.txt
- # md5 70e988b4318739b0cf3ad5e120bfde88 perl-5.26.1.tar.xz
- # sha1 403bb1804cb41416153d908eea093f2be22a77f6 perl-5.26.1.tar.xz
- # sha256 fe8208133e73e47afc3251c08d2c21c5a60160165a8ab8b669c43a420e4ec680 perl-5.26.1.tar.xz
- md5 cfe14ef0709b9687f9c514042e8e1e82 perl-5.40.0.tar.xz
- sha1 4a3af1f62afc611aa1552adc6c7ec389e9723bce perl-5.40.0.tar.xz
- sha256 c740348f357396327a9795d3e8323bafd0fe8a5c7835fc1cbaba0cc8dfe7161f perl-5.40.0.tar.xz
- # Hashes from: http://github.com/arsv/perl-cross/releases/download/1.1.8/perl-cross-1.1.8.hash
- # sha256 08e626ed9c419b8a695a8762ff8b41a553023175e4ad67b5e858fc9b4322521c perl-cross-1.1.8.tar.gz
- sha256 131f7496152ee32067dbac2bc9b44b2f582fc778140e545701b3b2faee782f1d perl-cross-1.6.2.tar.gz
- sha256 8e6beb9ca0ffbc4b9c6550d56f622ecd33d5635ee8af9a8f269fd81f40fb6801 Artistic
- sha256 d77d235e41d54594865151f4751e835c5a82322b0e87ace266567c3391a4b912 Copying
- sha256 0f593e7e670a85f7199c57c1f0b3c1c541d414af547fde3a5b0fd7ccc235531a README
复制代码 然后回到 SDK 目次,重新编译 buildroot 即可:

我实测下载很久都没下载下来,因此这里提供一种采用手动下载压缩包的方式:
- perl 下路径,请记住选择和在 perl.mk 设置的版本雷同,这里我上面设置的是 5.40.0 的版本,因此下载 5.40.0 的版本 perl 5.40.0.tar.xz ;
- perl-cross 下载路径,这里我下载 perl-cross-1.6.2.tar.gz;
然后将下载后的两个软件包,放在 buildroot/dl 目次下:
然后编译即可:
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |