| Summary: | Installing pseudo into sysroot doesn't pull in sqlite | ||
|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Ross Burton <ross.burton> |
| Component: | core | Assignee: | Richard Purdie <richard.purdie> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | High | CC: | mark.asselstine, meta.mr.watcher, meta.watcher, randy.macleod |
| Version: | 5.99 | ||
| Target Milestone: | 3.1 M4 | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | No (bug/feature does not impact docs) | |
|
Description
Ross Burton
2020-02-24 14:55:25 UTC
Ross, looks like it. Looking at what I get on my Ubu 16.04 builder I can see that it is finding my host's libsqlite3.so.0.
The rpath is being properly updated by relocatable_binaries_preprocess(). We can see this with readelf -d 0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN/../lib:$ORIGIN/../../lib]
So in most places it is pointing at the correct shared lib (when both pseudo and sqlite3 are present in an RSS). But not everywhere. libgcc-initial, libtool-cross, shadow-sysroot are others that will be affected by this.
Richard mentioned on IRC that we might want to hack up the rpath. I don't think that'll do the trick as in the case of libgcc-initial where the libsqlite3.so isn't even present. I am leaning more towards pseudo-native having to 'steal' the shared library from the sqlite3-native installed in pseudo-native's RSS.
So something like
install -m 755 ${WORKDIR}/recipe-sysroot-native/usr/lib/libsqlite3.so* ${D}${prefix}/lib/.
in pseudo.inc's do_install_append_class-native. This does cause a warning about the libs already being stripped, but we can shut that up.
At any rate this seems like a definite hack so I would want to hear from Richard before attempting to take it any further.
I am really not sure we want to go down this path but the simplest solution seems to link in the libsqlite3 as it is being added to the COMPONENTS_DIR. I have not explored how this handles various workflows but no doubt I am breaking some basic assumptions here that folks like RP and Mark Hatle will scold me for.
I have added to pseudo.inc
---
SSTATEPOSTINSTFUNCS_append_class-native += "do_sqlite3_link"
# Make libsqlite3 available to pseudo native in $COMPONENTS_DIR
do_sqlite3_link() {
if [ -d ${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN} ]; then
cd "${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN}"
src=$(readlink -f ../sqlite3-native/usr/lib/libsqlite3.so)
ln -sfr "${src}" "usr/lib/."
ln -sf "$(basename ${src})" "usr/lib/libsqlite3.so"
ln -sf "$(basename ${src})" "usr/lib/libsqlite3.so.0"
fi
}
---
If this somehow manages to be acceptable for folks I would most likely make it a bit smarter and only do work when needed, but this rough implementation is enough to at least either inspire others to come up with something better or provide feedback on if this approach is even viable.
BTW, I am not sure what Clear Linux is doing but Ubu and others will have a host libsqlite3 available after installing python3. So at least until we come up with a viable solution we will most likely not hear from too many folks about this being an issue.
So first we need to decide whether we're using the host sqlite3 or not. If we are then we can make that explicit, otherwise fiddling RPATH or linking in libraries is a workaround at best as extracting pseudo should pull in sqlite3. You're right though, a fresh tiny install of Clear shows that Python3 pulls in sqlite3. I note that Clear puts libraries into /usr/lib64 which still isn't in my muscle memory so maybe that's why I thought it wasn't present. Either way it isn't finding it: /scratch/poky/sysroots-components/x86_64/pseudo-native/usr/bin/pseudo: error while loading shared libraries: libsqlite3.so.0: cannot open shared object file: No such file or directory $ file /usr/lib64/libsqlite3.so.0 /usr/lib64/libsqlite3.so.0: symbolic link to libsqlite3.so.0.8.6 $ file /usr/lib64/libsqlite3.so.0.8.6 /usr/lib64/libsqlite3.so.0.8.6: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=e75bc1ee1d48c0bff7e6c6998e24cd180ce97a5d, stripped Interestingly: $ ldd /scratch/poky/sysroots-components/x86_64/pseudo-native/usr/bin/pseudo linux-vdso.so.1 (0x00007fff64fc3000) libsqlite3.so.0 => /usr/lib64/libsqlite3.so.0 (0x00007f8a37c90000) libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007f8a37c6c000) libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007f8a37c66000) libc.so.6 => /usr/lib64/libc.so.6 (0x00007f8a37a66000) libm.so.6 => /usr/lib64/libm.so.6 (0x00007f8a37915000) /scratch/poky/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f8a37e5a000) So outside of Bitbake it finds the host sqlite3. As to your first question, whether we should use the host's libsqlite3 or not, I have been thinking about this. Not using the host's version would allow us to ensure consistency and roll out fixes should a critical issue ever arise. I would say both have value but the question is just how much weighting the value adds. I think a proper solution to the issue isn't my hack but to not run pseudo in the sysroots-components but actually put it in a more suitable location and install its dependencies alongside, in a sort of Bitbake Native Sysroot. I am really curious what is going on with your environment which makes the system's libsqlite3 not found when running bitbake. Just to share what Ross/I figured out, uninative gets involved and introduced is own search paths. Clear doesn't use the standard /etc/ld.so.conf.d/ approach/path so on Clear, uninative doesn't work properly. This is why it appears to work with ldd but not when run. The simplest solution is to inject a sysroot-components RPATH in pseudo-native since this recipe really is special. I've sent out a patch which does this. |