Servo style doesn't seem to compile in Nightly with external nspr #17869

Open
eclipseo opened this Issue Jul 26, 2017 · 20 comments

Comments

Projects
None yet
7 participants

eclipseo commented Jul 26, 2017

Build log: https://copr-be.cloud.fedoraproject.org/results/eclipseo/firefox-nightly/fedora-rawhide-x86_64/00583654-firefox-nightly/build.log.gz

The build fails when servo style fails to compile because it doesn't find nspr files: /objdir/dist/include/nsISupportsImpl.h:17:10: fatal error: 'prthread.h' file not found

i am using --with-system-nspr and it seems to me that it's similar to that older bug https://hg.mozilla.org/mozilla-central/rev/5a85d47b5642

I think https://github.com/servo/servo/blob/master/components/style/build_gecko.rs look for include files for the provided nspr, but not if one uses --with-system-nspr.

eclipseo commented Jul 26, 2017

I manually added PathBuf::from("/usr/include/nspr4"), to SEARCH_PATHS https://github.com/servo/servo/blob/master/components/style/build_gecko.rs#L121
and then style compiled successfully. So it's indeed this bug I was facing.

build_gecko.rs should probably fetch that path from env::var("NSPR_CFLAGS")? I know nothing about Rust, so just guessing here.

@eclipseo eclipseo changed the title from Servo style doesn't seem to compile in Nighlty with external nspr to Servo style doesn't seem to compile in Nightly with external nspr Jul 26, 2017

Member

emilio commented Jul 26, 2017

Hmm... Yeah, I wonder if we could have a more reliable way to get the include paths from Gecko... Maybe @froydnj or @rillian know a better way to do this stuff :-)

Contributor

rillian commented Jul 26, 2017

Try setting BINDGEN_CFLAGS=-I/usr/include/nspr4 at configure time. That's munged into $objdir/layout/style/bindgen.toml which build_gecko.rs reads.

If that works, we just have to figure out how to get NSPR_CFLAGS appended to BINDGEN_CFLAGS internally.

@rillian I've just added ac_add_options BINDGEN_CFLAGS=$(pkg-config nspr --cflags) to mozconfig and servo style built correctly. It worked as you said, -I/usr/include/nspr4 was added to $objdir/layout/style/bindgen.toml and it was picked up by build_gecko.rs

Thank you for your help.

Contributor

rillian commented Jul 26, 2017

Thanks for confirming. I filed a gecko bug about propagating the cflags automatically.

eclipseo commented Jul 26, 2017

@rillian I don't know if it's linked to this change but now I have an error, exclusively on arch i386. x86_64 compiles fine.

