Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 699696

Summary: dev-libs/nss fails to cross compile with host and target being musl based with: nss-3.46/temp/fakedir: No such file or directory
Product: Gentoo Linux Reporter: tt_1 <herrtimson>
Component: Current packagesAssignee: Mozilla Gentoo Team <mozilla>
Status: UNCONFIRMED ---    
Severity: normal CC: matoro_bugzilla_gentoo
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---
Attachments: compressed build log
output from emerge --info (host)
output from emerge --info (cross-target)

Description tt_1 2019-11-09 19:57:30 UTC
Created attachment 595582 [details]
compressed build log

from the build log, it seems, that signing with shlibs doesn't work: 

make[3]: Leaving directory '/usr/aarch64-unknown-linux-musl/tmp/portage/dev-libs/nss-3.46/work/nss-3.46/nss-.arm64/cmd/shlibsign/mangle'
cd Linux2.6_aarch64_aarch64-unknown-linux-musl-gcc_glibc_PTH_64_OPT.OBJ ; sh '/usr/aarch64-unknown-linux-musl/tmp/portage/dev-libs/nss-3.46/work/nss-3.46/nss-.arm64/cmd/shlibsign/.'/ '/usr/aarch64-unknown-linux-musl/tmp/portage/dev-libs/nss-3.46/work/nss-3.46/nss-.arm64/cmd/shlibsign/../../dist/Linux2.6_aarch64_aarch64-unknown-linux-musl-gcc_glibc_PTH_64_OPT.OBJ' \
'/usr/aarch64-unknown-linux-musl/tmp/portage/dev-libs/nss-3.46/work/nss-3.46/nss-.arm64/cmd/shlibsign/Linux2.6_aarch64_aarch64-unknown-linux-musl-gcc_glibc_PTH_64_OPT.OBJ' Linux \
'/usr/aarch64-unknown-linux-musl/tmp/portage/dev-libs/nss-3.46/temp/fakedir' '/usr/aarch64-unknown-linux-musl/tmp/portage/dev-libs/nss-3.46/work/nss-3.46/nss-.arm64/cmd/shlibsign/../../dist/Linux2.6_aarch64_aarch64-unknown-linux-musl-gcc_glibc_PTH_64_OPT.OBJ/lib/'
/usr/aarch64-unknown-linux-musl/tmp/portage/dev-libs/nss-3.46/work/nss-3.46/nss-.arm64/cmd/shlibsign/./ line 36: cd: /usr/aarch64-unknown-linux-musl/tmp/portage/dev-libs/nss-3.46/temp/fakedir: No such file or directory
shlibsign -v -i /usr/aarch64-unknown-linux-musl/tmp/portage/dev-libs/nss-3.46/work/nss-3.46/nss-.arm64/cmd/shlibsign/../../dist/Linux2.6_aarch64_aarch64-unknown-linux-musl-gcc_glibc_PTH_64_OPT.OBJ/lib/
loading softokn3 failedmake[2]: *** [Makefile:92: ../../dist/Linux2.6_aarch64_aarch64-unknown-linux-musl-gcc_glibc_PTH_64_OPT.OBJ/lib/libsoftokn3.chk] Error 1
make[2]: Leaving directory '/usr/aarch64-unknown-linux-musl/tmp/portage/dev-libs/nss-3.46/work/nss-3.46/nss-.arm64/cmd/shlibsign'
make[1]: *** [../coreconf/ libs] Error 2

It does however work when the host is glibc based, and only the target is musl based. Since it seems as if the nss source code does ship some binaries, who are crucial to the build and which rely on glibc, I'm not very optimistic about this, but still: is there a way to solve this? 

