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

Installing with cargo install fails due to semver breakage in onig_sys #65

Closed
1 of 6 tasks
barskern opened this issue Aug 9, 2019 · 7 comments · Fixed by #67
Closed
1 of 6 tasks

Installing with cargo install fails due to semver breakage in onig_sys #65

barskern opened this issue Aug 9, 2019 · 7 comments · Fixed by #67

Comments

@barskern
Copy link

barskern commented Aug 9, 2019

Problem

When using cargo install cargo-expand the compilation fails due to a semver-breaking release of onig_sys. This does not happen when building the repo using cargo build. This is due to Cargo.lock being pinned to a non-breaking version of onig_sys. cargo install doesn't seem to take the lock-file into account when installing it directly from crates.io.

Error message on compilation

$ cargo install cargo-expand
    Updating crates.io index
  Installing cargo-expand v0.4.12
   Compiling proc-macro2 v0.4.30
   Compiling unicode-xid v0.1.0
   Compiling libc v0.2.60
   Compiling syn v0.15.43
   Compiling cc v1.0.38
   Compiling memchr v2.2.1
   Compiling version_check v0.1.5
   Compiling failure_derive v0.1.5
   Compiling log v0.4.8
   Compiling rustc-demangle v0.1.15
   Compiling lazy_static v1.3.0
   Compiling byteorder v1.3.2
   Compiling cfg-if v0.1.9
   Compiling bitflags v1.1.0
   Compiling glob v0.3.0
   Compiling regex-syntax v0.6.11
   Compiling quick-error v1.2.2
   Compiling unicode-width v0.1.5
   Compiling strsim v0.8.0
   Compiling bindgen v0.50.0
   Compiling ansi_term v0.11.0
   Compiling vec_map v0.8.1
   Compiling termcolor v1.0.5
   Compiling semver-parser v0.7.0
   Compiling shlex v0.1.1
   Compiling peeking_take_while v0.1.2
   Compiling strsim v0.7.0
   Compiling pkg-config v0.3.15
   Compiling fnv v1.0.6
   Compiling ident_case v1.0.1
   Compiling autocfg v0.1.5
   Compiling crc32fast v1.2.0
   Compiling ryu v1.0.0
   Compiling serde v1.0.98
   Compiling safemem v0.3.1
   Compiling ppv-lite86 v0.2.5
   Compiling scopeguard v1.0.0
   Compiling smallvec v0.6.10
   Compiling encoding_index_tests v0.1.4
   Compiling itoa v0.4.4
   Compiling linked-hash-map v0.5.2
   Compiling unicode-segmentation v1.3.0
   Compiling derive_builder v0.7.2
   Compiling xml-rs v0.8.0
   Compiling same-file v1.0.5
   Compiling lazycell v1.2.1
   Compiling shell-words v0.1.0
   Compiling remove_dir_all v0.5.2
   Compiling thread_local v0.3.6
   Compiling nom v4.2.3
   Compiling error-chain v0.12.1
   Compiling humantime v1.2.0
   Compiling textwrap v0.11.0
   Compiling clang-sys v0.28.1
   Compiling backtrace-sys v0.1.31
   Compiling libloading v0.5.2
   Compiling miniz-sys v0.1.12
   Compiling ansi_colours v1.0.1
   Compiling semver v0.9.0
   Compiling bincode v1.1.4
   Compiling line-wrap v0.1.1
   Compiling lock_api v0.3.1
   Compiling encoding-index-singlebyte v1.20141219.5
   Compiling encoding-index-tradchinese v1.20141219.5
   Compiling encoding-index-japanese v1.20141219.5
   Compiling encoding-index-korean v1.20141219.5
   Compiling encoding-index-simpchinese v1.20141219.5
   Compiling c2-chacha v0.2.2
   Compiling yaml-rust v0.4.3
   Compiling walkdir v2.2.9
   Compiling heck v0.3.1
   Compiling rustc_version v0.2.3
   Compiling encoding v0.2.33
   Compiling atty v0.2.13
   Compiling getrandom v0.1.8
   Compiling termios v0.3.1
   Compiling clicolors-control v1.0.0
   Compiling dirs v1.0.5
   Compiling directories v1.0.2
   Compiling aho-corasick v0.7.6
   Compiling content_inspector v0.2.4
   Compiling fxhash v0.2.1
   Compiling base64 v0.10.1
   Compiling quote v0.6.13
   Compiling clap v2.33.0
   Compiling parking_lot_core v0.6.2
   Compiling parking_lot v0.9.0
   Compiling rand_core v0.5.0
   Compiling backtrace v0.3.34
   Compiling flate2 v1.0.9
   Compiling cexpr v0.3.5
   Compiling rand_chacha v0.2.1
   Compiling regex v1.2.1
   Compiling rand v0.7.0
   Compiling tempfile v3.1.0
   Compiling env_logger v0.6.2
   Compiling console v0.7.7
   Compiling toolchain_find v0.1.4
   Compiling synstructure v0.10.2
   Compiling darling_core v0.9.0
   Compiling serde_derive v1.0.98
   Compiling structopt-derive v0.2.18
   Compiling syn-select v0.1.4
   Compiling structopt v0.2.18
   Compiling failure v0.1.5
   Compiling which v2.0.1
   Compiling darling_macro v0.9.0
   Compiling plist v0.4.2
   Compiling serde_json v1.0.40
   Compiling toml v0.5.1
   Compiling darling v0.9.0
   Compiling derive_builder_core v0.5.0
   Compiling onig_sys v69.2.0
   Compiling onig v4.3.2
