Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 740890 - =dev-lang/spidermonkey-78.2.0 - missing dependecy on llvm-objdump?
Summary: =dev-lang/spidermonkey-78.2.0 - missing dependecy on llvm-objdump?
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-07 20:14 UTC by tt_1
Modified: 2020-09-20 14:04 UTC (History)
1 user (show)

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


Attachments
reduced patch (spidermonkey-78-use-llvm-not-clang.patch,826 bytes, patch)
2020-09-08 09:22 UTC, tt_1
Details | Diff
compressed build log (spidermonkey-78-without-clang.log.gz,35.47 KB, application/gzip)
2020-09-08 09:24 UTC, tt_1
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tt_1 2020-09-07 20:14:10 UTC
spidermonkey-78.2.0 checks for llvm-objdump during configure: 

checking for NSIS version... no
checking for llvm-objdump... not found
DEBUG: llvm_objdump: Trying llvm-objdump
ERROR: Cannot find llvm-objdump

spidermonkey:68 removed this with the patchset, so I tried to backport the patch: 

 cat /tmp/006-remove-dep-on-llvm-objdump.patch 
--- a/moz.configure
+++ b/moz.configure
@@ -621,10 +621,6 @@ def llvm_objdump(host_c_compiler, c_compiler, bindgen_config_paths):
     return (llvm_objdump,)
 
 
-llvm_objdump = check_prog('LLVM_OBJDUMP', llvm_objdump, what='llvm-objdump',
-                          when='--enable-compile-environment',
-                          paths=toolchain_search_path)
-
 add_old_configure_assignment('LLVM_OBJDUMP', llvm_objdump)
 

and applied it via /etc/portage/patches. 

