emk/subtitles-rs

Can't compile substudy

Arthaey opened this issue · 20 comments

I'm trying to update substudy and get it running again after a long time not using it. It used to work! On this same laptop, even, but before I'd upgraded to El Capitan.

I'm on a Mac (El Capitan 10.11.5). I ran multirust update stable and brew install cmake ffmpeg to make sure those dependencies were all up to date. No issues there.

But whether I run cargo install substudy or cargo build, I get the same error message:

/Users/arthaey/.multirust/toolchains/stable/cargo/registry/src/github.com-1ecc6299db9ec823/substudy-0.4.0/src/video.rs:13:20: 13:25 warning: unused import, #[warn(unused_imports)] on by default
/Users/arthaey/.multirust/toolchains/stable/cargo/registry/src/github.com-1ecc6299db9ec823/substudy-0.4.0/src/video.rs:13 use err::{err_str, Error, Result};
                                                                                                                                               ^~~~~
error: linking with `cc` failed: exit code: 1
note: "cc" "-m64" [snip verbose options]
note: Undefined symbols for architecture x86_64:
[snip stacktrace]
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error
error: failed to compile `substudy v0.4.0`, intermediate artifacts can be found at `/var/folders/j0/8d669w252655xfzfrfhnsgjc0000gn/T/cargo-install.qUrb7Re5e91W`

Running with --verbose didn't give any more useful output.

emk commented

Oh, my mistake. I misinterpreted your bug report. The part we need is the list of undefined symbols that should appear somewhere after Undefined symbols for architecture x86_64.

Here's the full stacktrace:

