servo: Compile error with mozjs_sys in macOS 10.12.6

Refer to https://github.com/servo/servo/issues/20958#issuecomment-395060590

Let me share the first error log here

I always built failed on macOS 10.12.6 with latest master (a07c718895) with ./mach build -d

error: 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:05

LLVM version

→ llvm-gcc -v
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

and in https://github.com/servo/servo/issues/20958#issuecomment-395095386, @asajeffrey asked me to try to build mozjs itself.

After cargo build the mozjs, I got same error logs

   Compiling mozjs_sys v0.51.1 (file:///Users/chengyou.bai/Documents/cybai/mozjs)
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: incorrect close delimiter: `]`
     --> /Users/chengyou.bai/Documents/cybai/mozjs/target/debug/build/mozjs_sys-c78b17b647610923/out/jsapi.rs:10722:43
      |
10722 |             # [ derive ( Copy ) ]; 1usize ] , _bindgen_union_align : u64 , }            # [ test ]
      |                                           ^
      |
note: unclosed delimiter
     --> /Users/chengyou.bai/Documents/cybai/mozjs/target/debug/build/mozjs_sys-c78b17b647610923/out/jsapi.rs:10465:24
      |
10465 |         pub mod shadow {
      |                        ^

error: unexpected close delimiter: `}`
     --> /Users/chengyou.bai/Documents/cybai/mozjs/target/debug/build/mozjs_sys-c78b17b647610923/out/jsapi.rs:11882:5
      |
11882 |     }
      |     ^

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`.

To learn more, run the command again with --verbose.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (14 by maintainers)

Most upvoted comments

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.