error[E0412]: cannot find type `OnigRegexMut` in module `onig_sys`
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/lib.rs:142:20
    |
142 |     raw: onig_sys::OnigRegexMut,
    |                    ^^^^^^^^^^^^ help: a type alias with a similar name exists: `OnigRegex`

error[E0412]: cannot find type `OnigRegexMut` in module `onig_sys`
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/lib.rs:320:32
    |
320 |         let mut reg: onig_sys::OnigRegexMut = null_mut();
    |                                ^^^^^^^^^^^^ help: a type alias with a similar name exists: `OnigRegex`

error[E0412]: cannot find type `OnigRegexMut` in module `onig_sys`
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/lib.rs:321:50
    |
321 |         let reg_ptr = &mut reg as *mut onig_sys::OnigRegexMut;
    |                                                  ^^^^^^^^^^^^ help: a type alias with a similar name exists: `OnigRegex`

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/lib.rs:326:18
    |
326 |             enc: null(),
    |                  ^^^^^^ types differ in mutability
    |
    = note: expected type `*mut onig_sys::OnigEncodingTypeST`
               found type `*const _`

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/lib.rs:327:18
    |
327 |             par: null(),
    |                  ^^^^^^ types differ in mutability
    |
    = note: expected type `*mut u8`
               found type `*const _`

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/lib.rs:328:22
    |
328 |             par_end: null(),
    |                      ^^^^^^ types differ in mutability
    |
    = note: expected type `*mut u8`
               found type `*const _`

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/lib.rs:341:17
    |
341 |                 syntax as *const Syntax as *const onig_sys::OnigSyntaxType,
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability
    |
    = note: expected type `*mut onig_sys::OnigSyntaxType`
               found type `*const onig_sys::OnigSyntaxType`

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/lib.rs:346:19
    |
