PAM requires that libfl.a from sys-devel/flex be present in the target root at build time. When building for native, this is not a problem, because there is a DEPEND on sys-devel/flex. But for cross-compile, DEPEND by default means that the package is needed on the host, so there is no guarantee that flex will also be present in the target filesystem.
Steps to Reproduce:
1. Make sure sys-devel/flex is not installed in the target (!) filesystem
2. Try to cross-compile sys-libs/pam
Created attachment 331570 [details]
Created attachment 331572 [details, diff]
This patch adds a manual check into the ebuild to abort if flex is not installed, and instructs the user to cross-compile flex and try again (as opposed to failing with an obscure error).
A proper solution for this bug will only be possible after the features in the experimental EAPI 5-hdepend become part of an official EAPI. Then, sys-devel will be put both into HDEPEND and DEPEND, ensuring it is installed in both the host and the target at build time. For more information, see http://blogs.gentoo.org/zmedico/2012/09/25/experimental-eapi-5-hdepend/ .
P.S. I'm not sure if the flex check should instead go into pkg_pretend()? If that was done, consider that on native installs, flex may not be installed in pkg_pretend() but will be by the time the package is built, as a dependency, so tc-is-cross-compiler really is necessary.
Created attachment 331576 [details, diff]
Proper fix utilizing HDEPEND.
P.S. This bug should depend on 317337 (EAPI HDEPEND support).
I'm doing cross-compiling myself and can confirm that installing flex on the build-host is required. So reply #3 seems correct
Ambroz, you can add the dependency on bug #317337 yourself since you created this bug. I have filed a couple of other use-cases for HDEPEND, autogen and dbus-glib.
the pam package has DEPEND=sys-devel/flex. that is sufficient to cross-compile.
Mike, please reopen this. flex needs to be installed to the *target* which DEPEND can't help with.