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

Use fat-macho crate to create universal library #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

messense
Copy link
Contributor

@messense messense commented Feb 8, 2021

Not sure if this is desired, opening this PR for discussion, :-)

https://github.com/messense/fat-macho-rs

@TimNN TimNN mentioned this pull request Feb 8, 2021
@messense messense marked this pull request as draft February 8, 2021 15:22
@messense
Copy link
Contributor Author

messense commented Feb 8, 2021

Apparently some offset is wrong with archive files in the universal library, will investigate and fix it later.

@TimNN
Copy link
Owner

TimNN commented Feb 8, 2021

Thanks for the PR, @messense! I've moved the CI fixes to #48, thanks for those!

Could you describe what you see as the benefits and drawbacks for using fat-macho?

@messense
Copy link
Contributor Author

messense commented Feb 8, 2021

fat-macho is basically a pure Rust implementation of lipo, it runs on macOS, Linux and Windows makes it easier for cross compiling on non-macOS machine. But it's a pretty new project, not as battle tested as lipo.

@messense
Copy link
Contributor Author

messense commented Feb 9, 2021

Interesting, the Xcode integration tests failed locally on my Mac (Big Sur 11.2) iphonesimulator14.4, but it works on CI?

[INFO  cargo_lipo::meta] Will build universal library for ["static1", "static2build", "static3bin"]
   [INFO  cargo_lipo::lipo] Building "static1" for "aarch64-apple-ios"
      Compiling normal v0.1.0 (/Users/messense/Projects/cargo-lipo/testdata/workspace/normal)
      Compiling static1 v0.1.0 (/Users/messense/Projects/cargo-lipo/testdata/workspace/static1)
       Finished dev [unoptimized + debuginfo] target(s) in 1.37s
   [INFO  cargo_lipo::lipo] Building "static1" for "x86_64-apple-ios"
      Compiling normal v0.1.0 (/Users/messense/Projects/cargo-lipo/testdata/workspace/normal)
      Compiling static1 v0.1.0 (/Users/messense/Projects/cargo-lipo/testdata/workspace/static1)
       Finished dev [unoptimized + debuginfo] target(s) in 0.98s
   [INFO  cargo_lipo::lipo] Creating universal library for static1
   [INFO  cargo_lipo::lipo] Building "static2build" for "aarch64-apple-ios"
      Compiling buildutil v0.1.0 (/Users/messense/Projects/cargo-lipo/testdata/workspace/buildutil)
      Compiling static2build v0.1.0 (/Users/messense/Projects/cargo-lipo/testdata/workspace/static2build)
   error: linking with `cc` failed: exit code: 1
     |
     = note: "cc" "-m64" "-arch" "x86_64" "-L" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/messense/Projects/cargo-lipo/testdata/workspace/target/debug/build/static2build-848f0bcf35cf67ad/build_script_build-848f0bcf35cf67ad.17r2cb9hhpqll36a.rcgu.o" "/Users/messense/Projects/cargo-lipo/testdata/workspace/target/debug/build/static2build-848f0bcf35cf67ad/build_script_build-848f0bcf35cf67ad.24lsk5gx18bbgekq.rcgu.o" "/Users/messense/Projects/cargo-lipo/testdata/workspace/target/debug/build/static2build-848f0bcf35cf67ad/build_script_build-848f0bcf35cf67ad.26xj0k3esrebjng0.rcgu.o" "/Users/messense/Projects/cargo-lipo/testdata/workspace/target/debug/build/static2build-848f0bcf35cf67ad/build_script_build-848f0bcf35cf67ad.383hy58s8z2hqzhx.rcgu.o" "/Users/messense/Projects/cargo-lipo/testdata/workspace/target/debug/build/static2build-848f0bcf35cf67ad/build_script_build-848f0bcf35cf67ad.3lpshulrxroi2squ.rcgu.o" "/Users/messense/Projects/cargo-lipo/testdata/workspace/target/debug/build/static2build-848f0bcf35cf67ad/build_script_build-848f0bcf35cf67ad.4br683wddtvf1sui.rcgu.o" "/Users/messense/Projects/cargo-lipo/testdata/workspace/target/debug/build/static2build-848f0bcf35cf67ad/build_script_build-848f0bcf35cf67ad.5gcpa4kh5inmxxsj.rcgu.o" "/Users/messense/Projects/cargo-lipo/testdata/workspace/target/debug/build/static2build-848f0bcf35cf67ad/build_script_build-848f0bcf35cf67ad.vjdemme6opximb4.rcgu.o" "-o" "/Users/messense/Projects/cargo-lipo/testdata/workspace/target/debug/build/static2build-848f0bcf35cf67ad/build_script_build-848f0bcf35cf67ad" "/Users/messense/Projects/cargo-lipo/testdata/workspace/target/debug/build/static2build-848f0bcf35cf67ad/build_script_build-848f0bcf35cf67ad.3kd3pudkwwx93hwc.rcgu.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/messense/Projects/cargo-lipo/testdata/workspace/target/debug/deps" "-L" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/messense/Projects/cargo-lipo/testdata/workspace/target/debug/deps/libbuildutil-02ae84b134c74c79.rlib" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-518979da66993550.rlib" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-f52081aedccc205f.rlib" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libobject-bad1c02788187328.rlib" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-6375d8dbf53aee9d.rlib" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgimli-0ea8539778b0c0ab.rlib" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-64f30c6d69babb18.rlib" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-e27428d997fd2532.rlib" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-f02467a76e5a8054.rlib" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-9536efad7116d828.rlib" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-5ca171f6ec11d7a5.rlib" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-14b621861b38e51f.rlib" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-38f4a0c206512fa5.rlib" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-99bca6ace58141c5.rlib" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-72a66f4c97a4c0c8.rlib" "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-e7cd9f0beed2fc0f.rlib" "-lSystem" "-lresolv" "-lc" "-lm"
     = note: ld: library not found for -lSystem
             clang: error: linker command failed with exit code 1 (use -v to see invocation)


   error: aborting due to previous error

   error: could not compile `static2build`

   To learn more, run the command again with --verbose.
   [ERROR cargo_lipo] Failed to build "static2build" for "aarch64-apple-ios": Executing "/Users/messense/.rustup/toolchains/stable-x86_64-apple-darwin/bin/cargo" "--color" "auto" "build" "--manifest-path" "../workspace/Cargo.toml" "-p" "static2build" "--target" "aarch64-apple-ios" "--lib" finished with error status: exit code: 101

@messense
Copy link
Contributor Author

messense commented Feb 9, 2021

Oh, it fails the with same error with master branch. #41

@messense messense marked this pull request as ready for review February 9, 2021 06:26
@messense
Copy link
Contributor Author

messense commented Feb 9, 2021

With this PR I think we can allow it to run on non-macOS when xcode-integ is off.

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 this pull request may close these issues.

2 participants