Adding php-curl in a Yocto build

325

I've been building a custom image using Yocto and wpewebkit to use within docker. I need to run a local web server with php, which I have accomplished no problem. I need to use curl within my project and I have apache2, php, modphp, and curl installed. All I need is php-curl but I cannot find how to install this. Does anyone know how or if I can do this? I've put in all my efforts on googling multiple phrases but I only find how to install php-curl using apt-get or yum, or I get links to the meta-* directories which I have access to within my build files anyways.

If it helps at all, this custom image was based on the image provided from the following project on GitHub: https://github.com/resin-io-playground/resin-wpe/tree/master/base-image . I already spoke to the developer and their knowledge of PHP is limited.

EDIT #1: Progress so far, had to update the curl.bb file to properly include libcurl-dev, and then worked with @pmod's suggestion to incorporate curl into the php build. Everything seemed to run okay until I received the following error:

| ../php-7.1.9/configure: line 386: test: please: integer expression expected
| configure: error: reinstall
| ../php-7.1.9/configure: line 275: return: please: numeric argument required
| ../php-7.1.9/configure: line 285: exit: please: numeric argument required
| NOTE: The following config.log files may provide further information.
| NOTE: /base-image/build/tmp-glibc/work/x86_64-linux/php-native/7.1.9-r0/build/config.log
| ERROR: configure failed
| WARNING: /base-image/build/tmp-glibc/work/x86_64-linux/php-native/7.1.9-r0/temp/run.do_configure.29590:1 exit 1 from 'exit 1'
| ERROR: Function failed: do_configure (log file is located at /base-image/build/tmp-glibc/work/x86_64-linux/php-native/7.1.9-r0/temp/log.do_configure.29590)
ERROR: Task (virtual:native:/base-image/build/../meta-openembedded/meta-oe/recipes-devtools/php/php_7.1.9.bb:do_configure) failed with exit code '1'

Edit #2: I've gone ahead and added everything I was missing. I'm getting the same error above, where the function do_configure during the php build is failing. I'm posting below what I ensured I have in my curl.bb file (I had to add this), what I have in my php.inc file, and the curl files located staging directory.

curl.bb:

PACKAGES =+ "lib${BPN} lib${BPN}-native lib${BPN}-dev lib${BPN}-dev-native"

FILES_lib${BPN} = "${libdir}/lib*.so.*"

FILES_lib${BPN}-dev = "${includedir} \
                       ${libdir}/lib*.so \
                       ${libdir}/lib*.a \
                       ${libdir}/lib*.la \
                       ${libdir}/pkgconfig \
                       ${datadir}/aclocal \
                       ${bindir}/*-config"

php.inc:

EXTRA_OECONF_append = " --with-curl=${libdir}/.."
DEPENDS_${PN} += "libcurl-dev libcurl-dev-native"

PHP Staging Directory:

/installeddeps/curl-native
/installeddeps/curl-native.b77f37db31cf2391919a12c5c9774bff
/installeddeps/curl-native.complete
/usr/share/aclocal/libcurl.m4
/usr/bin/curl-config
/usr/bin/crossscripts/curl-config
/usr/bin/curl
/usr/lib/pkgconfig/libcurl.pc
/usr/lib/libcurl.so
/usr/lib/libcurl.a
/usr/lib/libcurl.so.4.4.0
/usr/lib/libcurl.so.4
/usr/include/curl
/usr/include/curl/curl.h
/usr/include/curl/curlrules.h
/usr/include/curl/curlbuild.h
/usr/include/curl/curlver.h
/usr/include/curl/easy.h
871

Answer

Solution:

According to php manual, PHP/cURL feature is enabled at php configuration stage with --with-curl=[dir] option.

I checked the main recipe include file php.inc and couldn't find such configuration option. So, try creating in your working layer php_%.bbappend file with (or add this directly to the bottom of php.inc to test):

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

Note, that curl package among DEPENDS because it is needed at build stage.

I don't think you need to update curl recipe with PACKAGES and FILES, pkg_config should take care

People are also looking for solutions to the problem: Does PHP allow class functions & properties to share the same name?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.