I am trying to include pytorch/libtorch in our Yocto-based distribution and running into troubles when it comes to installing precompiled libraries with dependencies among them onto the target.
After trying to compile pytorch
from source to no avail I thought I could use the pre-compiled shared libraries and move onto the next problem. This however proves so far more difficult than initially anticipated.
Specifically, one of the shared libraries I'd like to install, libtorch.so
depends on another shared library distributed along it libgomp-753e6e92.so.1
. When running ldd
it looks something like this:
$ ldd libtorch.so
linux-vdso.so.1 (0x00007ffc27bcb000)
libgomp-753e6e92.so.1 => /home/user/Desktop/libtorch-1.2.0/libtorch/lib/./libgomp-753e6e92.so.1 (0x00007f3052954000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3052735000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f305252d000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f3052315000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f3052111000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3051d73000)
libc10.so => /home/user/Desktop/libtorch-1.2.0/libtorch/lib/./libc10.so (0x00007f3051b2c000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f30517a3000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f30513b2000)
/lib64/ld-linux-x86-64.so.2 (0x00007f305ef4a000)
The bitbake recipe that tries to put everything into place looks like this:
SUMMARY = "Facebook PyTorch AI"
DESCRIPTION = "Facebook PyTorch AI"
HOMEPAGE = "https://pytorch.org/"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=acf4d595f99e159bf31797aa872aef57"
S = "${WORKDIR}/libtorch"
LOCAL_INCLUDE = "${S}/include"
LOCAL_LIB = "${S}/lib"
TARGET_INCLUDE = "${D}${includedir}"
TARGET_LIB = "${D}${libdir}"
SRC_URI = "\
https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-${PV}.zip \
file://LICENSE \
"
SRC_URI[md5sum] = "f34c5b6e46331f79100cd93522bad3ae"
INSANE_SKIP_${PN} = "ldflags"
INSANE_SKIP_${PN} += "already-stripped"
INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_SYSROOT_STRIP = "1"
SOLIBS = ".so"
FILES_SOLIBSDEV = ""
# RDEPENDS_${PN} += "libgomp"
do_install() {
# Create include directory
install -d ${TARGET_INCLUDE}
# Copy all header files
cp -R --no-dereference --preserve=mode,links -v ${LOCAL_INCLUDE}/* ${TARGET_INCLUDE}
# Create library directory
install -d ${TARGET_LIB}
# Install shared libraries
install -m 0755 ${LOCAL_LIB}/*.so* ${TARGET_LIB}
}
FILES_${PN} += "\
${includedir}/* \
${libdir}/* \
"
Unfortunately, I keep getting an error telling me that nothing ir rproviding the libgomp
library which is required by libtorch
.
I have tried multiple things including putting the library in question in its own recipe, explicitly installing it or using the already provided libgomp
runtime dependency but without any luck so far. The error is always something in the likes of:
ERROR: pytorch-1.2.0-r0 do_package_qa: QA Issue: /usr/lib/libtorch.so contained in package pytorch requires libgomp-753e6e92.so.1(GOMP_4.0)(64bit), but no providers found in RDEPENDS_pytorch? [file-rdeps]
ERROR: pytorch-1.2.0-r0 do_package_qa: QA Issue: /usr/lib/libtorch.so contained in package pytorch requires libgomp-753e6e92.so.1(OMP_1.0)(64bit), but no providers found in RDEPENDS_pytorch? [file-rdeps]
ERROR: pytorch-1.2.0-r0 do_package_qa: QA Issue: /usr/lib/libtorch.so contained in package pytorch requires libgomp-753e6e92.so.1()(64bit), but no providers found in RDEPENDS_pytorch? [file-rdeps]
ERROR: pytorch-1.2.0-r0 do_package_qa: QA Issue: /usr/lib/libtorch.so contained in package pytorch requires libgomp-753e6e92.so.1(GOMP_1.0)(64bit), but no providers found in RDEPENDS_pytorch? [file-rdeps]
ERROR: pytorch-1.2.0-r0 do_package_qa: QA run found fatal errors. Please consider fixing them.
ERROR: pytorch-1.2.0-r0 do_package_qa: Function failed: do_package_qa
Any clues on what I am missing?