简体   繁体   English

在 Yocto 中启用 php 国际扩展

[英]Enable php intl extension in Yocto

Following this answer I put in meta-custom-layer/recipes-devtools/php/php_%.bbappend file the this content:按照这个答案,我将这个内容放入meta-custom-layer/recipes-devtools/php/php_%.bbappend文件中:

PACKAGECONFIG_pn-php = "mysql sqlite3 imap opcache openssl ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 pam', d)} apache2"

EXTRA_OECONF_append_class-target = " --with-curl=${STAGING_LIBDIR}/.."
DEPENDS_append_class-target = " icu curl"

EXTRA_OECONF =+ " --enable-mbstring --with-openssl --enable-bcmath --enable-sockets --enable-intl \
                  --with-icu-dir=${BASE_WORKDIR}/cortexa7t2hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/icu/62.1-r0/recipe-sysroot-native/usr \
                        
                  , \
                  , icu-native icu"
PACKAGECONFIG ??= "sqlite3"
PACKAGECONFIG[sqlite3] = "--with-sqlite3=${STAGING_LIBDIR}/.. \
                          --with-pdo-sqlite=${STAGING_LIBDIR}/.. \
                          , \
                          ,sqlite3"

LIBS_pn-php =" -lpthread "
export LIBS
THREADS_pn-php = "pthread"
export THREADS

but after bitbake icu under ${BASE_WORKDIR}/cortexa7t2hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/icu/62.1-r0 there's only a temp folder with all the icu tasks, but no recipe-sysroot-native .但是在${BASE_WORKDIR}/cortexa7t2hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/icu/62.1-r0下的bitbake icu之后,只有一个包含所有 icu 任务的temp文件夹,但没有recipe-sysroot-native I also tried to bitbake build-sysroots with no changes.我还尝试在不做任何更改的情况下对bitbake build-sysroots

Hence, bitbake php fails because it doesn't find the expected files in that folder.因此, bitbake php失败,因为它在该文件夹中找不到预期的文件。

UPDATE更新

Here the error message:这里的错误信息:

checking for location of ICU headers and libraries... not found检查 ICU 头文件和库的位置...未找到

configure: error: Unable to detect ICU prefix or /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/icu/62.1-r0/recipe-sysroot-native/usr/bin/icu-config failed.配置:错误:无法检测ICU前缀或/local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work /cortexa7t2hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/icu/62.1-r0/recipe-sysroot-native/usr/bin/icu-config 失败。

I found icu-config here:我在这里找到了icu-config

work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/recipe-sysroot/usr/bin/crossscripts/icu-config

but because it tries to append /bin to the path set on --with-icu-dir I'm not able to tell it where to find icu-config .但是因为它试图 append /bin--with-icu-dir上设置的路径,所以我无法告诉它在哪里可以找到icu-config

UPDATE2更新2

After following the hints of @Jussi Kukkonen I get these weird compile errors:在遵循@Jussi Kukkonen 的提示后,我得到了这些奇怪的编译错误:

cc1: warning: include location "/usr/include" is unsafe for cross-compilation [-Wpoison-system-directories]
cc1: warning: include location "/usr/include" is unsafe for cross-compilation [-Wpoison-system-directories]
In file included from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/Zend/../TSRM/TSRM.h:52,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/Zend/zend_portability.h:49,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/Zend/zend_types.h:27,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/Zend/zend.h:29,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/main/php.h:35,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/ext/intl/dateformat/../php_intl.h:23,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/ext/intl/dateformat/dateformat_format.c:21:
/usr/include/pthread.h:681:6: warning: 'regparm' attribute directive ignored [-Wattributes]
      __cleanup_fct_attribute;
      ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:693:3: warning: 'regparm' attribute directive ignored [-Wattributes]
   __cleanup_fct_attribute;
   ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:716:6: warning: 'regparm' attribute directive ignored [-Wattributes]
      __cleanup_fct_attribute;
      ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:729:3: warning: 'regparm' attribute directive ignored [-Wattributes]
   __cleanup_fct_attribute;
   ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:738:6: warning: 'regparm' attribute directive ignored [-Wattributes]
      ;
      ^
cc1: warning: include location "/usr/include" is unsafe for cross-compilation [-Wpoison-system-directories]
In file included from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/Zend/../TSRM/TSRM.h:52,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/Zend/zend_portability.h:49,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/Zend/zend_types.h:27,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/Zend/zend.h:29,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/main/php.h:35,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/ext/intl/php_intl.h:23,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/ext/intl/dateformat/dateformat_parse.c:24:
/usr/include/pthread.h:681:6: warning: 'regparm' attribute directive ignored [-Wattributes]
      __cleanup_fct_attribute;
      ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:693:3: warning: 'regparm' attribute directive ignored [-Wattributes]
   __cleanup_fct_attribute;
   ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:716:6: warning: 'regparm' attribute directive ignored [-Wattributes]
      __cleanup_fct_attribute;
      ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:729:3: warning: 'regparm' attribute directive ignored [-Wattributes]
   __cleanup_fct_attribute;
   ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:738:6: warning: 'regparm' attribute directive ignored [-Wattributes]
      ;
      ^
In file included from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/Zend/../TSRM/TSRM.h:52,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/Zend/zend_portability.h:49,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/Zend/zend_types.h:27,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/Zend/zend.h:29,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/main/php.h:35,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/ext/intl/php_intl.h:23,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/ext/intl/msgformat/msgformat.c:24:
/usr/include/pthread.h:681:6: warning: 'regparm' attribute directive ignored [-Wattributes]
      __cleanup_fct_attribute;
      ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:693:3: warning: 'regparm' attribute directive ignored [-Wattributes]
   __cleanup_fct_attribute;
   ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:716:6: warning: 'regparm' attribute directive ignored [-Wattributes]
      __cleanup_fct_attribute;
      ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:729:3: warning: 'regparm' attribute directive ignored [-Wattributes]
   __cleanup_fct_attribute;
   ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:738:6: warning: 'regparm' attribute directive ignored [-Wattributes]
      ;
      ^
In file included from /usr/include/math.h:472,
                 from /local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/ext/intl/dateformat/dateformat_parse.c:22:
/local/STM32MP15-Ecosystem-v1.0.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-02-20/build-openstlinuxeglfs-stm32mp1/tmp-glibc/work/cortexa7hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/php/7.2.10-r0/php-7.2.10/ext/intl/dateformat/dateformat_parse.c: In function 'zif_datefmt_parse':
/usr/include/bits/mathinline.h:751:3: error: invalid 'asm': invalid operand for code 'w'
   __asm __volatile ("fnstcw %3\n\t"           \
   ^~~~~
/usr/include/bits/mathinline.h:503:5: note: in definition of macro '__inline_mathcodeNP_'
     code;              \
     ^~~~
/usr/include/bits/mathinline.h:746:1: note: in expansion of macro '__inline_mathcodeNP'
 __inline_mathcodeNP (floor, __x, \
 ^~~~~~~~~~~~~~~~~~~
/usr/include/bits/mathinline.h:769:3: error: invalid 'asm': invalid operand for code 'w'
   __asm __volatile ("fnstcw %3\n\t"           \
   ^~~~~
/usr/include/bits/mathinline.h:503:5: note: in definition of macro '__inline_mathcodeNP_'
     code;              \
     ^~~~
/usr/include/bits/mathinline.h:764:1: note: in expansion of macro '__inline_mathcodeNP'
 __inline_mathcodeNP (ceil, __x, \
 ^~~~~~~~~~~~~~~~~~~
{standard input}: Assembler messages:
{standard input}:463: Error: bad instruction `fnstcw [sp,#16]'
{standard input}:464: Error: bad instruction `movzwl [sp,#16],r3'
{standard input}:465: Error: bad instruction `andl $0xf3ff,r3'
{standard input}:466: Error: bad instruction `orl $0x0400,r3'
{standard input}:467: Error: ARM register expected -- `movw ,[sp,#18]'
{standard input}:468: Error: bad instruction `fldcw [sp,#18]'
{standard input}:469: Error: bad instruction `frndint'
{standard input}:470: Error: bad instruction `fldcw [sp,#16]'
{standard input}:685: Error: bad instruction `fnstcw [sp,#16]'
{standard input}:686: Error: bad instruction `movzwl [sp,#16],r3'
{standard input}:687: Error: bad instruction `andl $0xf3ff,r3'
{standard input}:688: Error: bad instruction `orl $0x0800,r3'
{standard input}:689: Error: ARM register expected -- `movw ,[sp,#18]'
{standard input}:690: Error: bad instruction `fldcw [sp,#18]'
{standard input}:691: Error: bad instruction `frndint'
{standard input}:692: Error: bad instruction `fldcw [sp,#16]'
Makefile:1007: recipe for target 'ext/intl/dateformat/dateformat_parse.lo' failed
make: *** [ext/intl/dateformat/dateformat_parse.lo] Error 1
make: *** Waiting for unfinished jobs....
ERROR: oe_runmake failed
WARNING: exit code 1 from a shell command.
ERROR: Function failed: do_compile 

So here's how I'd try to do it (I'm not a php specialist and the build seems to take such a long time that I'm not testing this on target myself).所以这就是我要尝试的方法(我不是 php 专家,构建似乎需要很长时间,以至于我自己没有在目标上进行测试)。 The following creates a new packageconfig以下创建一个新的 packageconfig

PACKAGECONFIG[intl] = "--enable-intl,--disable-intl,icu"

php actually supports pkg-config so it should just find icu with that. php 实际上支持 pkg-config 所以它应该只找到 icu 。 At least configure works fine here on Yocto Warrior: php finds icu and enables intl.至少在 Yocto Warrior 上配置工作正常:php 找到 icu 并启用 intl。

With that addition you can then add "intl" to your PACKAGECONFIG line (and remove "_pn-php" postfix: it is not useful inside the recipe file or bbappend):通过该添加,您可以将“intl”添加到您的 PACKAGECONFIG 行(并删除“_pn-php”后缀:它在配方文件或 bbappend 中没有用):

PACKAGECONFIG = "intl mysql sqlite3 imap opcache openssl ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 pam', d)} apache2"

You should also be able to remove that EXTRA_OECONF monstrosity.您还应该能够删除 EXTRA_OECONF 怪物。 While you're at it maybe remove all of the sqlite3 lines unless you know you really need them (they are in all maintained yocto versions already as far as I can tell).当您使用它时,可能会删除所有 sqlite3 行,除非您知道您确实需要它们(据我所知,它们已经在所有维护的 yocto 版本中)。 So remove these:所以删除这些:

EXTRA_OECONF =+ " --enable-mbstring --with-openssl --enable-bcmath --enable-sockets --enable-intl \
                  --with-icu-dir=${BASE_WORKDIR}/cortexa7t2hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi/icu/62.1-r0/recipe-sysroot-native/usr \

                  , \
                  , icu-native icu"
PACKAGECONFIG ??= "sqlite3"
PACKAGECONFIG[sqlite3] = "--with-sqlite3=${STAGING_LIBDIR}/.. \
                          --with-pdo-sqlite=${STAGING_LIBDIR}/.. \
                          , \
                          ,sqlite3"

To tell you the truth none of the remaining lines seem useful either but maybe they're not actively harmful.说实话,剩下的几行似乎也没什么用,但也许它们并不是有害的。

Something is wrong with the PHP 7.2.1 recipe. PHP 7.2.1 配方有问题。 If you you are on "thud" branch for your layers then you might want to either switch to "warrior" branch and re-run the bitbake php -v command or copy the recipe for php 7.3.x + files to your php recipe directory from here https://github.com/openembedded/meta-openembedded/tree/master/meta-oe/recipes-devtools/php .如果您在图层的“thud”分支上,那么您可能需要切换到“warrior”分支并重新运行bitbake php -v命令或将 php 7.3.x 的配方 + 文件复制到 ZE19344AC 目录中从这里https://github.com/openembedded/meta-openembedded/tree/master/meta-oe/recipes-devtools/php

Also, Jussi Kukkonen is correct in that you could just use the PACKAGECONFIG option.此外,Jussi Kukkonen 是正确的,因为您可以只使用 PACKAGECONFIG 选项。 Your mileage will vary to the third party libs you want for php, but I think the issue here is the recipe.您的里程会因您想要的 php 的第三方库而异,但我认为这里的问题是配方。 I got php working on both thud and warrior branches using the following:我得到了 php 使用以下方法在 thud 和 Warriors 分支上工作:

EXTRA_OECONF_append_class-target = " --with-curl=${STAGING_LIBDIR}/.."
DEPENDS_append_class-target = " icu curl openssl"

EXTRA_OECONF =+ " --enable-mbstring --with-openssl=${STAGING_DIR_TARGET}${exec_prefix} --enable-bcmath --enable-sockets --enable-intl \
                      , \
                      , icu-native icu"
PACKAGECONFIG ??= "intl sqlite3"
PACKAGECONFIG[sqlite3] = "--with-openssl=${STAGING_DIR_TARGET}${exec_prefix} \
              --with-sqlite3=${STAGING_LIBDIR}/.. \
                          --with-pdo-sqlite=${STAGING_LIBDIR}/.. \
                          , \
                          ,sqlite3"

LIBS_pn-php =" -lpthread "
export LIBS
THREADS_pn-php = "pthread"
export THREADS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM