qidao123.com技术社区-IT企服评测·应用市场

标题: 办理 Builroot 系统编译 perl 编译报错题目 [打印本页]

作者: 愛在花開的季節    时间: 2025-5-5 14:57
标题: 办理 Builroot 系统编译 perl 编译报错题目
本文提供一种修复 Builroot 系统编译 perl 编译报错途径


  1. 2025-05-04T22:45:08 rm -f pod/perl5261delta.pod
  2. 2025-05-04T22:45:08 /usr/bin/ln -s perldelta.pod pod/perl5261delta.pod
  3. 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
  4. 2025-05-04T22:45:08 In file included from numeric.c:30:
  5. 2025-05-04T22:45:08 In function 'S_my_atof_infnan',
  6. 2025-05-04T22:45:08 inlined from 'Perl_my_atof2' at numeric.c:1428:21:
  7. 2025-05-04T22:45:08 perl.h:6262:29: warning: argument 1 null where non-null expected [-Wnonnull]
  8. 2025-05-04T22:45:08 6262 | #  define Perl_strtod(s, e) strtod(s, e)
  9. 2025-05-04T22:45:08 |                             ^~~~~~~~~~~~
  10. 2025-05-04T22:45:08 numeric.c:1303:18: note: in expansion of macro 'Perl_strtod'
  11. 2025-05-04T22:45:08 1303 |             nv = Perl_strtod(fake, &endp);
  12. 2025-05-04T22:45:08 |                  ^~~~~~~~~~~
  13. 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
  14. 2025-05-04T22:45:08 In file included from perl.h:790,
  15. 2025-05-04T22:45:08 from numeric.c:30:
  16. 2025-05-04T22:45:08 numeric.c: In function 'Perl_my_atof2':
  17. 2025-05-04T22:45:08 /usr/include/stdlib.h:118:15: note: in a call to function 'strtod' declared 'nonnull'
  18. 2025-05-04T22:45:08 118 | extern double strtod (const char *__restrict __nptr,
  19. 2025-05-04T22:45:08 |               ^~~~~~
  20. 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
  21. 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'
  22. 2025-05-04T22:45:10 Attempt to free unreferenced scalar: SV 0x563360ecf450.
  23. 2025-05-04T22:45:10 Segmentation fault (core dumped)
  24. 2025-05-04T22:45:10 Failed to build miniperl. Please run make minitest
  25. 2025-05-04T22:45:10 make[2]: *** [makefile:364: lib/buildcustomize.pl] Error 1
  26. 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
  27. 2025-05-04T22:45:10 make: *** [/home/binwatson/rk3568/rk356x_linux/buildroot/output/rockchip_rk3568/Makefile:16: _all] Error 2
  28. Command exited with non-zero status 1
  29. you take 49:19.11 to build builroot
  30. ERROR: Running build_buildroot failed!
  31. ERROR: exit code 1 from line 412:
  32.     /usr/bin/time -f "you take %E to build builroot" $COMMON_DIR/mk-buildroot.sh $BOARD_CONFIG
复制代码
本篇办理思路与 Ubuntu22.04及以上版本buildroot SIGSTKSZ 报错题目 雷同,重要思路是通过升级 perl 来办理:

修改 buildroot/package/perl 下面两个文件 perl.mk 和 perl.hash:
  1. ################################################################################
  2. #
  3. # perl
  4. #
  5. ################################################################################
  6. # When updating the version here, also update utils/scancpan
  7. # 修改 PERL_VERSION_MAJOR = 40 为 40 版本
  8. PERL_VERSION_MAJOR = 40
  9. # 修改 PERL_VERSION_MAJOR = 5.x.0 为 5.x.0 这里的 x 是上面的 40
  10. PERL_VERSION = 5.$(PERL_VERSION_MAJOR).0
  11. PERL_SITE = http://www.cpan.org/src/5.0
  12. PERL_SOURCE = perl-$(PERL_VERSION).tar.xz
  13. PERL_LICENSE = Artistic or GPL-1.0+
  14. PERL_LICENSE_FILES = Artistic Copying README
  15. PERL_INSTALL_STAGING = YES
  16. # 配置 perl-cross 的版本为 1.6.2
  17. PERL_CROSS_VERSION = 1.6.2
  18. # DO NOT refactor with the github helper (the result is not the same)
  19. PERL_CROSS_SITE = https://github.com/arsv/perl-cross/releases/download/$(PERL_CROSS_VERSION)
  20. PERL_CROSS_SOURCE = perl-cross-$(PERL_CROSS_VERSION).tar.gz
  21. PERL_EXTRA_DOWNLOADS = $(PERL_CROSS_SITE)/$(PERL_CROSS_SOURCE)
  22. # We use the perlcross hack to cross-compile perl. It should
  23. # be extracted over the perl sources, so we don't define that
  24. # as a separate package. Instead, it is downloaded and extracted
  25. # together with perl
  26. define PERL_CROSS_EXTRACT
  27.         $(call suitable-extractor,$(PERL_CROSS_SOURCE)) $(DL_DIR)/$(PERL_CROSS_SOURCE) | \
  28.         $(TAR) --strip-components=1 -C $(@D) $(TAR_OPTIONS) -
  29. endef
  30. PERL_POST_EXTRACT_HOOKS += PERL_CROSS_EXTRACT
  31. # Even though perl is not an autotools-package, it uses config.sub and
  32. # config.guess. Up-to-date versions of these files may be needed to build perl
  33. # on newer host architectures, so we borrow the hook which updates them from the
  34. # autotools infrastructure.
  35. PERL_POST_PATCH_HOOKS += UPDATE_CONFIG_HOOK
  36. ifeq ($(BR2_PACKAGE_BERKELEYDB),y)
  37. PERL_DEPENDENCIES += berkeleydb
  38. endif
  39. ifeq ($(BR2_PACKAGE_GDBM),y)
  40. PERL_DEPENDENCIES += gdbm
  41. endif
  42. # We have to override LD, because an external multilib toolchain ld is not
  43. # wrapped to provide the required sysroot options.
  44. PERL_CONF_OPTS = \
  45.         --target=$(GNU_TARGET_NAME) \
  46.         --target-tools-prefix=$(TARGET_CROSS) \
  47.         --prefix=/usr \
  48.         -Dld="$(TARGET_CC)" \
  49.         -Dccflags="$(TARGET_CFLAGS)" \
  50.         -Dldflags="$(TARGET_LDFLAGS) -lm" \
  51.         -Dmydomain="" \
  52.         -Dmyhostname="noname" \
  53.         -Dmyuname="Buildroot $(BR2_VERSION_FULL)" \
  54.         -Dosname=linux \
  55.         -Dosvers=$(LINUX_VERSION) \
  56.         -Dperladmin=root
  57. ifeq ($(shell expr $(PERL_VERSION_MAJOR) % 2), 1)
  58. PERL_CONF_OPTS += -Dusedevel
  59. endif
  60. ifeq ($(BR2_STATIC_LIBS),y)
  61. PERL_CONF_OPTS += --all-static --no-dynaloader
  62. endif
  63. PERL_MODULES = $(call qstrip,$(BR2_PACKAGE_PERL_MODULES))
  64. ifneq ($(PERL_MODULES),)
  65. PERL_CONF_OPTS += --only-mod=$(subst $(space),$(comma),$(PERL_MODULES))
  66. endif
  67. define PERL_CONFIGURE_CMDS
  68.         (cd $(@D); $(TARGET_MAKE_ENV) HOSTCC='$(HOSTCC_NOCCACHE)' \
  69.                 ./configure $(PERL_CONF_OPTS))
  70.         $(SED) 's/UNKNOWN-/Buildroot $(BR2_VERSION_FULL) /' $(@D)/patchlevel.h
  71. endef
  72. define PERL_BUILD_CMDS
  73.         $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) all
  74. endef
  75. define PERL_INSTALL_STAGING_CMDS
  76.         $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) DESTDIR="$(STAGING_DIR)" install.perl install.sym
  77. endef
  78. define PERL_INSTALL_TARGET_CMDS
  79.         $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) DESTDIR="$(TARGET_DIR)" install.perl install.sym
  80. endef
  81. HOST_PERL_CONF_OPTS = \
  82.         -des \
  83.         -Dprefix="$(HOST_DIR)" \
  84.         -Dcc="$(HOSTCC)"
  85. define HOST_PERL_CONFIGURE_CMDS
  86.         (cd $(@D); $(HOST_MAKE_ENV) HOSTCC='$(HOSTCC_NOCCACHE)' \
  87.                 ./Configure $(HOST_PERL_CONF_OPTS))
  88. endef
  89. define HOST_PERL_BUILD_CMDS
  90.         $(HOST_MAKE_ENV) $(MAKE) -C $(@D)
  91. endef
  92. define HOST_PERL_INSTALL_CMDS
  93.         $(HOST_MAKE_ENV) $(MAKE) -C $(@D) INSTALL_DEPENDENCE='' install
  94. endef
  95. $(eval $(generic-package))
  96. $(eval $(host-generic-package))
  97. define PERL_FINALIZE_TARGET
  98.         rm -rf $(TARGET_DIR)/usr/lib/perl5/$(PERL_VERSION)/pod
  99.         rm -rf $(TARGET_DIR)/usr/lib/perl5/$(PERL_VERSION)/$(PERL_ARCHNAME)/CORE
  100.         find $(TARGET_DIR)/usr/lib/perl5/ -name 'extralibs.ld' -print0 | xargs -0 rm -f
  101.         find $(TARGET_DIR)/usr/lib/perl5/ -name '*.bs' -print0 | xargs -0 rm -f
  102.         find $(TARGET_DIR)/usr/lib/perl5/ -name '.packlist' -print0 | xargs -0 rm -f
  103. endef
  104. PERL_TARGET_FINALIZE_HOOKS += PERL_FINALIZE_TARGET
