When i cross-compile, "pkg-config --flags libkmod" outputs "-L/usr/lib -lkmod" (as i am cross-compiling 32bit libs on amd64). Since eudev does currently not have "-L/usr/lib" or "-L$(get_libdir)" in the line for linking, it does not find kmod and fails to link. emerge --info: Portage 3.0.14-multilib (python 3.8.7-final-0, default/linux/amd64/17.1/hardened, gcc-10.2.0, glibc-2.32-r7, 4.19.164-gentoo x86_64) ================================================================= System uname: Linux-4.19.164-gentoo-x86_64-Intel-R-_Core-TM-_i7-4790_CPU_@_3.60GHz-with-glibc2.2.5 KiB Mem: 32856952 total, 9874516 free KiB Swap: 1048572 total, 997372 free Head commit of repository gentoo: fe1dfaa5102323480ff2cf7b6a3a62d66ea20eca sh bash 5.1_p4 ld GNU ld (Gentoo 2.35.2 p1) 2.35.2 app-shells/bash: 5.1_p4::gentoo dev-java/java-config: 2.3.1::gentoo dev-lang/perl: 5.32.1::gentoo dev-lang/python: 2.7.18_p7::gentoo, 3.8.7-r1::local dev-util/cmake: 3.19.5::gentoo dev-util/pkgconfig: 0.29.2::gentoo sys-apps/baselayout: 2.7-r1::gentoo sys-apps/openrc: 0.42.1-r1::gentoo sys-apps/sandbox: 2.20::gentoo sys-devel/autoconf: 2.13-r1::gentoo, 2.69-r5::gentoo sys-devel/automake: 1.13.4-r2::gentoo, 1.15.1-r2::gentoo, 1.16.3-r1::gentoo sys-devel/binutils: 2.35.2::gentoo sys-devel/gcc: 10.2.0-r5::gentoo sys-devel/gcc-config: 2.3.3::gentoo sys-devel/libtool: 2.4.6-r6::gentoo sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 5.11::gentoo (virtual/os-headers) sys-libs/glibc: 2.32-r7::gentoo Repositories: gentoo location: /usr/portage sync-type: git sync-uri: git+ssh://git@git.gentoo.org/repo/gentoo.git priority: -1000 eclass-overrides: gentoo local eclipse location: /var/lib/layman/eclipse masters: gentoo priority: 50 eclass-overrides: gentoo local enlightenment location: /var/lib/layman/enlightenment masters: gentoo priority: 50 eclass-overrides: gentoo local java location: /var/lib/layman/java masters: gentoo priority: 50 eclass-overrides: gentoo local multilib-portage location: /var/lib/layman/multilib-portage masters: gentoo priority: 50 eclass-overrides: gentoo local tastytea location: /var/lib/layman/tastytea masters: gentoo priority: 50 eclass-overrides: gentoo local local location: /usr/local/portage masters: gentoo priority: 100 eclass-overrides: gentoo local Installed sets: @fonts ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-march=native -O2 -pipe" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--keep-going" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs collision-protect distlocks ebuild-locks fixlafiles force-multilib ipc-sandbox merge-sync metadata-transfer network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms sign splitdebug strict strict-keepdir unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="https://mirrors.evowise.com/gentoo/ http://ftp.snt.utwente.nl/pub/os/linux/gentoo http://mirror.leaseweb.com/gentoo/" LANG="de_DE.UTF8" LDFLAGS="-Wl,--as-needed -Wl,--hash-style=gnu" LINGUAS="en de" MAKEOPTS="-j6 --load-average=8" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git" PORTAGE_TMPDIR="/var/tmp" USE="3dnow X alsa amd64 crypt cups custom-cflags custom-cxxflags custom-optimization gpm hardened java5 java6 libglvnd libtirpc mmx ncurses nls nptl nsplugin ogg openmp opus pam pie readline scanner seccomp split-usr sse sse2 ssl ssp system-sqlite unicode v4l verify-sig vorbis vulkan xattr xinerama xtpax zlib" ADA_TARGET="gnat_2018" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en-GB de" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" MULTILIB_ABI="amd64 x86" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python3_8" RUBY_TARGETS="ruby26" SANE_BACKENDS="hp hp3500 hp3900 hp4200 hp5400 hp5590 hpljm1005 hpsj5s hs2p" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Since bugzilla gives me an error, when i want to attach the build.log, here are the last lines from it: libtool: link: x86_64-pc-linux-gnu-ranlib .libs/libudev-core.a libtool: link: rm -fr .libs/libudev-core.lax libtool: link: ( cd ".libs" && rm -f "libudev-core.la" && ln -s "../libudev-core.la" "libudev-core.la" ) /bin/sh ../../libtool --tag=CC --mode=link x86_64-pc-linux-gnu-gcc -m32 -march=native -O2 -pipe -m32 -Wl,--as-needed -Wl,--hash-style=gnu -m32 -o udevadm udevadm.o udevadm-info.o udevadm-control.o udevadm-monitor.o udevadm-hwdb.o udevadm-settle.o udevadm-trigger.o udevadm-test.o udevadm-test-builtin.o udevadm-util.o libudev-core.la /bin/sh ../../libtool --tag=CC --mode=link x86_64-pc-linux-gnu-gcc -m32 -march=native -O2 -pipe -m32 -Wl,--as-needed -Wl,--hash-style=gnu -m32 -o udevd udevd.o libudev-core.la libtool: link: x86_64-pc-linux-gnu-gcc -m32 -march=native -O2 -pipe -m32 -Wl,--hash-style=gnu -m32 -o udevd udevd.o -Wl,--as-needed ./.libs/libudev-core.a -lblkid -lkmod libtool: link: x86_64-pc-linux-gnu-gcc -m32 -march=native -O2 -pipe -m32 -Wl,--hash-style=gnu -m32 -o udevadm udevadm.o udevadm-info.o udevadm-control.o udevadm-monitor.o udevadm-hwdb.o udevadm-settle.o udevadm-trigger.o udevadm-test.o udevadm-test-builtin.o udevadm-util.o -Wl,--as-needed ./.libs/libudev-core.a -lblkid -lkmod /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lkmod collect2: error: ld returned 1 exit status make[4]: *** [Makefile:678: udevd] Error 1 make[4]: *** Waiting for unfinished jobs.... /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lkmod collect2: error: ld returned 1 exit status make[4]: *** [Makefile:674: udevadm] Error 1
This should be fixed in the referenced upstream PR, do you mind confirming with your setup?
Actually now that I looked at this again its actually about the linker directory and not the include directory so the PR would not make a difference in this case. Additionally I looked at the eudev and libkmod source, the former has used pkg-config to detect libkmod's libs for a long time and the latter has has always included the linker directory in the pc file. Lastly I setup a i686 musl crossdev environment on my x86_64 musl system where cross-compiling eudev worked correctly. This seems to have been fixed somewhere else or perhaps it was user error? I will close this, but if you can still reproduce it please provide more info on how.