Summary: | sys-apps/busybox[selinux] static linking with sys-libs/libselinux-2.1.12 fails due to undefined reference to pcre_free | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | iGentoo <AlphatPC> |
Component: | [OLD] Unspecified | Assignee: | Sven Vermeulen (RETIRED) <swift> |
Status: | VERIFIED FIXED | ||
Severity: | normal | CC: | anarchy, embedded, h.v.bruinehsen, leonchik1976, selinux |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | selinux-utils | ||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 438998 | ||
Attachments: |
build logs
busybox-1.20.2.ebuild.diff build log for failed busybox installation (for libpcre) |
Description
iGentoo
2012-10-01 08:04:15 UTC
Created attachment 325444 [details]
build logs
Created attachment 325446 [details, diff]
busybox-1.20.2.ebuild.diff
Comment on attachment 325446 [details, diff]
busybox-1.20.2.ebuild.diff
this is not correct for many reasons
there is no selinux-2.1.12 in the tree that i can see libselinux-2.1.12 is in hardened-dev overlay for now. libpcre is marked as a dependency, and I had to include "-lpcre" in the LDFLAGS to build it correctly, but that should be set in the ebuild for now too. Is the fix you need something we can include in the libselinux ebuild instead (as its the cause and target of failure)? (In reply to comment #5) no ebuild should be hardcoding -lpcre. we should be going through pkg-config. i can update busybox to use that instead. I surely can update the libselinux ebuild for this. Is the following then ok? diff --git a/sys-libs/libselinux/libselinux-2.1.12.ebuild b/sys-libs/libselinux/libselinux-2.1.12.ebuild index cbb227e..3c7831b 100644 --- a/sys-libs/libselinux/libselinux-2.1.12.ebuild +++ b/sys-libs/libselinux/libselinux-2.1.12.ebuild @@ -55,12 +55,12 @@ src_prepare() { } src_compile() { - emake AR="$(tc-getAR)" CC="$(tc-getCC)" LDFLAGS="-fPIC -lpcre ${LDFLAGS}" all || die + emake AR="$(tc-getAR)" CC="$(tc-getCC)" LDFLAGS="-fPIC $(pkg-config --libs libpcre) ${LDFLAGS}" all || die if use python; then python_copy_sources src building() { - emake CC="$(tc-getCC)" PYINC="-I$(python_get_includedir)" PYTHONLIBDIR="$(python_get_library -l)" PYPREFIX="python-$(python_get_version)" LDFLAGS="-fPIC -lpcre ${LDFLAGS}" pywrap + emake CC="$(tc-getCC)" PYINC="-I$(python_get_includedir)" PYTHONLIBDIR="$(python_get_library -l)" PYPREFIX="python-$(python_get_version)" LDFLAGS="-fPIC $(pkg-config --libs libpcre) ${LDFLAGS}" pywrap } python_execute_function -s --source-dir src building fi Couldn't busybox be built to use the shared libs instead of static? I thought we had the ability to pass -static to the linker to accomplish this. (In reply to comment #7) you should use $(tc-getPKG_CONFIG) and not "pkg-config" however, what i meant was for the libselinux.pc file itself to get fixed. atm it only says: Requires.private: libsepol that should instead be: Requires.private: libsepol libpcre once that is fixed, doing `pkg-config libselinux` will return the correct results so other packages will "just work" and not incorrectly hardcode -lpcre in their own build setups. I notice that the pkg-config setup also has a Libs: entry, should that too be updated? Like so? -Requires.private: libsepol -Libs: -L${libdir} -lselinux +Requires.private: libsepol libpcre +Libs: -L${libdir} -lselinux -lpcr (In reply to comment #10) no. just update Requires.private. sys-libs/libselinux-2.1.12-r1 in hardened-dev overlay, uses tc-getPKG_CONFIG and has libpcre in the Requires.private part of libselinux.pc *** Bug 439078 has been marked as a duplicate of this bug. *** Commit message: Use pkg-config to link against libselinux http://sources.gentoo.org/sys-apps/busybox/busybox-1.20.2.ebuild?r1=1.10&r2=1.11 http://sources.gentoo.org/sys-apps/busybox/files/busybox-1.20.2-selinux-pkg-config.patch?rev=1.1 (In reply to comment #12) btw, i see that 2.1.12 was merged to the main tree sans the .pc fix, so this is going to start biting people more and basically won't be fixable until 2.1.12-r1 is added. I still get a related failure: """ Trying libraries: crypt m pcre selinux sepol Failed: -Wl,--start-group -lcrypt -lm -lpcre -lselinux -lsepol -Wl,--end-group Output of: x86_64-pc-linux-gnu-gcc -march=native -ggdb -O2 -pipe -fno-strict-aliasing -Wall -Wshadow -Wwrite-strings -Wundef -Wstrict-prototypes -Wunused -Wunused-parameter -Wunused-function -Wunused-value -Wmissing-prototypes -Wmissing-declarations -Wdeclaration-after-statement -Wold-style-definition -fno-builtin-strlen -finline-limit=0 -ffunction-sections -fdata-sections -fno-guess-branch-probability -funsigned-char -static -Wl,-O1 -Wl,--as-needed -o busybox_unstripped -Wl,--sort-common -Wl,--sort-section,alignment -Wl,--start-group applets/built-in.o archival/lib.a archival/libarchive/lib.a console-tools/lib.a coreutils/lib.a coreutils/libcoreutils/lib.a debianutils/lib.a e2fsprogs/lib.a editors/lib.a findutils/lib.a init/lib.a libbb/lib.a libpwdgrp/lib.a loginutils/lib.a mailutils/lib.a miscutils/lib.a modutils/lib.a networking/lib.a networking/libiproute/lib.a networking/udhcp/lib.a printutils/lib.a procps/lib.a runit/lib.a selinux/lib.a shell/lib.a sysklogd/lib.a util-linux/lib.a util-linux/volume_id/lib.a archival/built-in.o archival/libarchive/built-in.o console-tools/built-in.o coreutils/built-in.o coreutils/libcoreutils/built-in.o debianutils/built-in.o e2fsprogs/built-in.o editors/built-in.o findutils/built-in.o init/built-in.o libbb/built-in.o libpwdgrp/built-in.o loginutils/built-in.o mailutils/built-in.o miscutils/built-in.o modutils/built-in.o networking/built-in.o networking/libiproute/built-in.o networking/udhcp/built-in.o printutils/built-in.o procps/built-in.o runit/built-in.o selinux/built-in.o shell/built-in.o sysklogd/built-in.o util-linux/built-in.o util-linux/volume_id/built-in.o -Wl,--end-group -Wl,--start-group -lcrypt -lm -lpcre -lselinux -lsepol -Wl,--end-group ========== /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lpcre collect2: ld returned 1 exit status make: *** [busybox_unstripped] Error 1 """ Yet my libselinux.pc file on the system only mentions libpcre in the Requires.private part. Build log will be attached hereafter. Created attachment 327584 [details]
build log for failed busybox installation (for libpcre)
I also think the failure is because libpcre doesn't provide a libpcre.a file... (In reply to comment #18) you need to update libselinux to RDEPEND on libpcre[static-libs] when libselinux itself is built with USE=static-libs Okay, libselinux currently doesn't listen to the static-libs USE flag, but I'll add it to IUSE and use libpcre[static-libs?] within the RDEPEND variable. (In reply to comment #20) sounds like a good time to add USE=static-libs support to libselinux so it doesn't install libselinux.a Ok, I remove libselinux.a if USE="static-libs" isn't set, and depend on libpcre[static-libs?]. Having built with USE="static-libs" it pulls in libpcre[static-libs], and busybox installs correctly. However, when building with USE="-static-libs", it removes the libselinux.a file (I just rm the file in the src_install phase) but busybox still fails to build on it with the error message: """ x86_64-pc-linux-gnu-gcc -march=native -ggdb -O2 -pipe -fno-strict-aliasing -Wall -Wshadow -Wwrite-strings -Wundef -Wstrict-prototypes -Wunused -Wunused-parameter -Wunused-function -Wunused-value -Wmissing-prototypes -Wmissing-declarations -Wdeclaration-after-statement -Wold-style-definition -fno-builtin-strlen -finline-limit=0 -ffunction-sections -fdata-sections -fno-guess-branch-probability -funsigned-char -static -Wl,-O1 -Wl,--as-needed -o busybox_unstripped -Wl,--sort-common -Wl,--sort-section,alignment -Wl,--start-group applets/built-in.o archival/lib.a archival/libarchive/lib.a console-tools/lib.a coreutils/lib.a coreutils/libcoreutils/lib.a debianutils/lib.a e2fsprogs/lib.a editors/lib.a findutils/lib.a init/lib.a libbb/lib.a libpwdgrp/lib.a loginutils/lib.a mailutils/lib.a miscutils/lib.a modutils/lib.a networking/lib.a networking/libiproute/lib.a networking/udhcp/lib.a printutils/lib.a procps/lib.a runit/lib.a selinux/lib.a shell/lib.a sysklogd/lib.a util-linux/lib.a util-linux/volume_id/lib.a archival/built-in.o archival/libarchive/built-in.o console-tools/built-in.o coreutils/built-in.o coreutils/libcoreutils/built-in.o debianutils/built-in.o e2fsprogs/built-in.o editors/built-in.o findutils/built-in.o init/built-in.o libbb/built-in.o libpwdgrp/built-in.o loginutils/built-in.o mailutils/built-in.o miscutils/built-in.o modutils/built-in.o networking/built-in.o networking/libiproute/built-in.o networking/udhcp/built-in.o printutils/built-in.o procps/built-in.o runit/built-in.o selinux/built-in.o shell/built-in.o sysklogd/built-in.o util-linux/built-in.o util-linux/volume_id/built-in.o -Wl,--end-group -Wl,--start-group -lcrypt -lm -lpcre -lselinux -lsepol -Wl,--end-group ========== /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lpcre /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lselinux collect2: ld returned 1 exit status make: *** [busybox_unstripped] Error 1 """ BTW, if busybox isn't built with USE="static", why does it call emake CONFIG_STATIC=y busybox? I tried it with CONFIG_STATIC=n and it builds (but haven't tested the results). (In reply to comment #22) busybox always provides a static rescue shell regardless of USE=static. i can update the ebuild's DEPEND to pull in the right selinux USE settings. Ok, updated libselinux-2.12.1-r1 committed to main tree. @SpanKY/vapier: yes, depending on libselinux[static-libs] should fix the failures Commit message: Make USE=static the default to reflect what we have always been doing (building /bin/bb statically), and depend on libselinux[static-libs] as need be http://sources.gentoo.org/sys-apps/busybox/busybox-1.20.2.ebuild?r1=1.11&r2=1.12 http://sources.gentoo.org/sys-apps/busybox/busybox-9999.ebuild?r1=1.6&r2=1.7 http://sources.gentoo.org/sys-apps/busybox/metadata.xml?r1=1.13&r2=1.14 Marking as VERIFIED:TEST-REQUEST since its in ~arch (In reply to comment #26) > Marking as VERIFIED:TEST-REQUEST since its in ~arch Works for me. recent selinux userspace utilities are now stabilized |