error: failed to run custom build command for style v0.0.1 (file:///builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/servo/components/style) process didn't exit successfully: /builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/objdir/toolkit/library/release/build/style-485cd254b6293f93/build-script-build (signal: 11, SIGSEGV: invalid memory reference)

Log file: https://copr-be.cloud.fedoraproject.org/results/eclipseo/firefox-nightly/fedora-rawhide-i386/00583762-firefox-nightly/build.log.gz

It's maybe an unrelated new bug though.

Contributor

rillian commented Jul 26, 2017

Which llvm are you building with? We've had some trouble with libclang < 4.0.1 crashing on the bindgen input. Can you rebuild with RUST_BACKTRACE=1 or otherwise get a stack trace?

I'm sorry but despite running with export RUST_BACKTRACE=1, it didn't output anything else. I don't really know how to proceed to get a detailed stack trace.

I was building in 3 platforms:

  • Fedora 25 i386 with clang-libs 3.9.1
  • Fedora 26 i386 with clang-libs 4.0.0
  • Fedora rawhhide i386 with clang-libs 4.0.1

Even with clang-libs 4.0.1, it fails.

Contributor

rillian commented Jul 27, 2017

Ok, might be a different bug then. I never tracked down the cause of the crashes, just upgraded and the problem went away.

If RUST_BACKTRACE=1 didn't work, I'd build with ./mach build --verbose (I think that turns into V=1 on the make command line) to get the full build-script-build invocation, and then run the same command manually under gdb.

I hope this is the right stuff because I'm not super-duper familiar with debugging and gdb:

Starting program: /builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/objdir/toolkit/library/release/build/style-485cd254b6293f93/build-script-build 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
cargo:rerun-if-changed=build.rs
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: NotPresent', src/libcore/result.rs:859
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::_print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic
   6: std::panicking::begin_panic_fmt
   7: rust_begin_unwind
   8: core::panicking::panic_fmt
   9: core::result::unwrap_failed
  10: build_script_build::main
  11: std::panicking::try::do_call
  12: __rust_maybe_catch_panic
  13: std::rt::lang_start
  14: main
  15: __libc_start_main
  16: <unknown>
[Inferior 1 (process 812) exited with code 0145]
Member

emilio commented Jul 29, 2017

eclipseo commented Jul 29, 2017

I have my environment set up:

env RUSTFLAGS=' -C debuginfo=2 ' CARGO_TARGET_DIR=/builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/objdir/toolkit/library RUSTC=/usr/bin/rustc MOZ_SRC=/builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d MOZ_DIST=/builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/objdir/dist LIBCLANG_PATH="/usr/lib" CLANG_PATH="/usr/bin/clang" PKG_CONFIG_ALLOW_CROSS=1 RUST_BACKTRACE=1 MOZ_TOPOBJDIR=/builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/objdir MOZ_CARGO_WRAP_LDFLAGS="-lpthread -Wl,-z,noexecstack -Wl,-z,text -Wl,--build-id -Wl,-rpath-link,/builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/objdir/dist/bin -Wl,-rpath-link,/usr/lib" MOZ_CARGO_WRAP_LD=" /usr/bin/gcc -std=gnu99" CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER=/builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/build/cargo-linker

I run gdb /usr/bin/cargo

I run it with the full arguments:
run build --release --manifest-path /builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/toolkit/library/rust/Cargo.toml --lib --target=i686-unknown-linux-gnu --features "servo bindgen quantum_render cubeb_pulse_rust no-static-ideograph-encoder-tables"

I get to my error:

Starting program: /usr/bin/cargo build --release  --manifest-path /builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/toolkit/library/rust/Cargo.toml --lib --target=i686-unknown-linux-gnu --features "servo bindgen quantum_render cubeb_pulse_rust no-static-ideograph-encoder-tables"
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]
[New process 56]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
process 56 is executing new program: /usr/bin/rustc
warning: Missing auto-load script at offset 0 in section .debug_gdb_scripts
of file /usr/bin/rustc.
Use `info auto-load python-scripts [REGEXP]' to list them.
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]
[New Thread 0xf3820b40 (LWP 57)]
[Thread 0xf3820b40 (LWP 57) exited]
[Inferior 2 (process 56) exited normally]
(gdb)    Compiling style v0.0.1 (file:///builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/servo/components/style)
error: failed to run custom build command for `style v0.0.1 (file:///builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/servo/components/style)`
process didn't exit successfully: `/builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/objdir/toolkit/library/release/build/style-e8997e07bfee593d/build-script-build` (exit code: 1)
--- stdout
cargo:rerun-if-changed=build.rs
cargo:out_dir=/builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/objdir/toolkit/library/i686-unknown-linux-gnu/release/build/style-d8a785823cf2e4dd/out
cargo:rerun-if-changed=properties/Mako-0.9.1.zip
cargo:rerun-if-changed=properties/build.py
cargo:rerun-if-changed=properties/computed_value_flags.rs
cargo:rerun-if-changed=properties/data.py
cargo:rerun-if-changed=properties/declaration_block.rs
cargo:rerun-if-changed=properties/gecko.mako.rs
cargo:rerun-if-changed=properties/helpers.mako.rs
cargo:rerun-if-changed=properties/helpers/animated_properties.mako.rs
cargo:rerun-if-changed=properties/longhand/background.mako.rs
cargo:rerun-if-changed=properties/longhand/border.mako.rs
cargo:rerun-if-changed=properties/longhand/box.mako.rs
cargo:rerun-if-changed=properties/longhand/color.mako.rs
cargo:rerun-if-changed=properties/longhand/column.mako.rs
cargo:rerun-if-changed=properties/longhand/counters.mako.rs
cargo:rerun-if-changed=properties/longhand/effects.mako.rs
cargo:rerun-if-changed=properties/longhand/font.mako.rs
cargo:rerun-if-changed=properties/longhand/inherited_box.mako.rs
cargo:rerun-if-changed=properties/longhand/inherited_svg.mako.rs
cargo:rerun-if-changed=properties/longhand/inherited_table.mako.rs
cargo:rerun-if-changed=properties/longhand/inherited_text.mako.rs
cargo:rerun-if-changed=properties/longhand/list.mako.rs
cargo:rerun-if-changed=properties/longhand/margin.mako.rs
cargo:rerun-if-changed=properties/longhand/outline.mako.rs
cargo:rerun-if-changed=properties/longhand/padding.mako.rs
cargo:rerun-if-changed=properties/longhand/pointing.mako.rs
cargo:rerun-if-changed=properties/longhand/position.mako.rs
cargo:rerun-if-changed=properties/longhand/svg.mako.rs
cargo:rerun-if-changed=properties/longhand/table.mako.rs
cargo:rerun-if-changed=properties/longhand/text.mako.rs
cargo:rerun-if-changed=properties/longhand/ui.mako.rs
cargo:rerun-if-changed=properties/longhand/xul.mako.rs
cargo:rerun-if-changed=properties/properties.html.mako
cargo:rerun-if-changed=properties/properties.mako.rs
cargo:rerun-if-changed=properties/shorthand/background.mako.rs
cargo:rerun-if-changed=properties/shorthand/border.mako.rs
cargo:rerun-if-changed=properties/shorthand/box.mako.rs
cargo:rerun-if-changed=properties/shorthand/column.mako.rs
cargo:rerun-if-changed=properties/shorthand/font.mako.rs
cargo:rerun-if-changed=properties/shorthand/inherited_svg.mako.rs
cargo:rerun-if-changed=properties/shorthand/inherited_text.mako.rs
cargo:rerun-if-changed=properties/shorthand/list.mako.rs
cargo:rerun-if-changed=properties/shorthand/margin.mako.rs
cargo:rerun-if-changed=properties/shorthand/mask.mako.rs
cargo:rerun-if-changed=properties/shorthand/outline.mako.rs
cargo:rerun-if-changed=properties/shorthand/padding.mako.rs
cargo:rerun-if-changed=properties/shorthand/position.mako.rs
cargo:rerun-if-changed=properties/shorthand/serialize.mako.rs
cargo:rerun-if-changed=properties/shorthand/text.mako.rs

--- stderr
python2.7: can't open file 'builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/servo/components/style/properties/build.py': [Errno 2] No such file or directory

The backtrace is empty:

bt
No stack.

I don't really know what to do afterwards. It seems it's a child process that exits with an error but I'm not sure how to get a trace for it.

Also I don't know what to make of the python error: the file is indeed there:

ll /builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/servo/components/style/properties/build.py
-rw-r--r--. 1 mockbuild mockbuild 3355 Jul 26 04:04 /builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/servo/components/style/properties/build.py
Contributor

rillian commented Jul 29, 2017

I don't think the python failure is the actual error. It's this line:

process didn't exit successfully: `/builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/objdir/toolkit/library/release/build/style-e8997e07bfee593d/build-script-build` (exit code: 1)

That's the subprocess you want to trace under gdb. I don't know how to get to it through the cargo invocation either (set a conditional breakpoint of in the cargo code where it spawns job processes, I guess). But you should be able to launch the build command itself under gdb.

$ gdb /builddir/build/BUILD/gecko-dev-65bbd0525acd0a981c3811b11e23cb057a06373d/objdir/toolkit/library/release/build/style-e8997e07bfee593d/build-script-build

The environment may not be exactly right, but if you do it from the same directory after seeing the full build fail, there's a good chance you'll get something.

Hope that helps!

@rillian That's what I did initially at comment #17869 (comment)

I also get the following error when building firefox on an mips64 machine :
llvm 3.9.1; rustc1.21.0
Compiling style v0.0.1 (file:///home/loongson/firefox/github/gecko-dev/servo/components/style)
error: failed to run custom build command for style v0.0.1 (file:///home/loongson/firefox/github/gecko-dev/servo/components/style)
process didn't exit successfully: /home/loongson/firefox/github/gecko-dev/obj-mips64el-unknown-linux-gnu/toolkit/library/release/build/style-e3f98f1bb8f069ec/build-script-build (signal: 10, SIGBUS: access to undefined memory)

Member

jdm commented Oct 31, 2017

That looks like there's an error running bindgen on that cpu. Try building with STYLO_BUILD_LOG=/tmp/log; that log file will contain more clues about what's going wrong.

Contributor

rillian commented Oct 31, 2017

FWIW, I've seen that error with bindgen on top of llvm 3.9.1. You might try 4.0.1 or later.

pshpsh commented Nov 14, 2017

Not only nspr, pixman too.
pkg-config --cflags nspr pixman-1 | xargs

after i upgrade llvm to llvm4.0.1. the problem still exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment