After upgrading to rust v1.86.0 and building it with poky the following error is observed:
error: failed to run custom build command for `openssl-sys v0.9.92`
Caused by:
process didn't exit successfully: `home/poky/build/tmp/work/x86_64-linux/rust-native/1.86.0/rustc-1.86.0-src/build/x86_64-unknown-linux-gnu/stage2-tools/release/build/openssl-sys-59fd9a385ef5252b/build-script-main` (exit status: 101)
.
.
.
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
run pkg_config fail: Could not run `PKG_CONFIG_PATH=/home/poky/build/tmp/work/x86_64-linux/rust-native/1.86.0/recipe-sysroot-native/usr/lib/pkgconfig:/home/poky/build/tmp/work/x86_64-linux/rust-native/1.86.0/recipe-sysroot-native/usr/share/pkgconfig PKG_CONFIG_LIBDIR=/home/poky/build/tmp/work/x86_64-linux/rust-native/1.86.0/recipe-sysroot-native/usr/lib/pkgconfig PKG_CONFIG_SYSROOT_DIR= PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags openssl`
The pkg-config command could not be found.
Most likely, you need to install a pkg-config package for your OS.
Try `apt install pkg-config`, or `yum install pkg-config`,
or `pkg install pkg-config`, or `apk add pkgconfig` depending on your distribution.
If you've already installed it, ensure the pkg-config command is one of the
directories in the PATH environment variable.
If you did not expect this build to link to a pre-installed system library,
then check documentation of the openssl-sys crate for an option to
build the library from source, or disable features or dependencies
that require pkg-config.
--- stderr
thread 'main' panicked at /rust/deps/openssl-sys-0.9.92/build/find_normal.rs:190:5:
Could not find directory of OpenSSL installation, and this `-sys` crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it, you can set the `OPENSSL_DIR` environment variable for the
compilation process.
Make sure you also have the development packages of openssl installed.
For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.
If you're in a situation where you think the directory *should* be found
automatically, please open a bug at https://github.com/sfackler/rust-openssl
and include information about your system as well as this message.
$HOST = x86_64-unknown-linux-gnu
$TARGET = x86_64-unknown-linux-gnu
openssl-sys = 0.9.92
It looks like you're compiling on Linux and also targeting Linux. Currently this
requires the `pkg-config` utility to find OpenSSL but unfortunately `pkg-config`
could not be found. If you have OpenSSL installed you can likely fix this by
installing `pkg-config`.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
I already followed the following issue threads but could not get a proper fix even after re-installing openssl and pkg-config.
Please assist me with fixing this build error.
Thanks.
CC: @bjorn3
My system information for the packages is as follows:
$ ls /usr/share/pkgconfig/
adwaita-icon-theme.pc dmxproto.pc fontutil.pc poppler-data.pc scrnsaverproto.pc xcmiscproto.pc xineramaproto.pc
applewmproto.pc dpmsproto.pc glproto.pc presentproto.pc shared-mime-info.pc xextproto.pc xkbcomp.pc
bash-completion.pc dri2proto.pc inputproto.pc randrproto.pc systemd.pc xf86bigfontproto.pc xkeyboard-config.pc
bigreqsproto.pc dri3proto.pc iso-codes.pc recordproto.pc udev.pc xf86dgaproto.pc xorg-sgml-doctools.pc
compositeproto.pc fixesproto.pc kbproto.pc renderproto.pc videoproto.pc xf86driproto.pc xproto.pc
damageproto.pc fontsproto.pc m17n-db.pc resourceproto.pc xbitmaps.pc xf86vidmodeproto.pc xtrans.pc
$ ls /usr/lib/x86_64-linux-gnu/pkgconfig/
alsa.pc glib-2.0.pc libdrm_amdgpu.pc libpcre2-posix.pc libtirpc.pc pciaccess.pc tinfo.pc
blkid.pc gl.pc libdrm_intel.pc libpcre32.pc libxcrypt.pc pixman-1.pc uuid.pc
caca++.pc glu.pc libdrm_nouveau.pc libpcrecpp.pc menu.pc pthread-stubs.pc x11.pc
caca.pc glx.pc libdrm.pc libpcre.pc menuw.pc python-3.10-embed.pc xau.pc
dri.pc gmodule-2.0.pc libdrm_radeon.pc libpcreposix.pc mount.pc python-3.10.pc xcb.pc
egl.pc gmodule-export-2.0.pc libelf.pc libpng16.pc ncurses++.pc python-3.6m.pc xdmcp.pc
expat.pc gmodule-no-export-2.0.pc libffi.pc libpng.pc ncurses.pc python-3.6.pc xext.pc
form.pc gobject-2.0.pc libglvnd.pc libpulse-mainloop-glib.pc ncurses++w.pc python3-embed.pc zlib.pc
formw.pc gthread-2.0.pc libnsl.pc libpulse.pc ncursesw.pc python3.pc
gio-2.0.pc libconfig.pc libpcre16.pc libpulse-simple.pc opengl.pc sdl.pc
gio-unix-2.0.pc libcrypto.pc libpcre2-16.pc libselinux.pc openssl.pc slang.pc
glesv1_cm.pc libcrypt.pc libpcre2-32.pc libsepol.pc panel.pc sqlite3.pc
glesv2.pc libcurl.pc libpcre2-8.pc libssl.pc panelw.pc tic.pc
$ dpkg -l | grep libssl
ii libssl-dev:amd64 3.0.2-0ubuntu1.19 amd64 Secure Sockets Layer toolkit - development files
ii libssl1.0.0:amd64 1.0.2n-1ubuntu5.10 amd64 Secure Sockets Layer toolkit - shared libraries
ii libssl1.1:amd64 1.1.1f-1ubuntu2.16 amd64 Secure Sockets Layer toolkit - shared libraries
rc libssl1.1:i386 1.1.1f-1ubuntu2.16 i386 Secure Sockets Layer toolkit - shared libraries
ii libssl3:amd64 3.0.2-0ubuntu1.19 amd64 Secure Sockets Layer toolkit - shared libraries
ii libssl3:i386 3.0.2-0ubuntu1.19 i386 Secure Sockets Layer toolkit - shared libraries
$ dpkg -L libssl-dev
/.
/usr
/usr/include
/usr/include/openssl
/usr/include/openssl/aes.h
/usr/include/openssl/asn1.h
/usr/include/openssl/asn1_mac.h
/usr/include/openssl/asn1err.h
/usr/include/openssl/asn1t.h
/usr/include/openssl/async.h
/usr/include/openssl/asyncerr.h
/usr/include/openssl/bio.h
/usr/include/openssl/bioerr.h
/usr/include/openssl/blowfish.h
/usr/include/openssl/bn.h
/usr/include/openssl/bnerr.h
/usr/include/openssl/buffer.h
/usr/include/openssl/buffererr.h
/usr/include/openssl/camellia.h
/usr/include/openssl/cast.h
/usr/include/openssl/cmac.h
/usr/include/openssl/cmp.h
/usr/include/openssl/cmp_util.h
/usr/include/openssl/cmperr.h
/usr/include/openssl/cms.h
/usr/include/openssl/cmserr.h
/usr/include/openssl/comp.h
/usr/include/openssl/comperr.h
/usr/include/openssl/conf.h
/usr/include/openssl/conf_api.h
/usr/include/openssl/conferr.h
/usr/include/openssl/conftypes.h
/usr/include/openssl/core.h
/usr/include/openssl/core_dispatch.h
/usr/include/openssl/core_names.h
/usr/include/openssl/core_object.h
/usr/include/openssl/crmf.h
/usr/include/openssl/crmferr.h
/usr/include/openssl/crypto.h
/usr/include/openssl/cryptoerr.h
/usr/include/openssl/cryptoerr_legacy.h
/usr/include/openssl/ct.h
/usr/include/openssl/cterr.h
/usr/include/openssl/decoder.h
/usr/include/openssl/decodererr.h
/usr/include/openssl/des.h
/usr/include/openssl/dh.h
/usr/include/openssl/dherr.h
/usr/include/openssl/dsa.h
/usr/include/openssl/dsaerr.h
/usr/include/openssl/dtls1.h
/usr/include/openssl/e_os2.h
/usr/include/openssl/ebcdic.h
/usr/include/openssl/ec.h
/usr/include/openssl/ecdh.h
/usr/include/openssl/ecdsa.h
/usr/include/openssl/ecerr.h
/usr/include/openssl/encoder.h
/usr/include/openssl/encodererr.h
/usr/include/openssl/engine.h
/usr/include/openssl/engineerr.h
/usr/include/openssl/err.h
/usr/include/openssl/ess.h
/usr/include/openssl/esserr.h
/usr/include/openssl/evp.h
/usr/include/openssl/evperr.h
/usr/include/openssl/fips_names.h
/usr/include/openssl/fipskey.h
/usr/include/openssl/hmac.h
/usr/include/openssl/http.h
/usr/include/openssl/httperr.h
/usr/include/openssl/idea.h
/usr/include/openssl/kdf.h
/usr/include/openssl/kdferr.h
/usr/include/openssl/lhash.h
/usr/include/openssl/macros.h
/usr/include/openssl/md2.h
/usr/include/openssl/md4.h
/usr/include/openssl/md5.h
/usr/include/openssl/mdc2.h
/usr/include/openssl/modes.h
/usr/include/openssl/obj_mac.h
/usr/include/openssl/objects.h
/usr/include/openssl/objectserr.h
/usr/include/openssl/ocsp.h
/usr/include/openssl/ocsperr.h
/usr/include/openssl/opensslv.h
/usr/include/openssl/ossl_typ.h
/usr/include/openssl/param_build.h
/usr/include/openssl/params.h
/usr/include/openssl/pem.h
/usr/include/openssl/pem2.h
/usr/include/openssl/pemerr.h
/usr/include/openssl/pkcs12.h
/usr/include/openssl/pkcs12err.h
/usr/include/openssl/pkcs7.h
/usr/include/openssl/pkcs7err.h
/usr/include/openssl/prov_ssl.h
/usr/include/openssl/proverr.h
/usr/include/openssl/provider.h
/usr/include/openssl/rand.h
/usr/include/openssl/randerr.h
/usr/include/openssl/rc2.h
/usr/include/openssl/rc4.h
/usr/include/openssl/rc5.h
/usr/include/openssl/ripemd.h
/usr/include/openssl/rsa.h
/usr/include/openssl/rsaerr.h
/usr/include/openssl/safestack.h
/usr/include/openssl/seed.h
/usr/include/openssl/self_test.h
/usr/include/openssl/sha.h
/usr/include/openssl/srp.h
/usr/include/openssl/srtp.h
/usr/include/openssl/ssl.h
/usr/include/openssl/ssl2.h
/usr/include/openssl/ssl3.h
/usr/include/openssl/sslerr.h
/usr/include/openssl/sslerr_legacy.h
/usr/include/openssl/stack.h
/usr/include/openssl/store.h
/usr/include/openssl/storeerr.h
/usr/include/openssl/symhacks.h
/usr/include/openssl/tls1.h
/usr/include/openssl/trace.h
/usr/include/openssl/ts.h
/usr/include/openssl/tserr.h
/usr/include/openssl/txt_db.h
/usr/include/openssl/types.h
/usr/include/openssl/ui.h
/usr/include/openssl/uierr.h
/usr/include/openssl/whrlpool.h
/usr/include/openssl/x509.h
/usr/include/openssl/x509_vfy.h
/usr/include/openssl/x509err.h
/usr/include/openssl/x509v3.h
/usr/include/openssl/x509v3err.h
/usr/include/x86_64-linux-gnu
/usr/include/x86_64-linux-gnu/openssl
/usr/include/x86_64-linux-gnu/openssl/configuration.h
/usr/include/x86_64-linux-gnu/openssl/opensslconf.h
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libcrypto.a
/usr/lib/x86_64-linux-gnu/libssl.a
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/libcrypto.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/libssl.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/openssl.pc
/usr/share
/usr/share/doc
/usr/share/doc/libssl-dev
/usr/lib/x86_64-linux-gnu/libcrypto.so
/usr/lib/x86_64-linux-gnu/libssl.so
/usr/share/doc/libssl-dev/changelog.Debian.gz
/usr/share/doc/libssl-dev/changelog.gz
/usr/share/doc/libssl-dev/copyright
yshinde@ala-lpggp3:/ala-lpggp31/yshinde-> dpkg -L libssl-dev | rg openssl
/usr/include/openssl
/usr/include/openssl/aes.h
/usr/include/openssl/asn1.h
/usr/include/openssl/asn1_mac.h
/usr/include/openssl/asn1err.h
/usr/include/openssl/asn1t.h
/usr/include/openssl/async.h
/usr/include/openssl/asyncerr.h
/usr/include/openssl/bio.h
/usr/include/openssl/bioerr.h
/usr/include/openssl/blowfish.h
/usr/include/openssl/bn.h
/usr/include/openssl/bnerr.h
/usr/include/openssl/buffer.h
/usr/include/openssl/buffererr.h
/usr/include/openssl/camellia.h
/usr/include/openssl/cast.h
/usr/include/openssl/cmac.h
/usr/include/openssl/cmp.h
/usr/include/openssl/cmp_util.h
/usr/include/openssl/cmperr.h
/usr/include/openssl/cms.h
/usr/include/openssl/cmserr.h
/usr/include/openssl/comp.h
/usr/include/openssl/comperr.h
/usr/include/openssl/conf.h
/usr/include/openssl/conf_api.h
/usr/include/openssl/conferr.h
/usr/include/openssl/conftypes.h
/usr/include/openssl/core.h
/usr/include/openssl/core_dispatch.h
/usr/include/openssl/core_names.h
/usr/include/openssl/core_object.h
/usr/include/openssl/crmf.h
/usr/include/openssl/crmferr.h
/usr/include/openssl/crypto.h
/usr/include/openssl/cryptoerr.h
/usr/include/openssl/cryptoerr_legacy.h
/usr/include/openssl/ct.h
/usr/include/openssl/cterr.h
/usr/include/openssl/decoder.h
/usr/include/openssl/decodererr.h
/usr/include/openssl/des.h
/usr/include/openssl/dh.h
/usr/include/openssl/dherr.h
/usr/include/openssl/dsa.h
/usr/include/openssl/dsaerr.h
/usr/include/openssl/dtls1.h
/usr/include/openssl/e_os2.h
/usr/include/openssl/ebcdic.h
/usr/include/openssl/ec.h
/usr/include/openssl/ecdh.h
/usr/include/openssl/ecdsa.h
/usr/include/openssl/ecerr.h
/usr/include/openssl/encoder.h
/usr/include/openssl/encodererr.h
/usr/include/openssl/engine.h
/usr/include/openssl/engineerr.h
/usr/include/openssl/err.h
/usr/include/openssl/ess.h
/usr/include/openssl/esserr.h
/usr/include/openssl/evp.h
/usr/include/openssl/evperr.h
/usr/include/openssl/fips_names.h
/usr/include/openssl/fipskey.h
/usr/include/openssl/hmac.h
/usr/include/openssl/http.h
/usr/include/openssl/httperr.h
/usr/include/openssl/idea.h
/usr/include/openssl/kdf.h
/usr/include/openssl/kdferr.h
/usr/include/openssl/lhash.h
/usr/include/openssl/macros.h
/usr/include/openssl/md2.h
/usr/include/openssl/md4.h
/usr/include/openssl/md5.h
/usr/include/openssl/mdc2.h
/usr/include/openssl/modes.h
/usr/include/openssl/obj_mac.h
/usr/include/openssl/objects.h
/usr/include/openssl/objectserr.h
/usr/include/openssl/ocsp.h
/usr/include/openssl/ocsperr.h
/usr/include/openssl/opensslv.h
/usr/include/openssl/ossl_typ.h
/usr/include/openssl/param_build.h
/usr/include/openssl/params.h
/usr/include/openssl/pem.h
/usr/include/openssl/pem2.h
/usr/include/openssl/pemerr.h
/usr/include/openssl/pkcs12.h
/usr/include/openssl/pkcs12err.h
/usr/include/openssl/pkcs7.h
/usr/include/openssl/pkcs7err.h
/usr/include/openssl/prov_ssl.h
/usr/include/openssl/proverr.h
/usr/include/openssl/provider.h
/usr/include/openssl/rand.h
/usr/include/openssl/randerr.h
/usr/include/openssl/rc2.h
/usr/include/openssl/rc4.h
/usr/include/openssl/rc5.h
/usr/include/openssl/ripemd.h
/usr/include/openssl/rsa.h
/usr/include/openssl/rsaerr.h
/usr/include/openssl/safestack.h
/usr/include/openssl/seed.h
/usr/include/openssl/self_test.h
/usr/include/openssl/sha.h
/usr/include/openssl/srp.h
/usr/include/openssl/srtp.h
/usr/include/openssl/ssl.h
/usr/include/openssl/ssl2.h
/usr/include/openssl/ssl3.h
/usr/include/openssl/sslerr.h
/usr/include/openssl/sslerr_legacy.h
/usr/include/openssl/stack.h
/usr/include/openssl/store.h
/usr/include/openssl/storeerr.h
/usr/include/openssl/symhacks.h
/usr/include/openssl/tls1.h
/usr/include/openssl/trace.h
/usr/include/openssl/ts.h
/usr/include/openssl/tserr.h
/usr/include/openssl/txt_db.h
/usr/include/openssl/types.h
/usr/include/openssl/ui.h
/usr/include/openssl/uierr.h
/usr/include/openssl/whrlpool.h
/usr/include/openssl/x509.h
/usr/include/openssl/x509_vfy.h
/usr/include/openssl/x509err.h
/usr/include/openssl/x509v3.h
/usr/include/openssl/x509v3err.h