Multiple glibc libraries on a single host #bitbake #poky

"Srivamsi Malladi" <[email protected]> Tue, 05 Aug 2025 01:45:13 -0700
Newsgroups org.yoctoproject.lists.poky
Message-ID <20250805084513.HbngP1Pz1e-FpNv2ZNHGqmXIQcFIDpec-rKRvAH2Kk4@z>
Hi all,
I am a bit new to Poky and the Yocto Project, so please spare me for this one.

I am using Poky 2.1.2 (I cannot update it for now), so I have glibc 2.23 by defauly from open-embedded. But I have a tool that was build with glib 2.28 and I cannot build this tool from source with a different version of glibc like the glibc 2.23 I have (as the source is not accessible).

Now, I tried first to specify PREFERRED_VERSION_glibc="2.28" and I got an error saying the version of poky I have only supports glibc 2.23

Then I proceeded to look for recipes for glibc 2.28 online and found the glibc 2.28 recipe from open-embedded supported by poky 2.6 ( https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/glibc/glibc_2.28.bb?h=thud ). I took the recipe as it is, but I got errors related to incompatibility of the recipe as it is from a different version of poky (and I did not change a single character).

Then I though maybe I should write the recipe on my own and found this guide ( https://askubuntu.com/questions/1345342/how-to-install-glibc-2-32-when-i-already-have-glibc2-31 ) on how to build glibc from source when there is a different version of glibc already installed. I named my new recipe glibc-wl_2.28. I put these steps from the guide I found into a recipe and added configure --prefix=/opt/glibc-2.28 to get the glibc 2.28 installed into a different directory or else it uses the default location where glibc 2.23 is already present.
Now, the compilation and installation works perfectly, but I have series of errors while packaging the files. So I copied the packaging related lines from the glibc 2.28 recipe from open-embedded ( https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/glibc/glibc-package.inc?h=thud ) and tried to change the directories to /opt/glibc-2.28, but I get errors saying glibc-wl is trying to install files into a shared area when those files already exist.

> 
> ERROR: glibc-wl-2.23-r0 do_packagedata: The recipe glibc-wl is trying to
> install files into a shared area when those files already exist. Those
> files and their manifest location are:
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime/ldd
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime/glibc-thread-db
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime/libmemusage
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime/libmemusage.packaged
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime/catchsegv
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime/libsegfault
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime/nscd
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime/sln.packaged
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime/sln
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime/tzcode
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime/libsotruss
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime/glibc-extra-nss
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime/libsotruss.packaged
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime/glibc-thread-db.packaged
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime/libcidn
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime/libsegfault.packaged
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/shlibs2/glibc-thread-db.list
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/shlibs2/libmemusage.list
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/shlibs2/libsegfault.list
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime-rprovides/glibc-thread-db/glibc-thread-db
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime-rprovides/(=2.23)/glibc-thread-db
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime-rprovides/eglibc-extra-nss/glibc-extra-nss
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime-rprovides/eglibc-thread-db/glibc-thread-db
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime-reverse/libmemusage
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime-reverse/libsegfault
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime-reverse/sln
> 
> Matched in manifest-htm-tj-glibc.packagedata
> /home/ubuntu1404/work/hurricane-yocto/build_htm/tmp/sysroots/htm-tj/pkgdata/runtime-reverse/libsotruss
> 
> Matched in manifest-htm-tj-glibc.packagedata
> 
> 

Then, I deleted these files, as they will not be installed if they are not present. Anyway, a copy of these files (though older version) are already installed and are available. I am not sure if deleting these files is an actual fix. Please let me know the effects of this action.
But now there are some RPROVIDES_glibc-wl-some_package_name that are creating errors. Following is the error and attached is the do_package_write_rpm log file.

> 
> ERROR: glibc-wl-2.23-r0 do_package_qa: Recipe glibc-wl is trying to create
> package catchsegv which was already written by recipe glibc. This will
> cause corruption, please resolve this and only provide the package from
> one recipe or the other or only build one of the recipes.
> 

This is my recipe

> 
> SUMMARY     = "GLIBC 2.28 for Infineon wl tool"
> DESCRIPTION = "GLIBC 2.23 is included by default, but the Infineon wl tool
> needs 2.28"
> AUTHOR      = "Srivamsi Malladi"
> 
> #Temp workaraound!!
> #Because bitbake is complaining about some version incompatibility of
> common files in 2.23 and 2.28
> PV = "2.23"
> 
> inherit autotools gettext
> 
> DEPENDS += "gperf-native bison-native make-native"
> DEPENDS += "virtual/kernel"
> 
> SRC_URI   = "https://mirror.dogado.de/gnu/glibc/glibc-2.28.tar.gz"
> SRC_URI[md5sum] = "d5fea592406659df50d00666ff9d0c53"
> SRC_URI[sha256sum] =
> "f318d6e3f1f4ed0b74d2832ac4f491d0fb928e451c9eda594cbf1c3bee7af47c"
> 
> # ${PV} is pulled from the recipe filename, e.g. helloworld_2.7.bb ->
> ${PV} expands to "2.7".
> # We use immediate evaluation to define a new var PVBASE holding the
> original value of ${PV}.
> PVBASE := "${PV}"
> 
> # We need to tell bitbake about our current directory structure or we
> won't be able to find patches after we mess with ${PV}
> FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PVBASE}:"
> 
> # Then redefine PV to tack the svn rev onto the base version. This is
> evaluated at fetch time.
> # Then the package will get rebuilt any time the relevant part of the
> source tree changes.
> #PV = "${PVBASE}.${SRCPV}"
> 
> S = "${WORKDIR}/glibc-2.28/"
> #PKGDATA_DIR = "${WORKDIR}/pkgdata/glibc-wl"
> GLIBC228_TARGET_DIR = "/opt/glibc-2.28"
> 
> EXTRA_OECONF = "--host=${TARGET_SYS} \
> --enable-kernel=${GLIBC_KRNL_VERSION} \
> --with-headers=${STAGING_INCDIR} \
> --enable-obsolete-rpc \
> --enable-obsolete-nsl \
> --disable-profile \
> --disable-nls \
> --disable-static-nss \
> --disable-built-in-nss-modules \
> --with-binutils=${STAGING_BINDIR} \
> --with-linker=${TARGET_PREFIX}ld \
> --with-arch=${TUNE_ARCH}"
> 
> do_configure() {
> # Glibc typically requires an out-of-tree build directory.
> # ${B} is the standard variable for the build directory.
> mkdir -p ${B}
> cd ${B}
> 
> # Run the configure script from the source directory (${S}),
> # passing the defined configuration options.
> # The --prefix, --libdir etc., are usually handled by the autotools class
> defaults
> # but explicitly adding them here ensures they are passed.
> ${S}/configure \
> ${EXTRA_OECONF} \
> --prefix=${GLIBC228_TARGET_DIR} \
> --libdir=${GLIBC228_TARGET_DIR}/lib \
> --libexecdir=${GLIBC228_TARGET_DIR}/libexec \
> --bindir=${GLIBC228_TARGET_DIR}/bin \
> --sbindir=${GLIBC228_TARGET_DIR}/sbin \
> --datadir=${GLIBC228_TARGET_DIR}/share \
> --includedir=${GLIBC228_TARGET_DIR}/include \
> --sysconfdir=${GLIBC228_TARGET_DIR}/etc \
> --localstatedir=${GLIBC228_TARGET_DIR}/var \
> --sharedstatedir=${GLIBC228_TARGET_DIR}/com
> }
> 
> do_install() {
> cd ${B}
> oe_runmake install DESTDIR=${D}
> }
> 
> # Removing files that are already present because of v2.28
> # Temp fix!! After effects not known because of this!!
> do_packagedata_append() {
> rm ${WORKDIR}/pkgdata/runtime/ldd
> rm ${WORKDIR}/pkgdata/runtime/glibc-thread-db
> rm "${WORKDIR}/pkgdata/runtime-rprovides/(=2.23)/glibc-thread-db"
> rm ${WORKDIR}/pkgdata/runtime/libmemusage
> rm ${WORKDIR}/pkgdata/runtime/libmemusage.packaged
> rm ${WORKDIR}/pkgdata/runtime/libsegfault
> rm ${WORKDIR}/pkgdata/runtime/catchsegv
> rm ${WORKDIR}/pkgdata/runtime/nscd
> rm ${WORKDIR}/pkgdata/runtime/sln.packaged
> rm ${WORKDIR}/pkgdata/runtime/tzcode
> rm ${WORKDIR}/pkgdata/runtime/libsotruss
> rm ${WORKDIR}/pkgdata/runtime/glibc-extra-nss
> rm ${WORKDIR}/pkgdata/runtime/libsotruss.packaged
> rm ${WORKDIR}/pkgdata/runtime/glibc-thread-db.packaged
> rm ${WORKDIR}/pkgdata/runtime/libcidn
> rm ${WORKDIR}/pkgdata/runtime/libsegfault.packaged
> rm ${WORKDIR}/pkgdata/runtime/sln
> rm ${WORKDIR}/pkgdata/shlibs2/glibc-thread-db.list
> rm ${WORKDIR}/pkgdata/shlibs2/libmemusage.list
> rm ${WORKDIR}/pkgdata/shlibs2/libsegfault.list
> rm ${WORKDIR}/pkgdata/runtime-rprovides/glibc-thread-db/glibc-thread-db
> rm ${WORKDIR}/pkgdata/runtime-rprovides/eglibc-extra-nss/glibc-extra-nss
> rm ${WORKDIR}/pkgdata/runtime-rprovides/eglibc-thread-db/glibc-thread-db
> rm ${WORKDIR}/pkgdata/runtime-reverse/libmemusage
> rm ${WORKDIR}/pkgdata/runtime-reverse/libsegfault
> rm ${WORKDIR}/pkgdata/runtime-reverse/sln
> rm ${WORKDIR}/pkgdata/runtime-reverse/libsotruss
> }
> 
> PACKAGES = "${PN}-dbg catchsegv sln nscd ldd tzcode glibc-thread-db
> ${PN}-pic libcidn libmemusage libnss-db libsegfault ${PN}-pcprofile
> libsotruss ${PN} ${PN}-utils glibc-extra-nss ${PN}-dev ${PN}-staticdev
> ${PN}-doc"
> 
> #PACKAGES = "${PN}-dbg ${PN}-pic ${PN}-pcprofile ${PN} ${PN}-utils
> ${PN}-dev ${PN}-staticdev ${PN}-doc"
> 
> RPROVIDES_${PN} = "eglibc rtld(GNU_HASH)"
> RPROVIDES_${PN}-utils = "eglibc-utils"
> RPROVIDES_${PN}-mtrace = "eglibc-mtrace libc-mtrace"
> RPROVIDES_${PN}-pic = "eglibc-pic"
> RPROVIDES_${PN}-dev = "eglibc-dev libc6-dev virtual-libc-dev"
> RPROVIDES_${PN}-staticdev = "eglibc-staticdev"
> RPROVIDES_${PN}-doc = "eglibc-doc"
> RPROVIDES_glibc-extra-nss = "eglibc-extra-nss"
> RPROVIDES_glibc-thread-db = "eglibc-thread-db"
> RPROVIDES_${PN}-pcprofile = "eglibc-pcprofile"
> RPROVIDES_${PN}-dbg = "eglibc-dbg"
> libc_baselibs = " ${GLIBC228_TARGET_DIR}/lib/libc.so.* \
> ${GLIBC228_TARGET_DIR}/lib/libc-*.so \
> ${GLIBC228_TARGET_DIR}/lib/libm*.so.* \
> ${GLIBC228_TARGET_DIR}/lib/libm-*.so \
> ${GLIBC228_TARGET_DIR}/lib/libmvec-*.so \
> ${GLIBC228_TARGET_DIR}/lib/ld*.so.* \
> ${GLIBC228_TARGET_DIR}/lib/ld-*.so \
> ${GLIBC228_TARGET_DIR}/lib/libpthread*.so.* \
> ${GLIBC228_TARGET_DIR}/lib/libpthread-*.so  \
> ${GLIBC228_TARGET_DIR}/lib/libresolv*.so.*  \
> ${GLIBC228_TARGET_DIR}/lib/libresolv-*.so  \
> ${GLIBC228_TARGET_DIR}/lib/librt*.so.*  \
> ${GLIBC228_TARGET_DIR}/lib/librt-*.so  \
> ${GLIBC228_TARGET_DIR}/lib/libutil*.so.* \
> ${GLIBC228_TARGET_DIR}/lib/libutil-*.so  \
> ${GLIBC228_TARGET_DIR}/lib/libnsl*.so.*  \
> ${GLIBC228_TARGET_DIR}/lib/libnsl-*.so  \
> ${GLIBC228_TARGET_DIR}/lib/libdl*.so.*  \
> ${GLIBC228_TARGET_DIR}/lib/libdl-*.so  \
> ${GLIBC228_TARGET_DIR}/lib/libanl*.so.* \
> ${GLIBC228_TARGET_DIR}/lib/libanl-*.so  \
> ${GLIBC228_TARGET_DIR}/lib/libBrokenLocale*.so.* \
> ${GLIBC228_TARGET_DIR}/lib/libBrokenLocale-*.so \
> /usr \
> ${GLIBC228_TARGET_DIR}/lib/libnss_files*.so.* \
> ${GLIBC228_TARGET_DIR}/lib/libnss_files-*.so \
> ${GLIBC228_TARGET_DIR}/lib/libnss_compat*.so.* \
> ${GLIBC228_TARGET_DIR}/lib/libnss_compat-*.so \
> ${GLIBC228_TARGET_DIR}/lib/libnss_dns*.so.* \
> ${GLIBC228_TARGET_DIR}/lib/libnss_dns-*.so \
> ${GLIBC228_TARGET_DIR}/etc \
> ${GLIBC228_TARGET_DIR}/share \
> ${GLIBC228_TARGET_DIR}/libexec \
> ${GLIBC228_TARGET_DIR}/etc/rpc \
> ${GLIBC228_TARGET_DIR}/share \
> ${GLIBC228_TARGET_DIR}/share \
> ${GLIBC228_TARGET_DIR}/"
> 
> libc_baselibs_append_aarch64 =
> "${GLIBC228_TARGET_DIR}/lib/ld-linux-aarch64*.so.1"
> INSANE_SKIP_${PN}_append_aarch64 = " ${GLIBC228_TARGET_DIR}/lib"
> 
> FILES_${PN} = " ${libc_baselibs} \
> ${GLIBC228_TARGET_DIR}/lib/* \
> ${GLIBC228_TARGET_DIR}/sbin/ldconfig \
> ${GLIBC228_TARGET_DIR}/etc/ld.so.conf"
> FILES_ldd = " ${GLIBC228_TARGET_DIR}/bin/ldd"
> FILES_libsegfault = " ${GLIBC228_TARGET_DIR}/lib/libSegFault*"
> FILES_libcidn = " ${GLIBC228_TARGET_DIR}/lib/libcidn-*.so \
> ${GLIBC228_TARGET_DIR}/lib/libcidn.so.*"
> FILES_libmemusage = " ${GLIBC228_TARGET_DIR}/lib/libmemusage.so"
> FILES_libnss-db = " ${GLIBC228_TARGET_DIR}/lib/libnss_db.so.* \
> ${GLIBC228_TARGET_DIR}/lib/libnss_db-*.so \
> ${GLIBC228_TARGET_DIR}/var/db/Makefile    \
> ${GLIBC228_TARGET_DIR}/var/db/makedbs.sh"
> RDEPENDS_libnss-db = "${PN}-utils"
> FILES_glibc-extra-nss = "${GLIBC228_TARGET_DIR}/lib/libnss_*-*.so \
> ${GLIBC228_TARGET_DIR}/lib/libnss_*.so.*"
> FILES_sln = "${GLIBC228_TARGET_DIR}/sbin/sln"
> FILES_${PN}-pic = " ${GLIBC228_TARGET_DIR}/lib/*_pic.a \
> ${GLIBC228_TARGET_DIR}/lib/*_pic.map \
> ${GLIBC228_TARGET_DIR}/lib/libc_pic/*.o"
> FILES_libsotruss = "${GLIBC228_TARGET_DIR}/lib/audit/sotruss-lib.so"
> FILES_SOLIBSDEV = "${GLIBC228_TARGET_DIR}/lib/lib*${SOLIBSDEV}"
> FILES_${PN}-dev += " ${GLIBC228_TARGET_DIR}/lib/*_nonshared.a \
> ${GLIBC228_TARGET_DIR}/lib/*_nonshared.a \
> ${GLIBC228_TARGET_DIR}/lib/*.o \
> ${datadir}/aclocal"
> FILES_${PN}-staticdev += " ${GLIBC228_TARGET_DIR}/lib/*.a \
> ${GLIBC228_TARGET_DIR}/lib/*.a"
> FILES_nscd = " ${GLIBC228_TARGET_DIR}/sbin/nscd* \
> ${GLIBC228_TARGET_DIR}/etc/init.d/nscd \
> ${systemd_unitdir}/system/nscd* \
> ${GLIBC228_TARGET_DIR}/etc/tmpfiles.d/nscd.conf \
> ${GLIBC228_TARGET_DIR}/etc/nscd.conf \
> ${GLIBC228_TARGET_DIR}/etc/default/volatiles/98_nscd \
> ${GLIBC228_TARGET_DIR}/var/db/nscd"
> FILES_${PN}-mtrace = "${GLIBC228_TARGET_DIR}/bin/mtrace"
> FILES_tzcode = "${GLIBC228_TARGET_DIR}/bin/tzselect \
> ${GLIBC228_TARGET_DIR}/sbin/zic \
> ${GLIBC228_TARGET_DIR}/sbin/zdump"
> FILES_${PN}-utils = " ${GLIBC228_TARGET_DIR}/bin/* \
> ${GLIBC228_TARGET_DIR}/sbin/*"
> FILES_catchsegv = " ${GLIBC228_TARGET_DIR}/bin/catchsegv"
> RDEPENDS_catchsegv = " libsegfault"
> FILES_${PN}-pcprofile = "${GLIBC228_TARGET_DIR}/lib/libpcprofile.so"
> FILES_glibc-thread-db = "${GLIBC228_TARGET_DIR}/lib/libthread_db.so.* \
> ${GLIBC228_TARGET_DIR}/lib/libthread_db-*.so"
> RPROVIDES_${PN}-dev += "libc-dev"
> RPROVIDES_${PN}-staticdev += "libc-staticdev"
> 

In general, I would like to understand how to create recipes such that two versions of the same library/application are installed.
I guess, applications are easier. Just create a recipe with a different name and install into a different directory.
But with libraries, especially like the glibc, it is tough as it installs files into a lot of directories, especially shared directories.

The idea at the end is to run the tool with LD_LIBRARY_PATH=/opt/ glibc-wl/lib:$LD_LIBRARY_ PATH.
And if this will not work, there is no point in installing glibc 2.28 alongside 2.23.

Please let me know if any more info is needed and help me install glibc 2.28 alongside 2.23.

Thanks
Vamsi.
log.do_package_write_rpm.114071 (application/octet-stream, 24 B) - not displayed