cargo-lipo
cargo-lipo copied to clipboard
bitcode support
I thought rust supports bitcode generation. How can I make cargo lipo
build such libraries?
Please see the upstream issue https://github.com/rust-lang/rust/issues/35968: Support is apparently experimental and can be enabled using RUSTFLAGS="-Z embed-bitcode" cargo lipo --release
, but may not work on all architectures.
Right now I'm having trouble with the i386 architecture.
When you build with xcode you'll notice this warning:
ld: warning: ignoring file /Users/maxalex/ditto/ditto-crdt-lib/target/universal/release/libditto.a, missing required architecture i386 in file /Users/maxalex/ditto/ditto-crdt-lib/target/universal/release/libditto.a (2 slices)
What I'm noticing is that when I run:
RUSTFLAGS="-Z embed-bitcode" cargo lipo --release;
It builds for all of them except for i386-apple-ios, armv7-apple-ios, armv7s-apple-ios
- aarch64-apple-ios
- armv7-apple-ios (this one never makes it)
- armv7s-apple-ios (this one never makes it)
- x86_64-apple-ios
- i386-apple-ios . (this one never makes it)
I've run
rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-ios i386-apple-ios;
And still cargo lipo seems to skip it..
Update:
If you're using Xcode 10, i386 has been removed!
^^^ i'm seeing the same thing , it wont build 32bit targets.. i have an old iPad2 i'd like to be able to test on. 32bit keeps devices out of landfill.. and devices can keep getting smaller,cheaper (watches, IoT things) .. i'm surprised people want to consider 32bit "obsolete"
~/Desktop/rustios/greetings/cargo$ rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-ios i386-apple-ios
info: component 'rust-std' for target 'aarch64-apple-ios' is up to date
info: component 'rust-std' for target 'armv7-apple-ios' is up to date
info: component 'rust-std' for target 'armv7s-apple-ios' is up to date
info: component 'rust-std' for target 'x86_64-apple-ios' is up to date
info: component 'rust-std' for target 'i386-apple-ios' is up to date
~/Desktop/rustios/greetings/cargo$ more Cargo.toml
[package]
name = "greetings"
version = "0.1.1"
edition = "2018"
publish = false
[lib]
name = "greetings"
crate-type = ["staticlib"]
[dependencies]
~/Desktop/rustios/greetings/cargo$ cargo lipo --release
[INFO cargo_lipo::meta] Will build universal library for ["greetings"]
[INFO cargo_lipo::lipo] Building "greetings" for "aarch64-apple-ios"
Compiling greetings v0.1.1 (/Users/walter/Desktop/rustios/greetings/cargo)
Finished release [optimized] target(s) in 2.04s
[INFO cargo_lipo::lipo] Building "greetings" for "x86_64-apple-ios"
Compiling greetings v0.1.1 (/Users/walter/Desktop/rustios/greetings/cargo)
Finished release [optimized] target(s) in 1.39s
[INFO cargo_lipo::lipo] Creating universal library for greetings
~/Desktop/rustios/greetings/cargo$
@dobkeratops: I'm not quite sure what your issue is, but I don't think it's related to the previous comments.
In any case, since ~recently cargo-lipo
only builds for 64 bit targets by default (aarch64-apple-ios
and x86_64-apple-ios
). You can use the --targets
flag to specify all four targets if necessary.
ah i see now you can re-enable 32bit builds as you say (cargo lipo --targets=aarch64-apple-ios,x86_64-apple-ios,armv7-apple-ios,armv7s-apple-ios
)
#22 , I see it was disabled by default (to reduce build times..)
I was about to open an issue but I see the person above had bumped into the same thing (not getting all the targets he assumed would be done)
@TimNN there should be indications in readme that 32 bits are not built by default and an example command for building these should be documented as well in my opinion. It is odd to have to go in the issues to learn this.
It would be nice to have a mention about the default targets in the README. I was about to post a new issue about the missing targets, but fortunately found the reason here.