This, however, didn't work out, as it is needed: 

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/armv6j-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-78.2.0/work/firefox-78.2.0/python/mozbuild/mozbuild/action/check_binary.py", line 369, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/armv6j-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-78.2.0/work/firefox-78.2.0/python/mozbuild/mozbuild/action/check_binary.py", line 361, in main
    return check_networking(options.binary)
  File "/usr/armv6j-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-78.2.0/work/firefox-78.2.0/python/mozbuild/mozbuild/action/check_binary.py", line 280, in check_networking
    for sym in at_least_one(iter_symbols(binary)):
  File "/usr/armv6j-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-78.2.0/work/firefox-78.2.0/python/mozbuild/mozbuild/action/check_binary.py", line 73, in at_least_one
    for item in iter:
  File "/usr/armv6j-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-78.2.0/work/firefox-78.2.0/python/mozbuild/mozbuild/action/check_binary.py", line 93, in iter_symbols
    for line in get_output(buildconfig.substs['LLVM_OBJDUMP'], '-t',
  File "/usr/armv6j-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-78.2.0/work/firefox-78.2.0/python/mozbuild/mozbuild/backend/configenvironment.py", line 287, in __getitem__
    raise KeyError("'%s'" % key)
KeyError: "'LLVM_OBJDUMP'"
Comment 1 Thomas Deutschmann (RETIRED) gentoo-dev 2020-09-07 20:28:03 UTC
No, it's required now.
Comment 2 tt_1 2020-09-07 20:48:35 UTC
hmm, I think this needs some more testing from my side: 

this happened when cross compiling spidermonkey-78.2 to armv6, and I don't have any llvm emerged to that rootfs, only amd64 host has the llvm-objdump binary. 

normally the config scripts should notice they are cross compiled, and not check for binaries they need as strikt compile time dependencies in the rootfs. Examples for firefox are nodejs, which is only checked for the host, unlike dev-libs/icu for example which is checked for in the rootfs as firefox links against them later. 

what about clang, libclang, nasm, yasm, are these checks all sane?
Comment 3 Thomas Deutschmann (RETIRED) gentoo-dev 2020-09-07 21:48:24 UTC
In the end, when you patched out clang, it will be used here:

>     Finished release [optimized] target(s) in 43.67s
> /var/tmp/portage/dev-lang/spidermonkey-78.2.0/work/build/_virtualenvs/init_py3/bin/python -m mozbuild.action.check_binary --target --networking /var/tmp/portage/dev-lang/spidermonkey-78.2.0/work/build/x86_64-unknown-linux-gnu/release/libjsrust.a
> Traceback (most recent call last):
>   File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
>     "__main__", mod_spec)
>   File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
>     exec(code, run_globals)
>   File "/var/tmp/portage/dev-lang/spidermonkey-78.2.0/work/firefox-78.2.0/python/mozbuild/mozbuild/action/check_binary.py", line 369, in <module>
>     sys.exit(main(sys.argv[1:]))
>   File "/var/tmp/portage/dev-lang/spidermonkey-78.2.0/work/firefox-78.2.0/python/mozbuild/mozbuild/action/check_binary.py", line 361, in main
>     return check_networking(options.binary)
>   File "/var/tmp/portage/dev-lang/spidermonkey-78.2.0/work/firefox-78.2.0/python/mozbuild/mozbuild/action/check_binary.py", line 280, in check_networking
>     for sym in at_least_one(iter_symbols(binary)):
>   File "/var/tmp/portage/dev-lang/spidermonkey-78.2.0/work/firefox-78.2.0/python/mozbuild/mozbuild/action/check_binary.py", line 73, in at_least_one
>     for item in iter:
>   File "/var/tmp/portage/dev-lang/spidermonkey-78.2.0/work/firefox-78.2.0/python/mozbuild/mozbuild/action/check_binary.py", line 93, in iter_symbols
>     for line in get_output(buildconfig.substs['LLVM_OBJDUMP'], '-t',
>   File "/var/tmp/portage/dev-lang/spidermonkey-78.2.0/work/firefox-78.2.0/python/mozbuild/mozbuild/backend/configenvironment.py", line 287, in __getitem__
>     raise KeyError("'%s'" % key)
> KeyError: "'LLVM_OBJDUMP'"
> make[3]: *** [/var/tmp/portage/dev-lang/spidermonkey-78.2.0/work/firefox-78.2.0/config/makefiles/rust.mk:311: /var/tmp/portage/dev-lang/spidermonkey-78.2.0/work/build/x86_64-unknown-linux-gnu/release/libjsrust.a] Error 1
>
Comment 4 Larry the Git Cow gentoo-dev 2020-09-07 21:59:14 UTC
The bug has been closed via the following commit(s):

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

commit 2caf8004b7c582d65d1d01a96f32febdedcb8fdd
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-09-07 21:20:59 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-09-07 21:59:06 +0000

    dev-lang/spidermonkey: clang/LLVM is required
    
    Closes: https://bugs.gentoo.org/740890
    Package-Manager: Portage-3.0.5, Repoman-3.0.1
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 dev-lang/spidermonkey/spidermonkey-78.2.0.ebuild | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
Comment 5 tt_1 2020-09-08 07:50:19 UTC
this solves the initial problem in src_configure for cross compile to arm, but does end up in a binary execution error, as the amd64 host tries to execute the armv6 file: 

3379620-    return subprocess.check_output(cmd, env=env, universal_newlines=True).splitlines()
3379707-  File "/usr/lib/python3.7/subprocess.py", line 411, in check_output
3379776-    **kwargs).stdout
3379797-  File "/usr/lib/python3.7/subprocess.py", line 488, in run
3379857-    with Popen(*popenargs, **kwargs) as process:
3379906-  File "/usr/lib/python3.7/subprocess.py", line 800, in __init__
3379971-    restore_signals, start_new_session)
3380011-  File "/usr/lib/python3.7/subprocess.py", line 1551, in _execute_child
3380083-    raise child_exception_type(errno_num, err_msg, err_filename)
3380148:OSError: [Errno 8] Exec format error: '/usr/armv6j-unknown-linux-gnueabihf/usr/lib/llvm/9/bin/llvm-objdump'
3380256-make[3]: *** [/usr/armv6j-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-78.2.0/work/firefox-78.2.0/config/makefiles/rust.mk:311: /usr/armv6j-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-78.2.0/work/build/arm-unknown-linux-gnueabihf/release/libjsrust.a] Error 1
3380542-make[3]: *** Deleting file '/usr/armv6j-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-78.2.0/work/build/arm-unknown-linux-gnueabihf/release/libjsrust.a'
3380707-make[3]: Leaving directory '/usr/armv6j-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-78.2.0/work/build/js/src/rust'
3380836-make[2]: *** [/usr/armv6j-unknown-linux-gnueabihf/tmp/portage/dev-lang/spidermonkey-78.2.0/work/firefox-78.2.0/config/recurse.mk:74: js/src/rust/target] Error 2
3380997-make[2]: *** Waiting for unfinished jobs....
Comment 6 tt_1 2020-09-08 07:53:14 UTC
I'll grab a fresh stage3 and going to play dumb, to settle this, and later on will check why the cross compile is a problem. 

If I find something worth commiting, I'll either check back here or ping you on github to point you to my branch with the fixes.
Comment 7 tt_1 2020-09-08 09:22:32 UTC
Created attachment 659122 [details, diff]
reduced patch

two things I found: 

1. you can relax virtual/rust dependency to 1.41.1 - while it's true that this version has been tree cleaned, so has 1.43.0, and if you're aiming to allow only those in tree it should be 1.44.1 instead. But I still had rust-bin-1.41.1 flying around and it compiled spidermonkey-78.2.0 just fine. 

2. clang, clang-bindgen, nasm, yasm, X-headers are all checked for during src_configure, but the script doesn't fail if they are not present. Therefore I believe that really all that is needed from the whole of llvm is llvm-objdump from sys-devel/llvm itself. There is absolutly no mandantory clang involved in mozjs, even though it's of course perfectly fine to use CC=clang if that's desired. 

I'm not really sure why the cross compile fails, but it seems that during cross compile it must be that there is a missmatch of host and target binaries. The firefox ebuild does use --host-root variable, but that was banned in EAPI=7 , and I'm uncertain what the replacement is and if it's the same behavior.
Comment 8 tt_1 2020-09-08 09:24:56 UTC
Created attachment 659124 [details]
compressed build log

compressed build log without any clang present on system, only gcc, cmake, rust-bin and llvm for llvm-objdump
Comment 9 Thomas Deutschmann (RETIRED) gentoo-dev 2020-09-10 11:45:39 UTC
You are right about rust requirement.

However, spidermonkey configure will fail without clang available. At the moment I am not sure if I am going to try to rip out clang checks...

> The firefox ebuild does use --host-root variable, but that was banned in EAPI=7

What do you mean with this?


Also, what are you doing? In a clean stage3 I run

# <Keyworded spidermonkey-78>
# emerge -1 rust-bin
# emerge -1 --onlydeps spidermonkey
# emerge -1 crossdev
# crossdev --stable -t armv6j-hardfloat-linux-gnueabi
# armv6j-hardfloat-linux-gnueabi-emerge -a1 spidermonkey

which failed with

> checking for rust target triplet...
> DEBUG: Creating `/usr/armv6j-hardfloat-linux-gnueabi/tmp/portage/dev-lang/spidermonkey-78.2.0/temp/conftesttpgnuz7f.rs`
> with content:
> DEBUG: | pub extern fn hello() { println!("Hello world"); }
> DEBUG: Executing: `/usr/bin/rustc --crate-type staticlib --target=arm-unknown-linux-gnueabihf -o /usr/armv6j-hardfloat-linux-gnueabi/tmp/portage/dev-lang/spidermonkey-78.2.0/temp/conftestr3_ywjyv.rlib /usr/armv6j-hardfloat-linux-gnueabi/tmp
> /portage/dev-lang/spidermonkey-78.2.0/temp/conftesttpgnuz7f.rs`                                                         DEBUG: The command returned non-zero exit status 1.
> DEBUG: Its error output was:
> DEBUG: | error[E0463]: can't find crate for `std`
> DEBUG: |   |
> DEBUG: |   = note: the `arm-unknown-linux-gnueabihf` target may not be installed
> DEBUG: |
> DEBUG: | error: aborting due to previous error
> DEBUG: |
> DEBUG: | For more information about this error, try `rustc --explain E0463`.
> ERROR: Cannot compile for armv6j-hardfloat-linux-gnueabi with /usr/bin/rustc
>
Comment 10 tt_1 2020-09-10 12:05:01 UTC
how to build without clang: 

grab a new amd64 stage3, untar, chroot into it. patch the spidermonkey ebuild to check for llvm instead of clang, and an emerge -av -o spidermonkey:78 should pull in cmake, nspr and icu roughly speaking and some of their dependencies like jsoncpp. spidermonkey needs llvm-objdump and makes use of it, but it doesn't need clang, no doubt about that. 

I really don't know why you think that clang is mandantory, if it isn't present on the system during src_configure of spidermonkey, it cannot find it of course, but there are no consquences. Have a look at the compressed log, it is from a fresh amd64 chroot without clang present. 

for all rust based cross compiling, please have a look at the dev-lang/rust ebuild: https://github.com/gentoo/gentoo/blob/master/dev-lang/rust/rust-1.44.1.ebuild#L303

there is something else wrong with detection of host llvm-objdump in cross compile, but I can simply hardcode the path in the ebuild locally, and maybe I can inject the command with a little env file in /etc/portage/env/, that's good enough to make it work. I would like to make this the subject of another bug, with lower priority, is that ok for you? 

p.s: the --host-root command was replaced with -b in EAPI 7, so you have already taken care of that problem in llvm-setup
Comment 11 Thomas Deutschmann (RETIRED) gentoo-dev 2020-09-20 13:58:34 UTC
> I really don't know why you think that clang is mandantory

Build system will pick up and test CLANG when found. In my case my build system is using CCACHE. To test building without CLANG I removed CLANG package but did not update CCACHE symlinks (=so I had a broken symlink for CLANG in my path). But because CLANG was still present in path, configure was checking for working CLANG, which failed because it was a broken symlink, and error message was telling me that CLANG was required but not found.
Comment 12 Larry the Git Cow gentoo-dev 2020-09-20 14:04:19 UTC
The bug has been closed via the following commit(s):

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

commit e3ea67130e44415ed7f556427d3782d661b53b01
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-09-20 14:03:06 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-09-20 14:04:05 +0000

    dev-lang/spidermonkey: clang is not needed to build spidermonkey
    
    Closes: https://bugs.gentoo.org/740890
    Closes: https://bugs.gentoo.org/743241
    Package-Manager: Portage-3.0.7, Repoman-3.0.1
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 dev-lang/spidermonkey/spidermonkey-78.2.0.ebuild | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

Additionally, it has been referenced in the following commit(s):

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

commit 95481f605297c613bbf81fbe1fbc6c66dfb36980
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-09-20 13:43:17 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-09-20 14:04:04 +0000

    dev-lang/spidermonkey: relax Rust requirement
    
    See build/moz.configure/rust.configure:rust_compiler().
    
    Bug: https://bugs.gentoo.org/740890
    Package-Manager: Portage-3.0.7, Repoman-3.0.1
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

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