note: Undefined symbols for architecture x86_64:
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)", referenced from:
      CLD2::OffsetMap::Flush() in libcld2_sys-c8fccb75f7561a7e.rlib(offsetmap.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::erase(unsigned long, unsigned long)", referenced from:
      CLD2::GetLangTagsFromHtml(char const*, int, int) in libcld2_sys-c8fccb75f7561a7e.rlib(compact_lang_det_hint_code.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*)", referenced from:
      CLD2::DumpCLDLangPriors(CLD2::CLDLangPriors const*) in libcld2_sys-c8fccb75f7561a7e.rlib(compact_lang_det_hint_code.o)
      CLD2::GetQuadAt(char const*) in libcld2_sys-c8fccb75f7561a7e.rlib(debug.o)
      CLD2::GetOctaAt(char const*) in libcld2_sys-c8fccb75f7561a7e.rlib(debug.o)
      CLD2::FmtLP(CLD2::ULScript, unsigned char, unsigned char) in libcld2_sys-c8fccb75f7561a7e.rlib(debug.o)
      CLD2::GetLangProbTxt(CLD2::ScoringContext const*, unsigned int) in libcld2_sys-c8fccb75f7561a7e.rlib(debug.o)
      CLD2::GetPlainEscapedText(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libcld2_sys-c8fccb75f7561a7e.rlib(debug.o)
      CLD2::GetHtmlEscapedText(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libcld2_sys-c8fccb75f7561a7e.rlib(debug.o)
      ...
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find(char, unsigned long) const", referenced from:
      CLD2::SetCLDLangTagsHint(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, CLD2::CLDLangPriors*) in libcld2_sys-c8fccb75f7561a7e.rlib(compact_lang_det_hint_code.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(unsigned long, char)", referenced from:
      CLD2::CopyOneQuotedString(char const*, int, int) in libcld2_sys-c8fccb75f7561a7e.rlib(compact_lang_det_hint_code.o)
      CLD2::GetPlainEscapedText(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libcld2_sys-c8fccb75f7561a7e.rlib(debug.o)
      CLD2::GetHtmlEscapedText(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libcld2_sys-c8fccb75f7561a7e.rlib(debug.o)
  "std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
      CLD2::ApplyHints(char const*, int, bool, CLD2::CLDHints const*, CLD2::ScoringContext*) in libcld2_sys-c8fccb75f7561a7e.rlib(compact_lang_det_impl.o)
      std::__1::vector<CLD2::ResultChunk, std::__1::allocator<CLD2::ResultChunk> >::__append(unsigned long) in libcld2_sys-c8fccb75f7561a7e.rlib(compact_lang_det_impl.o)
      void std::__1::vector<CLD2::ResultChunk, std::__1::allocator<CLD2::ResultChunk> >::__push_back_slow_path<CLD2::ResultChunk const>(CLD2::ResultChunk const&) in libcld2_sys-c8fccb75f7561a7e.rlib(scoreonescriptspan.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
      _uchardet_new in libuchardet_sys-63d797502cafb5ca.rlib(uchardet.cpp.o)
      HandleUniversalDetector::~HandleUniversalDetector() in libuchardet_sys-63d797502cafb5ca.rlib(uchardet.cpp.o)
      HandleUniversalDetector::~HandleUniversalDetector() in libuchardet_sys-63d797502cafb5ca.rlib(uchardet.cpp.o)
      CLD2::ApplyHints(char const*, int, bool, CLD2::CLDHints const*, CLD2::ScoringContext*) in libcld2_sys-c8fccb75f7561a7e.rlib(compact_lang_det_impl.o)
      CLD2::DetectLanguageSummaryV2(char const*, int, bool, CLD2::CLDHints const*, bool, int, CLD2::Language, CLD2::Language*, int*, double*, std::__1::vector<CLD2::ResultChunk, std::__1::allocator<CLD2::ResultChunk> >*, int*, bool*) in libcld2_sys-c8fccb75f7561a7e.rlib(compact_lang_det_impl.o)
      CLD2::CopyOneQuotedString(char const*, int, int) in libcld2_sys-c8fccb75f7561a7e.rlib(compact_lang_det_hint_code.o)
      CLD2::SetCLDContentLangHint(char const*, CLD2::CLDLangPriors*) in libcld2_sys-c8fccb75f7561a7e.rlib(compact_lang_det_hint_code.o)
      ...
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::assign(char const*)", referenced from:
      _uchardet_new in libuchardet_sys-63d797502cafb5ca.rlib(uchardet.cpp.o)
      HandleUniversalDetector::Report(char const*) in libuchardet_sys-63d797502cafb5ca.rlib(uchardet.cpp.o)
      HandleUniversalDetector::Reset() in libuchardet_sys-63d797502cafb5ca.rlib(uchardet.cpp.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      CLD2::CLD2_Debug(char const*, int, int, bool, bool, CLD2::ScoringHitBuffer const*, CLD2::ScoringContext const*, CLD2::ChunkSpan const*, CLD2::ChunkSummary const*) in libcld2_sys-c8fccb75f7561a7e.rlib(debug.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*, unsigned long)", referenced from:
      CLD2::GetLangTagsFromHtml(char const*, int, int) in libcld2_sys-c8fccb75f7561a7e.rlib(compact_lang_det_hint_code.o)
      CLD2::GetQuadAt(char const*) in libcld2_sys-c8fccb75f7561a7e.rlib(debug.o)
      CLD2::GetOctaAt(char const*) in libcld2_sys-c8fccb75f7561a7e.rlib(debug.o)
      CLD2::GetLangProbTxt(CLD2::ScoringContext const*, unsigned int) in libcld2_sys-c8fccb75f7561a7e.rlib(debug.o)
      CLD2::CLD2_Debug(char const*, int, int, bool, bool, CLD2::ScoringHitBuffer const*, CLD2::ScoringContext const*, CLD2::ChunkSpan const*, CLD2::ChunkSummary const*) in libcld2_sys-c8fccb75f7561a7e.rlib(debug.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:
      CLD2::DetectLanguageSummaryV2(char const*, int, bool, CLD2::CLDHints const*, bool, int, CLD2::Language, CLD2::Language*, int*, double*, std::__1::vector<CLD2::ResultChunk, std::__1::allocator<CLD2::ResultChunk> >*, int*, bool*) in libcld2_sys-c8fccb75f7561a7e.rlib(compact_lang_det_impl.o)
      CLD2::CopyQuotedString(char const*, int, int) in libcld2_sys-c8fccb75f7561a7e.rlib(compact_lang_det_hint_code.o)
      CLD2::CLD2_Debug(char const*, int, int, bool, bool, CLD2::ScoringHitBuffer const*, CLD2::ScoringContext const*, CLD2::ChunkSpan const*, CLD2::ChunkSummary const*) in libcld2_sys-c8fccb75f7561a7e.rlib(debug.o)
      CLD2::BetterBoundary(char const*, CLD2::ScoringHitBuffer*, CLD2::ScoringContext*, unsigned char, unsigned char, int, int, int) in libcld2_sys-c8fccb75f7561a7e.rlib(scoreonescriptspan.o)
      CLD2::ScoreOneScriptSpan(CLD2::LangSpan const&, CLD2::ScoringContext*, CLD2::DocTote*, std::__1::vector<CLD2::ResultChunk, std::__1::allocator<CLD2::ResultChunk> >*) in libcld2_sys-c8fccb75f7561a7e.rlib(scoreonescriptspan.o)
ld: symbol(s) not found for architecture x86_64

Any ideas?

emk commented

Sorry for the slow response. This appears to be a problem with the Rust
cld2 bindings, which I also wrote, and how they get linked on a Mac. Could
be related to your C++ compiler somehow.

I don't have access to a Mac, so this may be tricky for me to solve. I'll
try to reproduce this on Linux when I get a chance.

Le 10 sept. 2016 12:56 PM, "Arthaey Angosii" notifications@github.com a
écrit :

Any ideas?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#5 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AACQY1AGB3tWBJWEMkxq_CrYUg8xPIQuks5qouE3gaJpZM4J1Nad
.

No worries about the slow response; I'm totally getting the support that I am paying for. ;)

Let me know if you're game for a remote-debugging session (chat or screen-sharing) to see if we can figure out what's the deal with the Mac setup?

A coworker of mine who knows Rust suggests that you distribute cross-piled binaries. Is that something you could do?

emk commented

Unfortunately, cross-compiling for the Mac is tricky, because you need various Apple headers that aren't freely redistributable, I think. Maybe he has a tutorial somewhere?

I do compile MacOS X binaries for some of my programs using Travis CI, but occasionally they don't work, and I have no way to debug them without help from some kind soul who wants to share a screen with me.

emk commented

OK, it turns out that this was an Xcode 8 compatibility issue affecting my Rust cld2 bindings.

I've fixed this issue (and some Windows build issues) and made a pre-release version of substudy. If you have a moment, could you please test this for me by running:

cargo install --vers 0.4.1-pre.1 substudy

If you don't have a reasonably up-to-date Rust installation, see https://www.rustup.rs/ for instructions. Thank you for the bug report and for any feedback you can provide!

   Compiling cmake v0.1.21
error: attributes on non-item statements and expressions are experimental. (see issue #15701)
   --> /Users/arthaey/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.21/src/lib.rs:400:21
    |
400 |                     #[cfg(windows)] {
    |                     ^^^^^^^^^^^^^^
    |
    = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable

error: aborting due to previous error
emk commented

Does that mean there's nothing either of us can do about it?

emk commented

We may need to run cargo update or upgrade the version of cmake in Cargo.toml.

I ran cargo update, which seemed to be successful, but cargo install --vers 0.4.1-pre.1 substudy still fails with the same cfg(windows) error on my Mac.

I don't see any mention of "cmake" in Cargo.toml, so I don't know how to upgrade the version number, nor to what version it should be upgraded. (FWIW, the version installed on my machine is cmake 3.5.2.)

Below is the output of cargo update, in case it's helpful to you:

$ cargo update
    Updating registry `https://github.com/rust-lang/crates.io-index`
    Removing advapi32-sys v0.1.2
    Updating aho-corasick v0.3.4 -> v0.5.3
    Updating byteorder v0.3.13 -> v0.5.3
    Updating csv v0.14.3 -> v0.14.7
    Updating docopt v0.6.76 -> v0.6.86
    Updating encoding v0.2.32 -> v0.2.33
    Updating env_logger v0.3.2 -> v0.3.5
    Updating gcc v0.3.20 -> v0.3.43
      Adding kernel32-sys v0.2.2
    Removing lazy_static v0.1.15
      Adding lazy_static v0.1.16
      Adding lazy_static v0.2.4
    Removing libc v0.1.12
    Removing libc v0.2.2
      Adding libc v0.2.21
    Updating log v0.3.3 -> v0.3.6
    Updating memchr v0.1.7 -> v0.1.11
    Updating num v0.1.28 -> v0.1.37
      Adding num-bigint v0.1.36
      Adding num-complex v0.1.36
      Adding num-integer v0.1.33
      Adding num-iter v0.1.33
      Adding num-rational v0.1.36
      Adding num-traits v0.1.37
    Updating pkg-config v0.3.6 -> v0.3.9
    Updating rand v0.3.12 -> v0.3.15
    Updating regex v0.1.41 -> v0.1.80
    Updating regex-syntax v0.2.2 -> v0.3.9
    Updating rustc-serialize v0.3.16 -> v0.3.22
    Updating strsim v0.3.0 -> v0.5.2
      Adding thread-id v2.0.0
      Adding thread_local v0.2.7
    Updating toml v0.1.24 -> v0.1.30
      Adding utf8-ranges v0.1.3
    Updating winapi v0.2.5 -> v0.2.8
emk commented

I know you're busy, so I'm not expecting a resolution on any sort of "schedule". But I wanted to bump this issue again, so you know there's still Mac interest out there. ;)

emk commented

Ah, thank you! Have you tried again lately? I updated a whole bunch of the dependencies of substudy sometime within the last couple of months, and there were Mac build fixes in there, IIRC. I really ought to get out my Mac and check. Maybe after the Super Challenge bot is back online. :-/

Yeah, I tried again before bumping the thread. :(

Specifically, I ran cargo update, cargo install --vers 0.4.1-pre.1 substudy, and also cargo install substudy. Same error as before.

emk commented

Try just cargo install -f substudy; the 0.4.1-pre.1 is older and doesn't have all the build fixes that are in the final 0.4.1. It should build with either XCode 7.3 or 8, as you can see here.

So tonight I decided to run through all the installation steps again. It involved re-installing Rust, plus upgrading cmake and ffmpeg.

And.... :drumroll:

   Compiling substudy v0.4.1
    Finished release [optimized] target(s) in 134.46 secs
  Installing /Users/cmrodgers/.cargo/bin/substudy

:D

Not sure if any of the upgrades were what made the difference, or if the stars were just aligned today, or what. But I'm not complaining. :)

emk commented

Whoooo!