Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build stylo in FF 56.x #1087

Closed
tpgxyz opened this issue Oct 17, 2017 · 15 comments
Closed

Can't build stylo in FF 56.x #1087

tpgxyz opened this issue Oct 17, 2017 · 15 comments

Comments

@tpgxyz
Copy link

tpgxyz commented Oct 17, 2017

rust-lang/rust#45342

Bindgen Invocation

I'm trying to build FF 56.0.1 with rust-1.21.0.

Full logs can be found here http://file-store.openmandriva.org/api/v1/file_stores/1e85cf22a732ff76c55f52625dfab10fbfcaac23.log?show=true

error: failed to run custom build command for style v0.0.1 (file:///builddir/build/BUILD/firefox-56.0.1/servo/components/style)


/builddir/build/BUILD/firefox-56.0.1/obj/dist/include/nsCSSFontFaceRule.h:137:38: warning: offset of on non-standard-layout type 'nsCSSFontFaceRule' [-Winvalid-offsetof], err: false
/builddir/build/BUILD/firefox-56.0.1/obj/dist/include/nsCSSFontFaceRule.h:144:44: warning: offset of on non-standard-layout type 'nsCSSFontFaceRule' [-Winvalid-offsetof], err: false
/builddir/build/BUILD/firefox-56.0.1/obj/dist/include/nsStyleContext.h:76:15: warning: inline function 'nsStyleContext::Release' is not defined [-Wundefined-inline], err: false
--- stderr
thread '<unnamed>' panicked at 'Non floating-type complex?', /builddir/build/BUILD/firefox-56.0.1/third_party/rust/bindgen/src/ir/context.rs:1409:25
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:60
             at src/libstd/panicking.rs:381
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:397
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:611
   5: std::panicking::begin_panic
   6: bindgen::ir::context::BindgenContext::builtin_or_resolved_ty
   7: <bindgen::ir::item::Item as bindgen::parse::ClangItemParser>::from_ty_or_ref_with_id
   8: bindgen::ir::ty::Type::from_clang_ty
   9: <bindgen::ir::item::Item as bindgen::parse::ClangItemParser>::from_ty_with_id
  10: <bindgen::ir::item::Item as bindgen::parse::ClangItemParser>::parse
  11: bindgen::clang::visit_children
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: clang_visitChildren
  17: clang_sys::clang_visitChildren
  18: bindgen::Bindings::generate
  19: bindgen::Builder::generate
  20: build_script_build::build_gecko::bindings::write_binding_file
  21: build_script_build::build_gecko::bindings::generate_bindings
  22: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:99
  23: <F as alloc::boxed::FnBox<A>>::call_box
  24: std::sys::imp::thread::Thread::new::thread_start
             at /builddir/build/BUILD/rustc-1.21.0-src/src/liballoc/boxed.rs:692
             at src/libstd/sys_common/thread.rs:21
             at src/libstd/sys/unix/thread.rs:84
  25: start_thread
  26: __GI___clone
thread '<unnamed>' panicked at 'Non floating-type complex?', /builddir/build/BUILD/firefox-56.0.1/third_party/rust/bindgen/src/ir/context.rs:1409:25
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:60
             at src/libstd/panicking.rs:381
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:397
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:611
   5: std::panicking::begin_panic
   6: bindgen::ir::context::BindgenContext::builtin_or_resolved_ty
   7: <bindgen::ir::item::Item as bindgen::parse::ClangItemParser>::from_ty_or_ref_with_id
   8: bindgen::ir::ty::Type::from_clang_ty
   9: <bindgen::ir::item::Item as bindgen::parse::ClangItemParser>::from_ty_with_id
  10: <bindgen::ir::item::Item as bindgen::parse::ClangItemParser>::parse
  11: bindgen::clang::visit_children
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: clang_visitChildren
  17: clang_sys::clang_visitChildren
  18: bindgen::clang::visit_children
  19: <unknown>
  20: <unknown>
  21: <unknown>
  22: <unknown>
  23: clang_visitChildren
  24: clang_sys::clang_visitChildren
  25: bindgen::Bindings::generate
  26: bindgen::Builder::generate
  27: build_script_build::build_gecko::bindings::write_binding_file
  28: build_script_build::build_gecko::bindings::generate_structs
  29: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:99
  30: <F as alloc::boxed::FnBox<A>>::call_box
  31: std::sys::imp::thread::Thread::new::thread_start
             at /builddir/build/BUILD/rustc-1.21.0-src/src/liballoc/boxed.rs:692
             at src/libstd/sys_common/thread.rs:21
             at src/libstd/sys/unix/thread.rs:84
  32: start_thread
  33: __GI___clone
thread '<unnamed>' panicked at 'Non floating-type complex?', /builddir/build/BUILD/firefox-56.0.1/third_party/rust/bindgen/src/ir/context.rs:1409:25
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:60
             at src/libstd/panicking.rs:381
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:397
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:611
   5: std::panicking::begin_panic
   6: bindgen::ir::context::BindgenContext::builtin_or_resolved_ty
   7: <bindgen::ir::item::Item as bindgen::parse::ClangItemParser>::from_ty_or_ref_with_id
   8: bindgen::ir::ty::Type::from_clang_ty
   9: <bindgen::ir::item::Item as bindgen::parse::ClangItemParser>::from_ty_with_id
  10: <bindgen::ir::item::Item as bindgen::parse::ClangItemParser>::parse
  11: bindgen::clang::visit_children
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: clang_visitChildren
  17: clang_sys::clang_visitChildren
  18: bindgen::clang::visit_children
  19: <unknown>
  20: <unknown>
  21: <unknown>
  22: <unknown>
  23: clang_visitChildren
  24: clang_sys::clang_visitChildren
  25: bindgen::Bindings::generate
  26: bindgen::Builder::generate
  27: build_script_build::build_gecko::bindings::write_binding_file
  28: build_script_build::build_gecko::bindings::generate_structs
  29: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:99
  30: <F as alloc::boxed::FnBox<A>>::call_box
  31: std::sys::imp::thread::Thread::new::thread_start
             at /builddir/build/BUILD/rustc-1.21.0-src/src/liballoc/boxed.rs:692
             at src/libstd/sys_common/thread.rs:21
             at src/libstd/sys/unix/thread.rs:84
  32: start_thread
  33: __GI___clone
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Any', src/libcore/result.rs:906:4
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:60
             at src/libstd/panicking.rs:381
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:397
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:611
   5: std::panicking::begin_panic
             at src/libstd/panicking.rs:572
   6: std::panicking::begin_panic_fmt
             at src/libstd/panicking.rs:522
   7: rust_begin_unwind
             at src/libstd/panicking.rs:498
   8: core::panicking::panic_fmt
             at src/libcore/panicking.rs:71
   9: core::result::unwrap_failed
  10: build_script_build::main
  11: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:99
  12: std::rt::lang_start
             at src/libstd/panicking.rs:459
             at src/libstd/panic.rs:361
             at src/libstd/rt.rs:61
  13: __libc_start_main
  14: _start
             at ../sysdeps/x86_64/start.S:120

Expected Results

Firefox compiles

@emilio
Copy link
Contributor

emilio commented Oct 17, 2017

Which version of bindgen is FF56 using?

@tpgxyz
Copy link
Author

tpgxyz commented Oct 17, 2017

@emilio In logs you can see Compiling bindgen v0.29.0

@tpgxyz
Copy link
Author

tpgxyz commented Oct 23, 2017

Ping anyone ?

@fitzgen
Copy link
Member

fitzgen commented Oct 23, 2017

Any chance you could use builder.dump_preprocessed_input() in servo's components/style/build_gecko.rs and then run creduce until we have a minimal test case? https://github.com/rust-lang-nursery/rust-bindgen/blob/master/CONTRIBUTING.md#using-creduce-to-minimize-test-cases

@tpgxyz
Copy link
Author

tpgxyz commented Oct 26, 2017

@fitzgen Sorry to say that, but i don't know rust, and all i can do is to run build in our build environement.

I can provide any debug you tell me to add to .spec file when building RPM

@tpgxyz
Copy link
Author

tpgxyz commented Jan 12, 2018

Still the same issue.
I can't compile firefox 57.x with stylo enabled.

https://abf.openmandriva.org/build_lists/145077

@emilio
Copy link
Contributor

emilio commented Jan 13, 2018

thread '' panicked at 'Non floating-type complex?', /builddir/build/BUILD/firefox-57.0.4/third_party/rust/bindgen-0.29.1/src/ir/context.rs:1409:25

That is an interesting error.

@tpgxyz which version of libclang is this? Also, can you try to build nightly from https://hg.mozilla.org/mozilla-central/? That has a more up-to-date bindgen.

@tpgxyz
Copy link
Author

tpgxyz commented Jan 13, 2018

@emilio I'm running LLVM 5.0.0

Well I want to compile officially released latest firefox not a nightly build, as my district's users does not want to experiment that much.

@emilio
Copy link
Contributor

emilio commented Jan 14, 2018

Sure, I just wanted to know whether an updated bindgen / FF version worked in the same environment, which may be helpful. In particular, there are some bugs fixed in the way bindgen interacted with system dependencies on Firefox, like https://bugzilla.mozilla.org/show_bug.cgi?id=1341234.

@tpgxyz
Copy link
Author

tpgxyz commented Jan 16, 2018

@emilio I've appiled these patches and unfortunately FF still does not build with stylo enabled.

https://abf.openmandriva.org/build_lists/145577

@emilio
Copy link
Contributor

emilio commented Jan 16, 2018

If you could apply this patch to the rust-bindgen tree it'd be helpful to figure that out.

Alternatively, applying something like the following, and getting the __bindgen.ii file from the builder would also be amazing:

diff --git a/servo/components/style/build_gecko.rs b/servo/components/style/build_gecko.rs
index 1bef36f8b289..7635f6627ef6 100644
--- a/servo/components/style/build_gecko.rs
+++ b/servo/components/style/build_gecko.rs
@@ -275,6 +275,7 @@ mod bindings {
                 return;
             }
         }
