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'"
No, it's required now.
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?
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 >
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(-)
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....
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.
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.
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
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 >
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
> 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.
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(-)