复制代码
更新 perl.hash 文件内里压缩包的哈希值:
  1. # Hashes from: http://www.cpan.org/src/5.0/perl-5.26.1.tar.xz.{md5,sha1,sha256}.txt
  2. # md5    70e988b4318739b0cf3ad5e120bfde88                                 perl-5.26.1.tar.xz
  3. # sha1   403bb1804cb41416153d908eea093f2be22a77f6                         perl-5.26.1.tar.xz
  4. # sha256 fe8208133e73e47afc3251c08d2c21c5a60160165a8ab8b669c43a420e4ec680 perl-5.26.1.tar.xz
  5. md5    cfe14ef0709b9687f9c514042e8e1e82                                 perl-5.40.0.tar.xz
  6. sha1   4a3af1f62afc611aa1552adc6c7ec389e9723bce                         perl-5.40.0.tar.xz
  7. sha256 c740348f357396327a9795d3e8323bafd0fe8a5c7835fc1cbaba0cc8dfe7161f perl-5.40.0.tar.xz
  8. # Hashes from: http://github.com/arsv/perl-cross/releases/download/1.1.8/perl-cross-1.1.8.hash
  9. # sha256        08e626ed9c419b8a695a8762ff8b41a553023175e4ad67b5e858fc9b4322521c  perl-cross-1.1.8.tar.gz
  10. sha256 131f7496152ee32067dbac2bc9b44b2f582fc778140e545701b3b2faee782f1d  perl-cross-1.6.2.tar.gz
  11. sha256 8e6beb9ca0ffbc4b9c6550d56f622ecd33d5635ee8af9a8f269fd81f40fb6801  Artistic
  12. sha256 d77d235e41d54594865151f4751e835c5a82322b0e87ace266567c3391a4b912  Copying
  13. sha256 0f593e7e670a85f7199c57c1f0b3c1c541d414af547fde3a5b0fd7ccc235531a  README
复制代码
然后回到 SDK 目次,重新编译 buildroot 即可:

我实测下载很久都没下载下来,因此这里提供一种采用手动下载压缩包的方式:

然后将下载后的两个软件包,放在 buildroot/dl 目次下:

然后编译即可:


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。




欢迎光临 qidao123.com技术社区-IT企服评测·应用市场 (https://dis.qidao123.com/) Powered by Discuz! X3.4