Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upCompile error with mozjs_sys in macOS 10.12.6 #20971
Comments
|
@asajeffrey Here's the gist which I built |
|
@CYBAI hmm, that gist doesn't show jsapi.rs being generated. Can you remove jsapi.rs and re-run? |
|
@asajeffrey ohh, ok, let me remove it and re-run it. |
|
@asajeffrey Updated the gist but the log looks similar to previous version. |
|
@emilio: this is odd, bindgen is producing a syntactically invalid .rs file, have you seen this before? |
|
@CYBAI can you give us a snippet of /Users/chengyou.bai/Documents/cybai/mozjs/target/debug/build/mozjs_sys-c78b17b647610923/out/jsapi.rs, say about 20 lines before and after line 10722? |
|
I'm building on macOS 10.12.6 without any problems, as a point of reference. |
|
@asajeffrey Here's line 10654 to line 10762 for the # [ test ]
fn bindgen_test_layout_Function() {
assert_eq!(::std::mem::size_of::<Function>(),
64usize,
concat!("Size of: ", stringify!(Function)));
assert_eq!(::std::mem::align_of::<Function>(),
8usize,
concat!("Alignment of ", stringify!(Function)));
assert_eq!(unsafe {
&(*(::std::ptr::null::<Function>())).base as *const _ as usize
},
0usize,
concat!("Offset of field: ",
stringify!(Function),
"::",
stringify!(base)));
assert_eq!(unsafe {
&(*(::std::ptr::null::<Function>())).nargs as *const _ as usize
},
32usize,
concat!("Offset of field: ",
stringify!(Function),
"::",
stringify!(nargs)));
assert_eq!(unsafe {
&(*(::std::ptr::null::<Function>())).flags as *const _ as usize
},
34usize,
concat!("Offset of field: ",
stringify!(Function),
"::",
stringify!(flags)));
assert_eq!(unsafe {
&(*(::std::ptr::null::<Function>())).native as *const _ as usize
},
40usize,
concat!("Offset of field: ",
stringify!(Function),
"::",
stringify!(native)));
assert_eq!(unsafe {
&(*(::std::ptr::null::<Function>())).jitinfo as *const _ as usize
},
48usize,
concat!("Offset of field: ",
stringify!(Function),
"::",
stringify!(jitinfo)));
assert_eq!(unsafe { &(*(::std::ptr::null::<Function>()))._1 as *const _ as usize },
56usize,
concat!("Offset of field: ",
stringify!(Function),
"::",
stringify!(_1)));
}
impl Clone for Function {
fn clone(&self) -> Self {
*self
}
}
# [ repr ( C ) ]
# [ derive ( Copy ) ]
pub struct String {
pub flags: u32,
pub length: u32,
pub __bindgen_anon_1: root::js::shadow::String__bindgen_ty_1,
}
# [ repr ( C ) ]
# [ derive ( Copy ) ]; 1usize ] , _bindgen_union_align : u64 , } # [ test ]
fn bindgen_test_layout_String__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<String__bindgen_ty_1>(),
8usize,
concat!("Size of: ", stringify!(String__bindgen_ty_1)));
assert_eq!(::std::mem::align_of::<String__bindgen_ty_1>(),
8usize,
concat!("Alignment of ", stringify!(String__bindgen_ty_1)));
assert_eq!(unsafe {
& ( * ( :: std :: ptr :: null :: < String__bindgen_ty_1 > ( ) ) ) . nonInlineCharsLatin1 as * const _ as usize
},
0usize,
concat!("Offset of field: ",
stringify!(String__bindgen_ty_1),
"::",
stringify!(nonInlineCharsLatin1)));
assert_eq!(unsafe {
& ( * ( :: std :: ptr :: null :: < String__bindgen_ty_1 > ( ) ) ) . nonInlineCharsTwoByte as * const _ as usize
},
0usize,
concat!("Offset of field: ",
stringify!(String__bindgen_ty_1),
"::",
stringify!(nonInlineCharsTwoByte)));
assert_eq!(unsafe {
& ( * ( :: std :: ptr :: null :: < String__bindgen_ty_1 > ( ) ) ) . inlineStorageLatin1 as * const _ as usize
},
0usize,
concat!("Offset of field: ",
stringify!(String__bindgen_ty_1),
"::",
stringify!(inlineStorageLatin1)));
assert_eq!(unsafe {
& ( * ( :: std :: ptr :: null :: < String__bindgen_ty_1 > ( ) ) ) . inlineStorageTwoByte as * const _ as usize
},
0usize,
concat!("Offset of field: ",
stringify!(String__bindgen_ty_1),
"::",
stringify!(inlineStorageTwoByte)));
} |
|
The matching snippet from my jsapi,rs is: ...
# [ repr ( C ) ]
# [ derive ( Copy ) ]
pub struct String {
pub flags : u32 ,
pub length : u32 ,
pub __bindgen_anon_1 : root::js::shadow::String__bindgen_ty_1 ,
}
# [ repr ( C ) ]
# [ derive ( Copy ) ]
pub union String__bindgen_ty_1 {
pub nonInlineCharsLatin1 : * const root::JS::Latin1Char ,
pub nonInlineCharsTwoByte : * const u16 ,
pub inlineStorageLatin1 : [ root::JS::Latin1Char ; 1usize ] ,
pub inlineStorageTwoByte : [ u16 ; 1usize ] ,
_bindgen_union_align : u64 ,
}
# [ test ]
fn bindgen_test_layout_String__bindgen_ty_1 ( ) {
...For some reason, most of |
|
I'm also building servo fine on my MacOS 10.12.6. |
|
Hello, |
|
Yes, as @SughiY mentioned. I can solve the issue by doing following commands $ cargo uninstall rustfmt
$ rustup component add rustfmt-preview |
|
Yes, that's a rustfmt version problem. According to fitzgen, there's a line we can add to the rustfmt config file giving the minimum version. This won't fix the problem, but at least the error message will be understandable. |
|
Any updates on the same? I am running rustfmt 0.8.2-nightly (5e599251 2018-07-02), rustc 1.29.0-nightly (1ecf6929d 2018-07-16) and it is giving me the same error. |
|
@gaurikholkar Did you follow #20971 (comment)? |
|
Yes @jdm but it's still giving me an error |
|
I think this is no longer an issue. |
Refer to #20958 (comment)
Let me share the first error log here
I always built failed on
macOS 10.12.6with latest master (a07c718) with./mach build -derror: incorrect close delimiter: `]` --> /Users/chengyou.bai/Documents/cybai/servo/target/debug/build/mozjs_sys-d4d4cc1e26ce451a/out/jsapi.rs:10722:43 | 10722 | # [ derive ( Copy ) ]; 1usize ] , _bindgen_union_align : u64 , } # [ test ] | ^ | note: unclosed delimiter --> /Users/chengyou.bai/Documents/cybai/servo/target/debug/build/mozjs_sys-d4d4cc1e26ce451a/out/jsapi.rs:10465:24 | 10465 | pub mod shadow { | ^ error: unexpected close delimiter: `}` --> /Users/chengyou.bai/Documents/cybai/servo/target/debug/build/mozjs_sys-d4d4cc1e26ce451a/out/jsapi.rs:11882:5 | 11882 | } | ^ error: aborting due to 2 previous errors The following warnings were emitted during compilation: warning: In file included from src/jsglue.cpp:7: warning: src/jsglue.hpp:86:16: warning: private field 'argv_' is not used [-Wunused-private-field] warning: JS::Value* argv_; warning: ^ warning: src/jsglue.hpp:87:14: warning: private field 'argc_' is not used [-Wunused-private-field] warning: unsigned argc_; warning: ^ warning: src/jsglue.hpp:88:10: warning: private field 'constructing_' is not used [-Wunused-private-field] warning: bool constructing_:1; warning: ^ warning: src/jsglue.hpp:89:10: warning: private field 'ignoresReturnValue_' is not used [-Wunused-private-field] warning: bool ignoresReturnValue_:1; warning: ^ warning: 4 warnings generated. error: Could not compile `mozjs_sys`. warning: build failed, waiting for other jobs to finish... error: build failed Build FAILED in 0:22:05LLVM version
and in #20958 (comment), @asajeffrey asked me to try to build
mozjsitself.After
cargo buildthemozjs, I got same error logs