Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 789660 - dev-lang/spidermonkey-78.10.1: fails to compile on prefix with dev-lang/rust-1.52.1
Summary: dev-lang/spidermonkey-78.10.1: fails to compile on prefix with dev-lang/rust-...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2021-05-12 09:50 UTC by Guilherme Amadio
Modified: 2021-05-19 12:36 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,179.21 KB, text/x-log)
2021-05-12 09:50 UTC, Guilherme Amadio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Guilherme Amadio gentoo-dev 2021-05-12 09:50:48 UTC
Created attachment 707538 [details]
build.log

The error is shown below. It seems that LD_LIBRARY_PATH is set in the failing command, which then breaks /bin/sh because it forces it to use prefix's own libc. With rust-1.51 and spidermonkey 78.4.0 it used to work. I remember seeing a problem with glibc that calls to system("command") would get spawned using /bin/sh rather than the shell from prefix. This may be a symptom of that.

Full build log is attached.

error: linking with `/tmp/portage/dev-lang/spidermonkey-78.10.1/work/firefox-78.10.1/build/cargo-linker` failed: exit code: 1
  |
  = note: "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/firefox-78.10.1/build/cargo-linker" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-L" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.build_script_build.4uzsqvlq-cgu.0.rcgu.o" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.build_script_build.4uzsqvlq-cgu.1.rcgu.o" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.build_script_build.4uzsqvlq-cgu.10.rcgu.o" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.build_script_build.4uzsqvlq-cgu.11.rcgu.o" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.build_script_build.4uzsqvlq-cgu.12.rcgu.o" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.build_script_build.4uzsqvlq-cgu.13.rcgu.o" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.build_script_build.4uzsqvlq-cgu.14.rcgu.o" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.build_script_build.4uzsqvlq-cgu.15.rcgu.o" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.build_script_build.4uzsqvlq-cgu.2.rcgu.o" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.build_script_build.4uzsqvlq-cgu.3.rcgu.o" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.build_script_build.4uzsqvlq-cgu.4.rcgu.o" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.build_script_build.4uzsqvlq-cgu.5.rcgu.o" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.build_script_build.4uzsqvlq-cgu.6.rcgu.o" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.build_script_build.4uzsqvlq-cgu.7.rcgu.o" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.build_script_build.4uzsqvlq-cgu.8.rcgu.o" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.build_script_build.4uzsqvlq-cgu.9.rcgu.o" "-o" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f/build_script_build-313bf216efdd441f.lftl7zmqkd9ffqq.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/deps" "-L" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8a78e1d6743d33c5.rlib" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-edefcd02412ed5d6.rlib" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-01468a23aced989b.rlib" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-51bca9524539babc.rlib" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-a2abe401f11c02d8.rlib" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-e4b2424759fc3066.rlib" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-2c31550ca07c9039.rlib" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-6e2fff556eaeeace.rlib" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-81467f094a7af066.rlib" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-bbfbc481447eb351.rlib" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-5e245512acaf9a7d.rlib" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-cce039f9e74ec762.rlib" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-af3751a031fb7d30.rlib" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-cfbe4653528b21a9.rlib" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-32f40125ef7236d6.rlib" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-a4fd605f9df337c2.rlib" "-Wl,--end-group" "/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-546854859ab4a5b1.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc"
  = note: /bin/sh: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib/libtinfo.so.5)
          /bin/sh: /lib64/libc.so.6: version `GLIBC_2.16' not found (required by /cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib/libtinfo.so.5)
          

error: aborting due to previous error

error: could not compile `packed_simd`

Caused by:
  process didn't exit successfully: `CARGO=/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/rust/1.52.1/bin/cargo-1.52.1 CARGO_CRATE_NAME=build_script_build CARGO_MANIFEST_DIR=/tmp/portage/dev-lang/spidermonkey-78.10.1/work/firefox-78.10.1/third_party/rust/packed_simd CARGO_PKG_AUTHORS='Gonzalo Brito Gadeschi <gonzalobg88@gmail.com>' CARGO_PKG_DESCRIPTION='Portable Packed SIMD vectors' CARGO_PKG_HOMEPAGE='https://github.com/rust-lang-nursery/packed_simd' CARGO_PKG_LICENSE=MIT/Apache-2.0 CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=packed_simd CARGO_PKG_REPOSITORY='https://github.com/rust-lang-nursery/packed_simd' CARGO_PKG_VERSION=0.3.4 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=3 CARGO_PKG_VERSION_PATCH=4 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/deps:/cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib' /cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/bin/rustc --crate-name build_script_build --edition=2018 /tmp/portage/dev-lang/spidermonkey-78.10.1/work/firefox-78.10.1/third_party/rust/packed_simd/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="into_bits"' -C metadata=313bf216efdd441f -C extra-filename=-313bf216efdd441f --out-dir /tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/build/packed_simd-313bf216efdd441f -C linker=/tmp/portage/dev-lang/spidermonkey-78.10.1/work/firefox-78.10.1/build/cargo-linker -L dependency=/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/release/deps --cap-lints warn` (exit code: 1)
make[3]: *** [/tmp/portage/dev-lang/spidermonkey-78.10.1/work/firefox-78.10.1/config/makefiles/rust.mk:311: force-cargo-library-build] Error 101
make[3]: Leaving directory '/tmp/portage/dev-lang/spidermonkey-78.10.1/work/build/js/src/rust'
make[2]: *** [/tmp/portage/dev-lang/spidermonkey-78.10.1/work/firefox-78.10.1/config/recurse.mk:74: js/src/rust/target] Error 2
make[2]: *** Waiting for unfinished jobs....
Comment 1 Georgy Yakovlev archtester gentoo-dev 2021-05-12 21:24:58 UTC
https://github.com/gentoo/gentoo/pull/19815
https://github.com/gentoo/gentoo/pull/20073

^ relevant changes that went in recently.


seems you are using dev-lang/rust
try using rust-bin? it should be forced to use correct libc.
we may need patchelf dev-lang/rust as well. I'm not sure how it determines which paths to use.
Comment 2 Georgy Yakovlev archtester gentoo-dev 2021-05-12 21:28:50 UTC
and no it's not LD_LIBRARY_PATH failure.

crate uses prefix headers and tried to link with prefix libs but using host libc, which lacks symbols.
Comment 3 Guilherme Amadio gentoo-dev 2021-05-14 07:22:42 UTC
Please look at the error more closely:

  = note: /bin/sh: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib/libtinfo.so.5)

This is /bin/sh trying to use libtinfo.so.5 from prefix, most likely due to LD_LIBRARY_PATH being set when the shell was invoked. The prefix shell should have been used here, not /bin/sh, and LD_LIBRARY_PATH should most likely be empty. All libraries being linked by rust are pointing to the prefix if you look at the command line, so it's not rust trying to use host libraries that is the problem.
Comment 4 Georgy Yakovlev archtester gentoo-dev 2021-05-15 19:18:36 UTC
maybe you are right.

but this looks somewhat relevant
https://github.com/rust-lang/cargo/issues/6582


build system uses this as linker wrapper:
/tmp/portage/dev-lang/spidermonkey-78.10.1/work/firefox-78.10.1/build/cargo-linker 

is a shell script with /bin/sh as shebang. 
all it does is

> #!/bin/sh
> eval ${MOZ_CARGO_WRAP_LD} ${MOZ_CARGO_WRAP_LDFLAGS} '"$@"'

so maybe this file should be eprefixified? =)

I have no test environment, but worth trying I think.
Comment 5 Guilherme Amadio gentoo-dev 2021-05-17 14:34:29 UTC
Indeed, prefixifying the scripts fixed the build. I will push a fix soon, or via a merge request if you'd rather see it beforehand.
Comment 6 Georgy Yakovlev archtester gentoo-dev 2021-05-17 17:44:07 UTC
I don't maintain spidermonkey, so I have no say there. should be straightforward enough.

but if you want to modify rust then yeah, send patch or open PR and lmk, I'll take a look.
Comment 7 Guilherme Amadio gentoo-dev 2021-05-18 08:21:35 UTC
This is the patch:

diff --git a/dev-lang/spidermonkey/spidermonkey-78.10.1.ebuild b/dev-lang/spidermonkey/spidermonkey-78.10.1.ebuild
index b6cfe9ac633..5408e1fe7ec 100644
--- a/dev-lang/spidermonkey/spidermonkey-78.10.1.ebuild
+++ b/dev-lang/spidermonkey/spidermonkey-78.10.1.ebuild
@@ -13,7 +13,7 @@ PYTHON_COMPAT=( python3_{7..9} )
 
 WANT_AUTOCONF="2.1"
 
-inherit autotools check-reqs flag-o-matic llvm multiprocessing python-any-r1 toolchain-funcs
+inherit autotools check-reqs flag-o-matic llvm multiprocessing prefix python-any-r1 toolchain-funcs
 
 MY_PN="mozjs"
 MY_PV="${PV/_pre*}" # Handle Gentoo pre-releases
@@ -230,6 +230,11 @@ src_prepare() {
                python/mozbuild/mozbuild/configure/check_debug_ranges.py \
                || die "sed failed to set toolchain prefix"
 
+       # use prefix shell in wrapper linker scripts, bug #789660
+       if [[ -n ${EPREFIX} ]]; then
+               hprefixify "${WORKDIR}"/firefox-${MY_PV}/build/cargo-{,host-}linker
+       fi
+
        einfo "Removing pre-built binaries ..."
        find third_party -type f \( -name '*.so' -o -name '*.o' \) -print -delete || die

@mozilla, could you please ack this?
Comment 8 Fabian Groffen gentoo-dev 2021-05-18 08:24:58 UTC
hprefixify doesn't do anything if not in prefix, so you can drop the conditional IMO
Comment 9 Guilherme Amadio gentoo-dev 2021-05-18 08:30:35 UTC
Sure, makes sense. Thanks Fabian. I will drop the conditional before pushing.
Comment 10 Larry the Git Cow gentoo-dev 2021-05-19 12:36:18 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c2a795bc5c6714bf8e77984d570e43ca4043ff7

commit 8c2a795bc5c6714bf8e77984d570e43ca4043ff7
Author:     Guilherme Amadio <amadio@gentoo.org>
AuthorDate: 2021-05-18 08:18:48 +0000
Commit:     Guilherme Amadio <amadio@gentoo.org>
CommitDate: 2021-05-19 12:19:07 +0000

    dev-lang/spidermonkey: use prefix shell, bug #789660
    
    Closes: https://bugs.gentoo.org/789660
    Package-Manager: Portage-3.0.18, Repoman-3.0.3
    Signed-off-by: Guilherme Amadio <amadio@gentoo.org>

 dev-lang/spidermonkey/spidermonkey-78.10.1.ebuild | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)