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

bitcode support #26

Open
extrawurst opened this issue Jan 2, 2019 · 7 comments
Open

bitcode support #26

extrawurst opened this issue Jan 2, 2019 · 7 comments

Comments

@extrawurst
Copy link

I thought rust supports bitcode generation. How can I make cargo lipo build such libraries?

@TimNN
Copy link
Owner

TimNN commented Jan 2, 2019

Please see the upstream issue rust-lang/rust#35968: Support is apparently experimental and can be enabled using RUSTFLAGS="-Z embed-bitcode" cargo lipo --release, but may not work on all architectures.

@mbalex99
Copy link

mbalex99 commented Jan 21, 2019

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!

@dobkeratops
Copy link

^^^
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$ 

@TimNN
Copy link
Owner

TimNN commented Feb 17, 2019

@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.

@dobkeratops
Copy link

dobkeratops commented Feb 17, 2019

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)

@ndusart
Copy link

ndusart commented Jun 19, 2019

@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.

@JoyceBabu
Copy link

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.

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

No branches or pull requests

6 participants