Closed Bug 1566738 Opened 6 years ago Closed 6 years ago

Building with --enable-release fails due to cargo:rerun-if-changed=baldrapi.h failing

Categories

(Core :: JavaScript: WebAssembly, defect, P2)

x86_64
Linux
defect

Tracking

()

RESOLVED DUPLICATE of bug 1413234

People

(Reporter: lth, Unassigned)

Details

Attachments

(1 file)

When I configure a SpiderMonkey build with --enable-release, compilation fails. I've had this problem since I learned about --enable-release, on both Linux and Mac. STR:

mozilla-inbound changeset: 482946:8fd4efa75b55, no local changes at all
./mach bootstrap
-- my setup is vanilla, except I do not enable evolve or jslint in my hg setup
cd js/src
mkdir build-test
cd build-test
../configure --enable-release --disable-debug --enable-optimize
make -j16

After a while, this happens:

   Compiling baldrdash v0.1.0 (/home/lhansen/m-i/js/src/wasm/cranelift)
     Running `CARGO_PKG_DESCRIPTION= CARGO_MANIFEST_DIR=/home/lhansen/m-i/js/src/wasm/cranelift CARGO_PKG_REPOSITORY= CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PRE= LD_LIBRARY_PATH='/home/lhansen/m-i/js/src/build-test/release/deps:/home/lhansen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib' CARGO_PKG_AUTHORS='The Spidermonkey and Cranelift developers' CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_HOMEPAGE= CARGO_PKG_VERSION=0.1.0 CARGO=/home/lhansen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo CARGO_PKG_NAME=baldrdash CARGO_PKG_VERSION_PATCH=0 /home/lhansen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --edition=2018 --crate-name build_script_build js/src/wasm/cranelift/build.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=2 -C codegen-units=1 --cfg 'feature="cranelift-codegen"' --cfg 'feature="cranelift_x86"' --cfg 'feature="default"' -C metadata=8a3031f095eb0188 -C extra-filename=-8a3031f095eb0188 --out-dir /home/lhansen/m-i/js/src/build-test/release/build/baldrdash-8a3031f095eb0188 -C linker=/home/lhansen/m-i/build/cargo-linker -L dependency=/home/lhansen/m-i/js/src/build-test/release/deps --extern bindgen=/home/lhansen/m-i/js/src/build-test/release/deps/libbindgen-c9ae9390e6fcf870.rlib -L native=/home/lhansen/m-i/js/src/build-test/release/build/libloading-27d87000166d8009/out`
     Running `/home/lhansen/m-i/js/src/build-test/release/build/baldrdash-8a3031f095eb0188/build-script-build`
[baldrdash 0.1.0] cargo:rerun-if-changed=baldrapi.h
[baldrdash 0.1.0] cargo:rerun-if-changed=/home/lhansen/m-i/js/src/build-test/js/src/rust/extra-bindgen-flags
[baldrdash 0.1.0] thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'libclang.so\', \'libclang-*.so\', \'libclang.so.*\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', src/libcore/result.rs:997:5
[baldrdash 0.1.0] stack backtrace:
[baldrdash 0.1.0]    0:     0x5597f4f7f6d3 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h50ebfb8734a81144
[baldrdash 0.1.0]                                at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
[baldrdash 0.1.0]    1:     0x5597f4f7ad3b - std::sys_common::backtrace::_print::hc7fdae4fb6b58d2d
[baldrdash 0.1.0]                                at src/libstd/sys_common/backtrace.rs:71
[baldrdash 0.1.0]    2:     0x5597f4f7e356 - std::panicking::default_hook::{{closure}}::hc55d0892611a29ff
[baldrdash 0.1.0]                                at src/libstd/sys_common/backtrace.rs:59
[baldrdash 0.1.0]                                at src/libstd/panicking.rs:197
[baldrdash 0.1.0]    3:     0x5597f4f7e0e9 - std::panicking::default_hook::h3c8a3df5d3469668
[baldrdash 0.1.0]                                at src/libstd/panicking.rs:211
[baldrdash 0.1.0]    4:     0x5597f4f7ea5f - std::panicking::rust_panic_with_hook::h24c9a1c35b1f49cc
[baldrdash 0.1.0]                                at src/libstd/panicking.rs:474
[baldrdash 0.1.0]    5:     0x5597f4f7e5e1 - std::panicking::continue_panic_fmt::h8ed9632bdd4b9299
[baldrdash 0.1.0]                                at src/libstd/panicking.rs:381
[baldrdash 0.1.0]    6:     0x5597f4f7e4c5 - rust_begin_unwind
[baldrdash 0.1.0]                                at src/libstd/panicking.rs:308
[baldrdash 0.1.0]    7:     0x5597f4f99c0c - core::panicking::panic_fmt::h0d6d5c8b201e3246
[baldrdash 0.1.0]                                at src/libcore/panicking.rs:85
[baldrdash 0.1.0]    8:     0x5597f4e088d8 - core::result::unwrap_failed::h126eef3a3ba1f914
[baldrdash 0.1.0]    9:     0x5597f4dfc3bc - std::sync::once::Once::call_once::{{closure}}::h0d9e06a1c43357f5
[baldrdash 0.1.0]   10:     0x5597f4f7a0e5 - std::sync::once::Once::call_inner::h7e00c900570c98f3
[baldrdash 0.1.0]                                at src/libstd/sync/once.rs:387
[baldrdash 0.1.0]   11:     0x5597f4e941a0 - bindgen::Builder::generate::h73a50a228ebb7270
[baldrdash 0.1.0]   12:     0x5597f4df1072 - build_script_build::main::hacdd388b26266e77
[baldrdash 0.1.0]   13:     0x5597f4ded6e2 - std::rt::lang_start::{{closure}}::h3d6d123d4720583a
[baldrdash 0.1.0]   14:     0x5597f4f7e462 - std::panicking::try::do_call::h3310fc9f30c8962f
[baldrdash 0.1.0]                                at src/libstd/rt.rs:49
[baldrdash 0.1.0]                                at src/libstd/panicking.rs:293
[baldrdash 0.1.0]   15:     0x5597f4f86499 - __rust_maybe_catch_panic
[baldrdash 0.1.0]                                at src/libpanic_unwind/lib.rs:87
[baldrdash 0.1.0]   16:     0x5597f4f7f02c - std::rt::lang_start_internal::h66306a4a4a80131b
[baldrdash 0.1.0]                                at src/libstd/panicking.rs:272
[baldrdash 0.1.0]                                at src/libstd/panic.rs:388
[baldrdash 0.1.0]                                at src/libstd/rt.rs:48
[baldrdash 0.1.0]   17:     0x5597f4df1741 - main
[baldrdash 0.1.0]   18:     0x7ff47b0a4f32 - __libc_start_main
[baldrdash 0.1.0]   19:     0x5597f4ded21d - _start
[baldrdash 0.1.0]   20:                0x0 - <unknown>
error: failed to run custom build command for `baldrdash v0.1.0 (/home/lhansen/m-i/js/src/wasm/cranelift)`
process didn't exit successfully: `/home/lhansen/m-i/js/src/build-test/release/build/baldrdash-8a3031f095eb0188/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-changed=baldrapi.h
cargo:rerun-if-changed=/home/lhansen/m-i/js/src/build-test/js/src/rust/extra-bindgen-flags

--- stderr
thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'libclang.so\', \'libclang-*.so\', \'libclang.so.*\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', src/libcore/result.rs:997:5
stack backtrace:
   0:     0x5597f4f7f6d3 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h50ebfb8734a81144
                               at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1:     0x5597f4f7ad3b - std::sys_common::backtrace::_print::hc7fdae4fb6b58d2d
                               at src/libstd/sys_common/backtrace.rs:71
   2:     0x5597f4f7e356 - std::panicking::default_hook::{{closure}}::hc55d0892611a29ff
                               at src/libstd/sys_common/backtrace.rs:59
                               at src/libstd/panicking.rs:197
   3:     0x5597f4f7e0e9 - std::panicking::default_hook::h3c8a3df5d3469668
                               at src/libstd/panicking.rs:211
   4:     0x5597f4f7ea5f - std::panicking::rust_panic_with_hook::h24c9a1c35b1f49cc
                               at src/libstd/panicking.rs:474
   5:     0x5597f4f7e5e1 - std::panicking::continue_panic_fmt::h8ed9632bdd4b9299
                               at src/libstd/panicking.rs:381
   6:     0x5597f4f7e4c5 - rust_begin_unwind
                               at src/libstd/panicking.rs:308
   7:     0x5597f4f99c0c - core::panicking::panic_fmt::h0d6d5c8b201e3246
                               at src/libcore/panicking.rs:85
   8:     0x5597f4e088d8 - core::result::unwrap_failed::h126eef3a3ba1f914
   9:     0x5597f4dfc3bc - std::sync::once::Once::call_once::{{closure}}::h0d9e06a1c43357f5
  10:     0x5597f4f7a0e5 - std::sync::once::Once::call_inner::h7e00c900570c98f3
                               at src/libstd/sync/once.rs:387
  11:     0x5597f4e941a0 - bindgen::Builder::generate::h73a50a228ebb7270
  12:     0x5597f4df1072 - build_script_build::main::hacdd388b26266e77
  13:     0x5597f4ded6e2 - std::rt::lang_start::{{closure}}::h3d6d123d4720583a
  14:     0x5597f4f7e462 - std::panicking::try::do_call::h3310fc9f30c8962f
                               at src/libstd/rt.rs:49
                               at src/libstd/panicking.rs:293
  15:     0x5597f4f86499 - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:87
  16:     0x5597f4f7f02c - std::rt::lang_start_internal::h66306a4a4a80131b
                               at src/libstd/panicking.rs:272
                               at src/libstd/panic.rs:388
                               at src/libstd/rt.rs:48
  17:     0x5597f4df1741 - main
  18:     0x7ff47b0a4f32 - __libc_start_main
  19:     0x5597f4ded21d - _start
  20:                0x0 - <unknown>

