我试图将pytorch/libtorch包含在我们基于Yocot的发行版中,但在将带有依赖项的预编译库安装到目标上时遇到了麻烦。
在尝试从源代码to no avail编译pytorch
之后,我想我可以使用pre-compiled shared libraries并进入下一个问题。然而,这证明比最初预期的要困难得多。
具体来说,我想安装的共享库之一libtorch.so
依赖于另一个与它一起分发的共享库libgomp-753e6e92.so.1
。
$ 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)
尝试将所有内容放置到位的bitbake方法如下所示:
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}/* \
"
不幸的是,我一直收到一个错误消息,告诉我没有提供libtorch
所需的libgomp
库。我已经尝试了很多方法,包括将有问题的库放在它自己的配方中,显式安装它或使用已经提供的libgomp
运行时依赖项,但到目前为止没有任何运气。错误总是类似于:
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
有什么线索吗?
2条答案
按热度按时间yhuiod9q1#
由于缺乏更好的解决方案,我们从源代码编译了我们自己的
libtorch
,同时将USE_OPENMP
环境变量设置为OFF
。我们仍然不能确定为什么对版本库的依赖给我们带来了这么多麻烦。iszxjhcz2#
使用
RPROVIDES_${PN}
为我解决了这个问题。