346 |         if err == onig_sys::ONIG_NORMAL {
    |                   ^^^^^^^^^^^^^^^^^^^^^ expected i32, found u32
help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit
    |
346 |         if err == onig_sys::ONIG_NORMAL.try_into().unwrap() {
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/lib.rs:515:17
    |
515 |                 match_param.as_raw()
    |                 ^^^^^^^^^^^^^^^^^^^^ types differ in mutability
    |
    = note: expected type `*mut onig_sys::OnigMatchParamStruct`
               found type `*const onig_sys::OnigMatchParamStruct`

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/lib.rs:704:17
    |
704 |                 match_param.as_raw()
    |                 ^^^^^^^^^^^^^^^^^^^^ types differ in mutability
    |
    = note: expected type `*mut onig_sys::OnigMatchParamStruct`
               found type `*const onig_sys::OnigMatchParamStruct`

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/find.rs:182:17
    |
182 |                 scan_cb::<F>,
    |                 ^^^^^^^^^^^^ expected enum `std::option::Option`, found fn item
    |
    = note: expected type `std::option::Option<unsafe extern "C" fn(i32, i32, *mut onig_sys::re_registers, *mut std::ffi::c_void) -> i32>`
               found type `extern "C" fn(i32, i32, *const onig_sys::re_registers, *mut std::ffi::c_void) -> i32 {find::<impl Regex>::scan_with_region::scan_cb::<F>}`

error[E0308]: mismatched types
  --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/region.rs:24:22
   |
24 |                 beg: null(),
   |                      ^^^^^^ types differ in mutability
   |
   = note: expected type `*mut i32`
              found type `*const _`

error[E0308]: mismatched types
  --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/region.rs:25:22
   |
25 |                 end: null(),
   |                      ^^^^^^ types differ in mutability
   |
   = note: expected type `*mut i32`
              found type `*const _`

error[E0308]: mismatched types
  --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/region.rs:26:31
   |
26 |                 history_root: null(),
   |                               ^^^^^^ types differ in mutability
   |
   = note: expected type `*mut onig_sys::OnigCaptureTreeNodeStruct`
              found type `*const _`

error[E0308]: mismatched types
  --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/region.rs:53:57
   |
53 |             onig_sys::onig_region_copy(&mut region.raw, ptr);
   |                                                         ^^^ types differ in mutability
   |
   = note: expected type `*mut onig_sys::re_registers`
              found type `*const onig_sys::re_registers`

error[E0308]: mismatched types
  --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/region.rs:84:17
   |
84 |         if r != onig_sys::ONIG_NORMAL {
   |                 ^^^^^^^^^^^^^^^^^^^^^ expected i32, found u32
help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit
   |
84 |         if r != onig_sys::ONIG_NORMAL.try_into().unwrap() {
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/region.rs:131:61
    |
131 |         let tree = unsafe { onig_sys::onig_get_capture_tree(&self.raw) };
    |                                                             ^^^^^^^^^ types differ in mutability
    |
    = note: expected type `*mut onig_sys::re_registers`
               found type `&onig_sys::re_registers`

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/region.rs:191:17
    |
191 |                 &self.raw,
    |                 ^^^^^^^^^ types differ in mutability
    |
    = note: expected type `*mut onig_sys::re_registers`
               found type `&onig_sys::re_registers`

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/region.rs:193:17
    |
193 |                 traverse_cb::<F>,
    |                 ^^^^^^^^^^^^^^^^
    |                 |
    |                 expected enum `std::option::Option`, found fn item
    |                 help: try using a variant of the expected type: `Some(traverse_cb::<F>)`
    |
    = note: expected type `std::option::Option<unsafe extern "C" fn(i32, i32, i32, i32, i32, *mut std::ffi::c_void) -> i32>`
               found type `extern "C" fn(i32, i32, i32, i32, i32, *mut std::ffi::c_void) -> i32 {region::Region::tree_traverse_at::traverse_cb::<F>}`

error[E0308]: mismatched types
  --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/match_param.rs:30:17
   |
30 |                 limit as c_uint
   |                 ^^^^^^^^^^^^^^^
   |                 |
   |                 expected u64, found u32
   |                 help: you can convert an `u32` to `u64`: `(limit as c_uint).into()`

error[E0308]: mismatched types
  --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/names.rs:64:17
   |
64 |                 foreach_cb::<F>,
   |                 ^^^^^^^^^^^^^^^ expected enum `std::option::Option`, found fn item
   |
   = note: expected type `std::option::Option<unsafe extern "C" fn(*const u8, *const u8, i32, *mut i32, *mut onig_sys::re_pattern_buffer, *mut std::ffi::c_void) -> i32>`
              found type `extern "C" fn(*const u8, *const u8, i32, *const i32, *mut onig_sys::re_pattern_buffer, *mut std::ffi::c_void) -> i32 {names::<impl Regex>::foreach_name::foreach_cb::<F>}`

error[E0308]: mismatched types
  --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/syntax.rs:99:51
   |
99 |             let op = onig_sys::onig_get_syntax_op(&self.raw);
   |                                                   ^^^^^^^^^ types differ in mutability
   |
   = note: expected type `*mut onig_sys::OnigSyntaxType`
              found type `&onig_sys::OnigSyntaxType`

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/syntax.rs:100:53
    |
100 |             let op2 = onig_sys::onig_get_syntax_op2(&self.raw);
    |                                                     ^^^^^^^^^ types differ in mutability
    |
    = note: expected type `*mut onig_sys::OnigSyntaxType`
               found type `&onig_sys::OnigSyntaxType`

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/syntax.rs:135:88
    |
135 |         SyntaxBehavior::from_bits_truncate(unsafe { onig_sys::onig_get_syntax_behavior(&self.raw) })
    |                                                                                        ^^^^^^^^^ types differ in mutability
    |
    = note: expected type `*mut onig_sys::OnigSyntaxType`
               found type `&onig_sys::OnigSyntaxType`

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/syntax.rs:160:85
    |
160 |         RegexOptions::from_bits_truncate(unsafe { onig_sys::onig_get_syntax_options(&self.raw) })
    |                                                                                     ^^^^^^^^^ types differ in mutability
    |
    = note: expected type `*mut onig_sys::OnigSyntaxType`
               found type `&onig_sys::OnigSyntaxType`

error[E0308]: mismatched types
  --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/utils.rs:37:77
   |
37 |         unsafe { onig_sys::onig_unicode_define_user_property(name.as_ptr(), raw_ranges.as_ptr()) };
   |                                                                             ^^^^^^^^^^^^^^^^^^^ types differ in mutability
   |
   = note: expected type `*mut u32`
              found type `*const u32`

error[E0308]: mismatched types
  --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/buffers.rs:28:18
   |
27 |     fn encoding(&self) -> onig_sys::OnigEncoding {
   |                           ---------------------- expected `*mut onig_sys::OnigEncodingTypeST` because of return type
28 |         unsafe { &onig_sys::OnigEncodingUTF8 }
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability
   |
   = note: expected type `*mut onig_sys::OnigEncodingTypeST`
              found type `&onig_sys::OnigEncodingTypeST`

error[E0308]: mismatched types
  --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/buffers.rs:97:27
   |
97 |             enc: unsafe { &onig_sys::OnigEncodingASCII },
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability
   |
   = note: expected type `*mut onig_sys::OnigEncodingTypeST`
              found type `&onig_sys::OnigEncodingTypeST`

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/flags.rs:263:13
    |
263 |             onig_sys::ONIG_TRAVERSE_CALLBACK_AT_FIRST;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found u32

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/flags.rs:266:13
    |
266 |             onig_sys::ONIG_TRAVERSE_CALLBACK_AT_LAST;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found u32

error[E0308]: mismatched types
   --> /home/oruud/.local/share/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/onig-4.3.2/src/flags.rs:269:13
    |
269 |             onig_sys::ONIG_TRAVERSE_CALLBACK_AT_BOTH;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found u32

error: aborting due to 31 previous errors

Some errors have detailed explanations: E0308, E0412.
For more information about an error, try `rustc --explain E0308`.
error: failed to compile `cargo-expand v0.4.12`, intermediate artifacts can be found at `/tmp/cargo-installgfq3Mf`

Caused by:
  Could not compile `onig`.

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

Solution

Workaround

As mentionned in the introduction, one can still install this directly from the repo because then the Cargo.lock file is honored. However one has to use cargo build --release and then copy the resulting binary into a folder in the $PATH.

@dtolnay dtolnay pinned this issue Aug 9, 2019
@dtolnay
Copy link
Owner

dtolnay commented Aug 9, 2019

FYI @trishume -- would it be possible to cut a syntect release?

@trishume
Copy link

@dtolnay done, published as v3.2.1

@dtolnay dtolnay unpinned this issue Aug 10, 2019
@dtolnay
Copy link
Owner

dtolnay commented Aug 10, 2019

Thanks! Looks like that did the trick, cargo install cargo-expand works again.

@dtolnay dtolnay closed this as completed Aug 10, 2019
@gxtaillon
Copy link

gxtaillon commented Aug 14, 2019

Hi, rust newbie here, not sure if this is related, but on Centos 7, cargo can't install v0.4.13 as it fails to compile onig_sys

cargo:warning=couldn't execute llvm-config --prefix (error: No such file or directory (os error 2))
cargo:warning=set the LLVM_CONFIG_PATH environment variable to a valid llvm-config executable

Output of cargo install cargo-expand

cargo install cargo-expand
    Updating crates.io index
  Downloaded cargo-expand v0.4.13
  Downloaded 1 crate (24.9 KB) in 1.00s
  Installing cargo-expand v0.4.13
  Downloaded syn v0.15.44
  Downloaded structopt v0.2.18
  Downloaded serde v1.0.98
  Downloaded tempfile v3.1.0
  Downloaded toml v0.5.3
  Downloaded libc v0.2.61
  Downloaded toolchain_find v0.1.4
  Downloaded serde_derive v1.0.98
  Downloaded syn-select v0.1.4
  Downloaded structopt-derive v0.2.18
  Downloaded remove_dir_all v0.5.2
  Downloaded dirs v1.0.5
  Downloaded heck v0.3.1
  Downloaded unicode-segmentation v1.3.0
  Downloaded prettyprint v0.7.0
  Downloaded console v0.7.7
  Downloaded error-chain v0.12.1
  Downloaded derive_builder v0.7.2
  Downloaded syntect v3.2.1
  Downloaded shell-words v0.1.0
  Downloaded clicolors-control v1.0.0
  Downloaded darling v0.9.0
  Downloaded ansi_colours v1.0.1
  Downloaded cc v1.0.40
  Downloaded derive_builder_core v0.5.0
  Downloaded content_inspector v0.2.4
  Downloaded bincode v1.1.4
  Downloaded onig v5.0.0
  Downloaded directories v1.0.2
  Downloaded darling_macro v0.9.0
  Downloaded darling_core v0.9.0
  Downloaded yaml-rust v0.4.3
  Downloaded autocfg v0.1.5
  Downloaded strsim v0.7.0
  Downloaded ident_case v1.0.1
  Downloaded rustc-demangle v0.1.16
  Downloaded plist v0.4.2
  Downloaded onig_sys v69.2.0
  Downloaded line-wrap v0.1.1
  Downloaded bindgen v0.50.0
  Downloaded safemem v0.3.1
  Downloaded cexpr v0.3.5
  Downloaded clang-sys v0.28.1
  Downloaded fxhash v0.2.1
  Downloaded peeking_take_while v0.1.2
  Downloaded shlex v0.1.1
  Downloaded glob v0.3.0
  Downloaded which v2.0.1
  Downloaded libloading v0.5.2
  Downloaded nom v4.2.3
   Compiling proc-macro2 v0.4.30
   Compiling unicode-xid v0.1.0
   Compiling libc v0.2.61
   Compiling cc v1.0.40
   Compiling syn v0.15.44
   Compiling memchr v2.2.1
   Compiling failure_derive v0.1.5
   Compiling version_check v0.1.5
   Compiling cfg-if v0.1.9
   Compiling glob v0.3.0
   Compiling lazy_static v1.3.0
   Compiling rustc-demangle v0.1.16
   Compiling log v0.4.8
   Compiling byteorder v1.3.2
   Compiling bitflags v1.1.0
   Compiling unicode-width v0.1.5
   Compiling quick-error v1.2.2
   Compiling regex-syntax v0.6.11
   Compiling semver-parser v0.7.0
   Compiling termcolor v1.0.5
   Compiling vec_map v0.8.1
   Compiling ansi_term v0.11.0
   Compiling bindgen v0.50.0
   Compiling strsim v0.8.0
   Compiling peeking_take_while v0.1.2
   Compiling shlex v0.1.1
   Compiling ident_case v1.0.1
   Compiling strsim v0.7.0
   Compiling fnv v1.0.6
   Compiling pkg-config v0.3.15
   Compiling ryu v1.0.0
   Compiling autocfg v0.1.5
   Compiling crc32fast v1.2.0
   Compiling serde v1.0.98
   Compiling safemem v0.3.1
   Compiling scopeguard v1.0.0
   Compiling smallvec v0.6.10
   Compiling ppv-lite86 v0.2.5
   Compiling itoa v0.4.4
   Compiling linked-hash-map v0.5.2
   Compiling unicode-segmentation v1.3.0
   Compiling xml-rs v0.8.0
   Compiling derive_builder v0.7.2
   Compiling encoding_index_tests v0.1.4
   Compiling same-file v1.0.5
   Compiling lazycell v1.2.1
   Compiling remove_dir_all v0.5.2
   Compiling shell-words v0.1.0
   Compiling nom v4.2.3
   Compiling error-chain v0.12.1
   Compiling clang-sys v0.28.1
   Compiling thread_local v0.3.6
   Compiling backtrace-sys v0.1.31
   Compiling libloading v0.5.2
   Compiling miniz-sys v0.1.12
   Compiling ansi_colours v1.0.1
   Compiling textwrap v0.11.0
   Compiling humantime v1.2.0
   Compiling semver v0.9.0
   Compiling bincode v1.1.4
   Compiling line-wrap v0.1.1
   Compiling lock_api v0.3.1
   Compiling yaml-rust v0.4.3
   Compiling c2-chacha v0.2.2
   Compiling heck v0.3.1
   Compiling encoding-index-korean v1.20141219.5
   Compiling encoding-index-tradchinese v1.20141219.5
   Compiling encoding-index-japanese v1.20141219.5
   Compiling encoding-index-simpchinese v1.20141219.5
   Compiling encoding-index-singlebyte v1.20141219.5
   Compiling walkdir v2.2.9
   Compiling rustc_version v0.2.3
   Compiling encoding v0.2.33
   Compiling atty v0.2.13
   Compiling getrandom v0.1.8
   Compiling termios v0.3.1
   Compiling clicolors-control v1.0.0
   Compiling dirs v1.0.5
   Compiling directories v1.0.2
   Compiling aho-corasick v0.7.6
   Compiling content_inspector v0.2.4
   Compiling quote v0.6.13
   Compiling fxhash v0.2.1
   Compiling base64 v0.10.1
   Compiling parking_lot_core v0.6.2
   Compiling parking_lot v0.9.0
   Compiling clap v2.33.0
   Compiling rand_core v0.5.0
   Compiling cexpr v0.3.5
   Compiling backtrace v0.3.34
   Compiling regex v1.2.1
   Compiling flate2 v1.0.9
   Compiling rand_chacha v0.2.1
   Compiling synstructure v0.10.2
   Compiling darling_core v0.9.0
   Compiling serde_derive v1.0.98
   Compiling structopt-derive v0.2.18
   Compiling syn-select v0.1.4
   Compiling rand v0.7.0
   Compiling env_logger v0.6.2
   Compiling toolchain_find v0.1.4
   Compiling darling_macro v0.9.0
   Compiling structopt v0.2.18
   Compiling tempfile v3.1.0
   Compiling failure v0.1.5
   Compiling darling v0.9.0
   Compiling console v0.7.7
   Compiling plist v0.4.2
   Compiling serde_json v1.0.40
   Compiling toml v0.5.3
   Compiling derive_builder_core v0.5.0
   Compiling which v2.0.1
   Compiling onig_sys v69.2.0
error: failed to compile `cargo-expand v0.4.13`, intermediate artifacts can be found at `/tmp/cargo-installzGaFBZ`

Caused by:
  failed to run custom build command for `onig_sys v69.2.0`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installzGaFBZ/release/build/onig_sys-abfbb900b7dd5e84/build-script-build` (exit code: 101)
--- stdout
cargo:warning=couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
cargo:warning=set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable

--- stderr
thread 'main' panicked at 'Unable to find libclang: "the `libclang` shared library at /usr/lib64/clang-private/libclang.so.6.0 could not be opened: libclangAST.so.6: cannot open shared object file: No such file or directory"', src/libcore/result.rs:999:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

Like @barskern I managed to install expand 0.4.12 from source since its onig_sys is pinned on v69.1.0.

Install steps

    git clone https://github.com/dtolnay/cargo-expand.git
    cd cargo-expand
    git checkout 0.4.12
    cargo check # onig_sys must be on v69.1.0
    cargo build
    cargo install --locked

However I could not for 0.4.13 as its pinned on v69.2.0, nor 0.4.12 from crates.io as I can't find a way to pin the version of onig_sys (might be related to rust-lang/cargo#2263).

See rust-onig/rust-onig#109

@LauH1987
Copy link

I still get this error:

error: failed to run custom build command for `onig_sys v69.2.0`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installosjMY5/release/build/onig_sys-fb70de60a02474fa/build-script-build` (exit code: 101)
--- stdout
cargo:warning=couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
cargo:warning=set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable

--- 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:999:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-expand v0.4.13`, intermediate artifacts can be found at `/tmp/cargo-installosjMY5`

@dtolnay
Copy link
Owner

dtolnay commented Aug 20, 2019

@LauH1987 could you try installing cargo-expand 0.4.14? I ended up pinning some deps to avoid that problematic version of onig_sys.

The real fix for this would be trishume/syntect#12. 🙏

@LauH1987
Copy link

Success. Thanks you for fixing this so quickly!

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

Successfully merging a pull request may close this issue.

5 participants