warning: build failed, waiting for other jobs to finish...
error: build failed
make[3]: *** [/home/lhansen/m-i/config/makefiles/rust.mk:241: force-cargo-library-build] Error 101
make[3]: Leaving directory '/home/lhansen/m-i/js/src/build-test/js/src/rust'
make[2]: *** [/home/lhansen/m-i/config/recurse.mk:74: js/src/rust/target] Error 2
make[2]: Leaving directory '/home/lhansen/m-i/js/src/build-test'
make[1]: *** [/home/lhansen/m-i/config/recurse.mk:34: compile] Error 2
make[1]: Leaving directory '/home/lhansen/m-i/js/src/build-test'
make: *** [/home/lhansen/m-i/config/rules.mk:391: default] Error 2

LIBCLANG_PATH is not normally set on my system. libclang is available -- it is in ~/.mozbuild/clang/lib/libclang.so, for example.

Adding a LIBCLANG_PATH does not help; the error message is the same. I assume the setting gets overridden somewhere.

nbp notes that he does not see this problem; lth notes that nbp configures with --with-libclang-path=... and --with-clang-path=..., like so:

/home/nicolas/mozilla/wksp-5/js/src/configure --prefix=/home/nicolas/mozilla/_inst/js/cranelift-test/x64/gcc/oopt --disable-jemalloc --enable-valgrind --with-libclang-path=/nix/store/0ah0a1v6vhpqi2srmx82ahj8nx7afz9h-clang-7.1.0-lib/lib --with-clang-path=/nix/store/vs6hi8dv468fw5xid4xm4zdq9ragmfg7-clang-wrapper-7.1.0/bin/clang --enable-nspr-build --enable-jitspew --enable-ctypes --enable-oom-breakpoint --enable-debug-symbols=-ggdb3 --disable-debug --enable-optimize --enable-release --enable-warnings-as-errors --disable-tests --enable-build-backends=CompileDB,FasterMake,RecursiveMake

Nathan/Mike, any ideas about what's going on here? I seem to recall the libclang location was set by the build system at some point...

Flags: needinfo?(nfroyd)
Flags: needinfo?(mh+mozilla)

Do your builds fail without --enable-release? (I'm assuming they work, but asking for completeness.)

Can you post the $OBJDIR/config.log and $OBJDIR/js/src/rust/extra-bindgen-flags files?

Flags: needinfo?(nfroyd) → needinfo?(lhansen)

config.status would be useful too.

Flags: needinfo?(mh+mozilla)

(Requested info forthcoming, any day now.)

Priority: -- → P2
Attached file bug1566738-files.tar

The requested files.

Building without --enable-release works just fine (though the resulting performance is very poor). I can develop, but not benchmark or profile.

Flags: needinfo?(lhansen) → needinfo?(nfroyd)

Your config.log says:

INFO: checking for clang for bindgen... 
INFO: /usr/lib64/ccache/clang++
INFO: checking for libclang for bindgen... 
DEBUG: Executing: `/usr/lib64/ccache/clang++ -print-search-dirs`
DEBUG: Trying "libclang.so" in "/usr/lib64"
DEBUG: Trying "libclang.so.1" in "/usr/lib64"
INFO: not found
INFO: checking bindgen cflags... 
INFO: -x c++ -fno-sized-deallocation -DTRACING=1 -DIMPL_LIBXUL -DMOZILLA_INTERNAL_API -DRUST_BINDGEN -DOS_POSIX=1 -DOS_LINUX=1

What clang is /usr/lib64/ccache/clang++ actually using under the hood? What does /usr/lib64/ccache/clang++ -print-search-dirs actually print out?

Flags: needinfo?(nfroyd) → needinfo?(lhansen)

I guess there is a libclang.so.<some number> in /usr/lib64? That would make this a dupe of bug 1557030/bug 1413234.

I guess there is a libclang.so.<some number> in /usr/lib64? That would make this a dupe of bug 1557030/bug 1413234.

Indeed there is:

$ ls /usr/lib64/libclang.*
/usr/lib64/libclang.so.8

What does /usr/lib64/ccache/clang++ -print-search-dirs actually print out?

Well, based on your comments above I removed clang and clang++, so that only prints an error now.

But with the system clang and clang++ removed, the build works, which is what I wanted... If I do need clang and clang++ for other things, I can add .mozbuild/clang/bin to my PATH I think, so I'm set. Going to dup this one.

Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(lhansen)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: