jkcoxson / rusty_libimobiledevice

A Rust wrapper for Libimobiledevice
MIT License
44 stars 19 forks source link

Error building on OSX #5

Closed woelper closed 1 year ago

woelper commented 1 year ago

First of all, thanks for this promising library! I am trying to compile a static library, and using the vendored feature, I receive an error when I build. The issue seems to be in the buildscript, as configure can't be found:

running: "sh" "-c" "exec \"$0\" \"$@\"" "/Users/johann/repos/libimobiledevice_test/target/debug/build/plist_plus-35e4f5876a87ed45/out/libplist/configure" "--prefix=/Users/johann/repos/libimobiledevice_test/target/debug/build/plist_plus-35e4f5876a87ed45/out" "--disable-shared" "--enable-static" "--without-cython"
  --- stderr
  /Users/johann/repos/libimobiledevice_test/target/debug/build/plist_plus-35e4f5876a87ed45/out/libplist/configure: /Users/johann/repos/libimobiledevice_test/target/debug/build/plist_plus-35e4f5876a87ed45/out/libplist/configure: No such file or directory
  /Users/johann/repos/libimobiledevice_test/target/debug/build/plist_plus-35e4f5876a87ed45/out/libplist/configure: line 0: exec: /Users/johann/repos/libimobiledevice_test/target/debug/build/plist_plus-35e4f5876a87ed45/out/libplist/configure: cannot execute: No such file or directory
  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 126

I am not sure if I am missing anything here - as described below, I am missing imobiledevice-glue, but I doubt this is the issue here.

When I am switching to the vendored feature, I get

error: could not find native static library `imobiledevice-glue-1.0`, perhaps an -L flag is missing?

Which is true, as I am missing imobiledevice-glue-1.0 - I have installed libimobiledevice with brew install libimobiledevice. Would I need a separate install of imobiledevice-glue? I think some setup instructions might be helpful for OSX, although this might be complex due to the multitude of OSX versions. Perhaps I can help with that?

I was able to follow a guide at https://github.com/libimobiledevice/libimobiledevice/issues/1217 and got it working like this:

xcode-select --install
brew create "https://github.com/libimobiledevice/libimobiledevice-glue.git"

insert this:

# Documentation: https://docs.brew.sh/Formula-Cookbook
#                https://rubydoc.brew.sh/Formula
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class LibimobiledeviceGlue < Formula
  desc ""
  homepage ""
  license ""
  head "https://github.com/libimobiledevice/libimobiledevice-glue.git"

  depends_on "autoconf" => :build
  depends_on "automake" => :build
  depends_on "libtool" => :build
  depends_on "pkg-config" => :build
  depends_on "libplist"
  # depends_on "cmake" => :build

  def install
    # ENV.deparallelize  # if your formula fails when building in parallel
    # Remove unrecognized options if warned by configure
    # https://rubydoc.brew.sh/Formula.html#std_configure_args-instance_method
    system "./autogen.sh", "--prefix=#{prefix}"
    system "make", "install"
  end

end

brew edit libimobiledevice in line 31 add depends_on "libimobiledevice-glue" so the above formula is built with libimobiledevice

then brew uninstall libimobiledevice followed by brew install libimobiledevice.

jkcoxson commented 1 year ago

The vendor should not depend on anything installed on your system except for build tools. It will build libimobiledevice, libplist, libusbmuxd and libimobiledevice-glue all from scratch at build time. I have done all my work on my Mac, so this isn't a MacOS issue. I'll give it a look.

jkcoxson commented 1 year ago

I just created a clean build, and it worked fine. Make sure that you have the dependencies listed in the README. For context, my Cargo.toml looks like

rusty_libimobiledevice = { version = "*", features = [ "static", "vendored" ] }

You will have to find the Mac equivalents to the software listed here

woelper commented 1 year ago

Thank you so much for trying this out and your help. I indeed was able to build with vendored now. Why this now works is not exactly clear to me, but it might be due to the fact I re-built libimobiledevice with libimobiledevice-glue. Out of curiosity, did you install your dependencies manually or with homebrew?

jkcoxson commented 1 year ago

I installed my dependencies with brew. I’ll close this since you got it to build.