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

Bug 717314

Summary: >=dev-lang/spidermonkey-68.7.0 fails to cross compile with: ../config/nsinstall: cannot execute binary file
Product: Gentoo Linux Reporter: tt_1 <herrtimson>
Component: Current packagesAssignee: Mozilla Gentoo Team <mozilla>
Status: RESOLVED FIXED    
Severity: normal CC: jstein
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log from cross compiling
output from emerge --info (cross-target)
build.log from cross compiling

Description tt_1 2020-04-13 12:55:23 UTC
Created attachment 632650 [details]
build.log from cross compiling

things aren't too bad from the start, but something goes wrong when nsinstall binary is built: 

mkdir -p '../dist/host/bin/'
config/host_nsinstall.o
/usr/bin/armv7a-unknown-linux-gnueabihf-gcc -std=gnu99 -o host_nsinstall.o -c  -DXP_UNIX -DNDEBUG=1 -DTRIMMED=1 -D_UNICODE -DUNICODE -I/usr/armv7a-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-68.7.0/work/firefox-68.7.0/config -I/usr/armv7a-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-68.7.0/work/build/config -I/usr/armv7a-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-68.7.0/work/build/dist/include -MD -MP -MF .deps/host_nsinstall.o.pp -I/usr/include/nspr /usr/armv7a-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-68.7.0/work/firefox-68.7.0/config/nsinstall.c
config/host_pathsub.o
/usr/bin/armv7a-unknown-linux-gnueabihf-gcc -std=gnu99 -o host_pathsub.o -c  -DXP_UNIX -DNDEBUG=1 -DTRIMMED=1 -D_UNICODE -DUNICODE -I/usr/armv7a-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-68.7.0/work/firefox-68.7.0/config -I/usr/armv7a-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-68.7.0/work/build/config -I/usr/armv7a-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-68.7.0/work/build/dist/include -MD -MP -MF .deps/host_pathsub.o.pp -I/usr/include/nspr /usr/armv7a-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-68.7.0/work/firefox-68.7.0/config/pathsub.c
config/nsinstall_real
/usr/bin/armv7a-unknown-linux-gnueabihf-gcc -std=gnu99 -o nsinstall_real -DXP_UNIX  host_nsinstall.o host_pathsub.o  
/usr/armv7a-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-68.7.0/work/build/_virtualenvs/init/bin/python -m mozbuild.action.check_binary --host nsinstall_real
cp nsinstall_real nsinstall.tmp
mv nsinstall.tmp nsinstall
../config/nsinstall -R -m 755 'nsinstall' '../dist/bin'
../config/nsinstall: ../config/nsinstall: cannot execute binary file

the nsinstall binary is for armv7: 

file nsinstall
nsinstall: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, not stripped

that's not supposed to happen, since the host can't execute the foreign binary.
Comment 1 tt_1 2020-04-13 12:56:01 UTC
Created attachment 632652 [details]
output from emerge --info (cross-target)
Comment 2 tt_1 2020-04-13 13:10:00 UTC
from cross compiling firefox-75.0 (successfully), these switches are needed: 

--host=x86_64-pc-linux-gnu --target=armv7a-unknown-linux-gnueabihf

hardcoding them into the ebuild seems to enable full cross compile: 

file libmozjs-68.so.0.0.0 
libmozjs-68.so.0.0.0: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, stripped

file js68 
js68: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, stripped
Comment 3 tt_1 2020-04-13 13:35:20 UTC
the difference in build time is immense: 

five minutes cross compiled, versus four hours nativly 

do you deem this to be fixable within the ebuild?
Comment 4 Thomas Deutschmann (RETIRED) gentoo-dev 2020-07-01 19:46:14 UTC
Should be fixed in >=68.10.0.
Comment 5 tt_1 2020-07-01 19:53:34 UTC
Created attachment 647332 [details]
build.log from cross compiling

I regret saying it, but that doesn't fix the problem :(
Comment 6 Thomas Deutschmann (RETIRED) gentoo-dev 2020-07-01 21:55:18 UTC
Please test:

> --- a/dev-lang/spidermonkey/spidermonkey-68.10.0.ebuild
> +++ b/dev-lang/spidermonkey/spidermonkey-68.10.0.ebuild
> @@ -124,6 +124,7 @@ src_configure() {
>         # and other minor arches
>         ECONF_SOURCE="${S}" \
>         econf \
> +               --host="${CBUILD:-${CHOST}}" \
>                 --target="${CHOST}" \
>                 --disable-jemalloc \
>                 --disable-optimize \
>
Comment 7 tt_1 2020-07-02 10:16:13 UTC
Yes, now it's working. Tested with armv7 and aarch64 as target and amd64 as host.
Comment 8 Larry the Git Cow gentoo-dev 2020-07-02 15:07:17 UTC
The bug has been closed via the following commit(s):

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

commit ac3c9c814c6007da265b0d7c30350f76fff07d29
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-07-02 15:05:45 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-07-02 15:05:59 +0000

    dev-lang/spidermonkey: fix cross-compile
    
    Instead of the standard --build= and --host=, Mozilla
    uses --host instead of --build, and --target intstead
    of --host.
    
    Closes: https://bugs.gentoo.org/717314
    Package-Manager: Portage-2.3.103, Repoman-2.3.23
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 dev-lang/spidermonkey/spidermonkey-68.10.0.ebuild | 1 +
 1 file changed, 1 insertion(+)