+        builder.dump_preprocessed_input().expect("Couldn't dump input");
         let command_line_opts = builder.command_line_flags();
         let result = builder.generate();
         let mut result = match result {
@@ -565,7 +566,7 @@ mod bindings {
         use std::thread;
         macro_rules! run_tasks {
             ($($task:expr,)+) => {
-                if setup_logging() {
+                if true || setup_logging() {
                     $($task;)+
                 } else {
                     let threads = vec![$( thread::spawn(|| $task) ),+];

@cris-b
Copy link
Contributor

cris-b commented Jan 17, 2018

Looks like its Float128, modifying to:

            let float_kind = match float_type.kind() {
                CXType_Float => FloatKind::Float,
                CXType_Double => FloatKind::Double,
                CXType_LongDouble => FloatKind::LongDouble,
                CXType_Float128 => FloatKind::Float128,
                _ => panic!("Non floating-type complex? {:?}, {:?}", ty, float_type),
            };

makes it build ok - i've no idea if this is correct though.

attached the file requested.
__bindgen.ii.txt

@emilio
Copy link
Contributor

emilio commented Jan 17, 2018

Yeah, that patch looks good to me. Want to submit a PR?

Tests for this live in tests/headers/complex.h, though I'm not sure we can test this one because rust still doesn't support 128-bit aligned values.

@tpgxyz
Copy link
Author

tpgxyz commented Jan 18, 2018

@cris-b Excellent catch. Many thanks for finding issue.

@emilio
Copy link
Contributor

emilio commented Jan 23, 2018

I updated bindgen with this fix on mozilla-central in https://bugzilla.mozilla.org/show_bug.cgi?id=1432134

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

No branches or pull requests

4 participants