简体   繁体   中英

Yocto doesn't copy libphp7.so to rootfs

To add the php apache2 module in Yocto I created a file recipes-devtools/php/php_%.bbappend with the following content:

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

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

The module is built, but the file tmp-glibc/sysroots-components/cortexa7hf-neon-vfpv4/php/usr/lib/apache2/modules/libphp7.so is not copied to the rootfs ( /usr/lib/apache2/modules/ ).

  1. Why it does not deploy the file?
  2. As temporary workaround (and to learn how to handle Yocto's path) I'm trying to manually deploy it with a ROOTFS_POSTPROCESS_COMMAND . To avoid absolute paths, what variable should I use to find out the file above under the tmp-glibc output dir? Something like:

    ${TMPDIR}/sysroots-components/cortexa7hf-neon-vfpv4/php/usr/lib/apache2/modules/libphp7.so

or there's something better?

In Yocto, files (which are installed in ${D} either manually in do_install or by the make, cmake, autotools, etc... in eg do_compile ) are put in a package when they match one of the regular expression (or glob, not entirely sure about that) contained in FILES_foo .

One recipe can (and usually does) provide multiple packages. So you'd have multiple FILES_foo1 with their own paths to match.

In Yocto, the file is put in the first package where one of the paths in its FILE_foo matches the file. Even if the file matches the paths of other packages, it'll ever be in only one package, the first one.

FWIW, packages are created from leftmost to rightmost in PACKAGES variable in the recipe. By default, the PACKAGES variable is ${PN}-src ${PN}-dbg ${PN}-staticdev ${PN}-dev ${PN}-doc ${PN}-locale ${PACKAGE_BEFORE_PN} ${PN} (cf http://git.yoctoproject.org/cgit.cgi/poky/tree/meta/conf/bitbake.conf#n292 ).

The default FILES_* variables are defined in bitbake.conf as well, c.f. http://git.yoctoproject.org/cgit.cgi/poky/tree/meta/conf/bitbake.conf . Look for everything starting with FILES_ .

In there, you can see that by default, FILES_${PN} has ${libdir}/lib*${SOLIBS} (cf http://git.yoctoproject.org/cgit.cgi/poky/tree/meta/conf/bitbake.conf#n296 ) packaged. SOLIBS is, by default, .so.* (cf http://git.yoctoproject.org/cgit.cgi/poky/tree/meta/conf/bitbake.conf#n280 ), which means only dot versions of libraries are packaged in the ${PN} package (if they are not matched by another package before). FILES_${PN}-dev on the other hand packages ${FILES_SOLIBSDEV} which defaults to ${base_libdir}/lib*${SOLIBSDEV} ${libdir}/lib*${SOLIBSDEV} , with SOLIBSDEV in turns defaults to .so (cf http://git.yoctoproject.org/cgit.cgi/poky/tree/meta/conf/bitbake.conf#n313 , http://git.yoctoproject.org/cgit.cgi/poky/tree/meta/conf/bitbake.conf#n314 and http://git.yoctoproject.org/cgit.cgi/poky/tree/meta/conf/bitbake.conf#n283 ). Please note that library filenames should all start with lib to be able to be matched by the default FILES_* .

TL;DR: By default, lib*.so.* in FILES_${PN} and lib*.so in FILES_${PN}-dev .

For your specific issue, you can see that ${libdir}/apache2 directory is packaged in php-modphp thanks to FILES_${PN}-modphp (cf http://git.openembedded.org/meta-openembedded/tree/meta-oe/recipes-devtools/php/php.inc#n243 ).

So you need to add php-modphp (assuming ${PN} resolves to php) to your image to be able for the lib to be installed in your rootfs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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