Files
poky/meta/recipes-devtools/pseudo/pseudo.inc
Richard Purdie 84bd11c62e pseudo: Drop static linking to sqlite3
Back in 2010[1] we made pseudo statically link against sqlite3. Since then
the world has changed, pseudo now has separate processes for the database
in the server and the client and they have separate linking commands.

Also, whilst there were concerns about needing specific versions of sqlite3,
in the OE environment, this is always the case.

[1] http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=ad0ac0ecd38fc77daf42485489fccc10a5e1e3e7

The static sqlite3-native is causing us problems, in particular:

tmp/work/x86_64-linux/pseudo-native/1.9.0+gitAUTOINC+060058bb29-r0/recipe-sysroot-native/usr/lib/libsqlite3.a(sqlite3.o):(.data.rel+0xb0): undefined reference to `fcntl64'

which occurs if sqlite3-native was built on a machine with glibc 2.28 or later
and pseudo-native is being built on glibc before that. With dyanmical linking,
libc is backwards compatible and works but with static linking it does not.

There appears to be no easy way to avoid this other than adding a copy of
sqlite3 into the pseudo recipe. Given the static linking doesn't seem to
be required any longer due to the separate processes, drop that to fix
those issues.

(From OE-Core rev: a0c238d40a9cc1f87da0607fddaaef0c31d93720)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-11-10 14:06:10 +00:00

143 lines
4.8 KiB
PHP

# Note: Due to the bitbake wrapper script, making changes to pseudo can be
# difficult. To work around the current version of the wrapper use:
# BBFETCH2=True PSEUDO_BUILD=1 ../bitbake/bin/bitbake pseudo-native [-c CMD]
SUMMARY = "Pseudo gives fake root capabilities to a normal user"
HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/pseudo"
LIC_FILES_CHKSUM = "file://COPYING;md5=a1d8023a6f953ac6ea4af765ff62d574"
SECTION = "base"
LICENSE = "LGPL2.1"
DEPENDS = "sqlite3 attr"
FILES_${PN} = "${prefix}/lib/pseudo/lib*/libpseudo.so ${bindir}/* ${localstatedir}/pseudo ${prefix}/var/pseudo"
INSANE_SKIP_${PN} += "libdir"
INSANE_SKIP_${PN}-dbg += "libdir"
PROVIDES += "virtual/fakeroot"
MAKEOPTS = ""
inherit siteinfo pkgconfig
do_configure () {
:
}
NO32LIBS ??= "1"
NO32LIBS_class-nativesdk = "1"
PSEUDO_EXTRA_OPTS ?= "--enable-force-async --without-passwd-fallback --enable-epoll --enable-xattr"
# Compile for the local machine arch...
do_compile () {
if [ "${SITEINFO_BITS}" = "64" ]; then
${S}/configure ${PSEUDO_EXTRA_OPTS} --prefix=${prefix} --libdir=${prefix}/lib/pseudo/lib${SITEINFO_BITS} --with-sqlite-lib=${baselib} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --cflags="${CFLAGS}" --bits=${SITEINFO_BITS} --without-rpath
else
${S}/configure ${PSEUDO_EXTRA_OPTS} --prefix=${prefix} --libdir=${prefix}/lib/pseudo/lib --with-sqlite-lib=${baselib} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --cflags="${CFLAGS}" --bits=${SITEINFO_BITS} --without-rpath
fi
oe_runmake ${MAKEOPTS}
}
do_compile[vardepsexclude] = "SITEINFO_BITS"
maybe_make32() {
# We probably don't need to build 32-bit binaries.
make32=false
if [ "${SITEINFO_BITS}" = "64" ]; then
case "${NO32LIBS}" in
0) make32=true
;;
1) make32=false
;;
*) # If unset, build 32-bit if we think we can.
if [ -e "/usr/include/gnu/stubs-32.h" ]; then
make32=true
fi
;;
esac
fi
if $make32; then
if ! [ -e "/usr/include/gnu/stubs-32.h" ]; then
warn_32bit_missing
else
bbnote "Attempting to build 32-bit libpseudo.so for ${PN}."
fi
else
bbnote "Building/installing only 64-bit libpseudo.so for ${PN}."
bbnote "If you need to run 32-bit executables, ensure that NO32LIBS is set to 0."
fi
}
maybe_make32[vardepsexclude] = "SITEINFO_BITS"
warn_32bit_missing() {
bbwarn "Can't find stubs-32.h, but usually need it to build 32-bit libpseudo."
bbwarn "If the build fails, install 32-bit developer packages."
bbwarn "If you are using 32-bit binaries, the 32-bit libpseudo is NOT optional."
}
# Two below are the same
# If necessary compile for the alternative machine arch. This is only
# necessary in a native build.
do_compile_prepend_class-native () {
maybe_make32
if $make32; then
# We need the 32-bit libpseudo on a 64-bit machine...
# Note that this is not well-tested outside of x86/x86_64.
# if we're being rebuilt due to a dependency change, we need to make sure
# everything is clean before we configure and build -- if we haven't previously
# built this will fail and be ignored.
make ${MAKEOPTS} distclean || :
./configure ${PSEUDO_EXTRA_OPTS} --prefix=${prefix} --libdir=${prefix}/lib/pseudo/lib --with-sqlite-lib=${baselib} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --bits=32 --without-rpath
save_traps=$(trap)
trap 'warn_32bit_missing' 0
oe_runmake ${MAKEOPTS} libpseudo
eval "$save_traps"
# prevent it from removing the lib, but remove everything else
make 'LIB=foo' ${MAKEOPTS} distclean
fi
}
do_compile_prepend_class-nativesdk () {
maybe_make32
if $make32; then
# We need the 32-bit libpseudo on a 64-bit machine.
# Note that this is not well-tested outside of x86/x86_64.
./configure ${PSEUDO_EXTRA_OPTS} --prefix=${prefix} --libdir=${prefix}/lib/pseudo/lib --with-sqlite-lib=${baselib} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --bits=32 --without-rpath
oe_runmake ${MAKEOPTS} libpseudo
# prevent it from removing the lib, but remove everything else
make 'LIB=foo' ${MAKEOPTS} distclean
fi
}
do_install () {
oe_runmake 'DESTDIR=${D}' ${MAKEOPTS} 'LIB=lib/pseudo/lib$(MARK64)' install
}
do_install_append_class-native () {
install -d ${D}${sysconfdir}
# The fallback files should never be modified
install -m 444 ${WORKDIR}/fallback-passwd ${D}${sysconfdir}/passwd
install -m 444 ${WORKDIR}/fallback-group ${D}${sysconfdir}/group
# Two native/nativesdk entries below are the same
# If necessary install for the alternative machine arch. This is only
# necessary in a native build.
maybe_make32
if $make32; then
mkdir -p ${D}${prefix}/lib/pseudo/lib
cp lib/pseudo/lib/libpseudo.so ${D}${prefix}/lib/pseudo/lib/.
fi
}
do_install_append_class-nativesdk () {
maybe_make32
if $make32; then
mkdir -p ${D}${prefix}/lib/pseudo/lib
cp lib/pseudo/lib/libpseudo.so ${D}${prefix}/lib/pseudo/lib/.
fi
chrpath -d ${D}${prefix}/lib/pseudo/lib*/libpseudo.so
}
BBCLASSEXTEND = "native nativesdk"