I'm going to attach the full build log.
Comment 1 tt_1 2019-11-09 19:58:54 UTC
Created attachment 595584 [details]
output from emerge --info (host)
Comment 2 tt_1 2019-11-09 19:59:24 UTC
Created attachment 595586 [details]
output from emerge --info (cross-target)
Comment 3 matoro archtester 2020-01-16 00:06:08 UTC
Weird, I just ran into this issue on =dev-libs/nss-3.49.1, non-cross-compile, on arm, for glibc.  No cross-compiling or musl weirdness involved.  Did you ever find a fix for this issue?
Comment 4 tt_1 2020-01-16 07:35:25 UTC
please post your build logs and emerge --info
Comment 5 matoro archtester 2020-01-17 13:50:04 UTC
(In reply to tt_1 from comment #4)
> please post your build logs and emerge --info

Sorry, it actually turned out to be an instance of instead of this problem.  I don't have the build log anymore because I was able to solve it at the time by explicitly applying "-mfpu=neon" to my CFLAGS (redundant, but necessary apparently).
Comment 6 matoro archtester 2020-01-17 20:25:23 UTC
Actually scratch that I just tried recompiling and this did pop up again.  Will add build log.
Comment 7 matoro archtester 2020-01-17 20:28:16 UTC
Created attachment 603632 [details]
Comment 8 matoro archtester 2020-01-17 20:30:09 UTC
$ emerge --info dev-libs/nss                                                                                                                                                                                                                                                              Portage 2.3.84 (python 3.8.1-final-0, default/linux/arm/17.0/armv7a, gcc-9.2.0, glibc-2.30-r3, 4.4.182-mainline-rev1 armv7l)
                         System Settings                                                                                                                                                                                                                                                                                 
System uname: Linux-4.4.182-mainline-rev1-armv7l-ARMv7_Processor_rev_2_-v7l-with-glibc2.4
KiB Mem:     2069232 total,    288784 free
KiB Swap:    8388600 total,   8293080 free
Timestamp of repository gentoo: Fri, 17 Jan 2020 19:46:09 +0000                                                                                                                                                                                                                                                          
Head commit of repository gentoo: f20391c480293e0a2cd6f010c08d8bc0ba6265ef

sh bash 5.0_p11                                                                                                                                                                                                                                                                                                          ld GNU ld (Gentoo 2.33.1 p2) 2.33.1                                                                                                                                                                                                                                                                                      app-shells/bash:          5.0_p11::gentoo                                                                                                                                                                                                                                                                                dev-java/java-config:     2.2.0-r4::x-portage                                                                                                                                                                                                                                                                            dev-lang/perl:            5.30.1::gentoo                                                                                                                                                                                                                                                                                 dev-lang/python:          3.8.1::gentoo   
dev-util/cmake:           3.16.2-r1::gentoo                                                                                                                                                                                                                                                                              
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.69-r5::gentoo
sys-devel/automake:       1.16.1-r2::gentoo
sys-devel/binutils:       2.33.1-r1::gentoo
sys-devel/gcc:            9.2.0-r3::gentoo
sys-devel/gcc-config:     2.2::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.30-r3::gentoo

    location: /usr/portage
    sync-type: git
    priority: -1000

    location: /usr/local/portage
    masters: gentoo
    priority: 0

    location: /var/lib/layman/chaoslab
    sync-type: laymansync
    masters: gentoo
    priority: 50

    location: /var/lib/layman/pg_overlay
    sync-type: laymansync
    masters: gentoo
    priority: 50

CFLAGS="-O3 -pipe -march=native -funroll-loops -flto=3 -floop-block -floop-interchange -floop-strip-mine -ftree-loop-distribution"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O3 -pipe -march=native -funroll-loops -flto=3 -floop-block -floop-interchange -floop-strip-mine -ftree-loop-distribution"
FCFLAGS="-O2 -pipe -march=armv7-a"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=armv7-a"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
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"
USE="acl arm armv5te armv6 armv6t2 berkdb bzip2 cli crypt cxx dri fortran gdbm graphite hardened iconv ipv6 lto ncurses nls nptl openmp pam pax_kernel pcre pgo pic pie readline seccomp split-usr ssl tcpd threads unicode vhosts vim-syntax xattr zlib" ADA_TARGET="gnat_2018" 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_ARM="edsp thumb thumb2 v4 v5 v6 v7 vfp vfp-d32 vfpv3" 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 keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python3_8" RUBY_TARGETS="ruby27" USERLAND="GNU" VIDEO_CARDS="exynos fbdev omap dummy v4l" 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"
Comment 9 tt_1 2020-01-17 20:39:44 UTC
I hit this only when cross compiling, and it seems that's not what you're doing here. Instead, you're going for a native comile with CHOST=armv7a-unknown-linux-gnueabihf, right?
Comment 10 matoro archtester 2020-01-18 20:24:10 UTC
(In reply to tt_1 from comment #9)
> I hit this only when cross compiling, and it seems that's not what you're
> doing here. Instead, you're going for a native comile with
> CHOST=armv7a-unknown-linux-gnueabihf, right?

Right, that's what I posted in my previous comment:

> Weird, I just ran into this issue on =dev-libs/nss-3.49.1, non-cross-compile, on arm, for glibc.  No cross-compiling or musl weirdness involved.

Since I am doing a native compile and everything is glibc-based, yet still ran into the same issue, that leads me to believe that neither cross-compile nor musl are the culprits here.  I am still looking into the build scripts to see if I can identify it.
Comment 11 yshuiv7 2020-10-24 22:04:20 UTC
This is because of changes made in 436216, which runs the host shlibsign tool. runs shlibsign with LD_LIBRARY_PATH pointing to the build directory, causing the host shlibsign to not be able to find the libraries.

I think the right solution here is to remove the `export LD_LIBRARY_PATH` from
Comment 12 yshuiv7 2020-10-24 22:12:32 UTC
The "fakedir" error is not relevant, BTW.
Comment 13 tt_1 2020-10-25 15:49:17 UTC
Are you able to provide some sort of patch to hack around this? I still haven't been able to figure out by myself yet what exactly to do, even though you provided some informations that seem reasonable to me. thanks