-
Notifications
You must be signed in to change notification settings - Fork 262
Cross-compile for androideabi on -msvc target fails #44
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
Comments
Also happens on GNU, this looks like the offending SHA1: 390ea2a Also the dependency that specified this(jni-rs) has 0.2.1 in the dependency chain but 0.1.10 somehow is getting pulled in. |
Looking at it a bit more jni-rs declares error-chain 0.5.0 which references backtrace 0.2.1 but I'm getting backtrace 0.2.3 in the Cargo.lock. Any idea why the versioning isn't working right here? |
Oh looks like we are trying to execute a shell script on Windows which doesn't work, we just need to do "sh configure" instead. Would you be willing to prep and test out a patch? |
I can confirm this issue, at least for cross-compiling on windows 10 using the |
Happy to test a patch, I was able to get the library building with this: vvanders@80294ba but I'm not sure if it functions yet since I hit something else gnarly. Even when I load my new fix(+bump the cargo major version) I still get backtrace-sys pulled. we build the new major version but also this even though we never link it which means my main build still fails. If I understand what I was able to dig up with cargo right once we have a fix we need to do a few things:
As a side note, it would be really awesome if it were possible to pin a crate version in the Cargo.toml. I couldn't find a way to do it. |
@JoeyAcc ok hang on, looks like this is already a commit! @vvanders and @JoeyAcc, can you test out the master branch of this repository? If that works I can certainly publish a new version |
Looks like no-go on stock windows. Is there a hard dependency on msys/cygwin? I'd really like to avoice that if possible(I used the library before without msys).
|
Yes compiling libbacktrace requires some form of unix-like environment as AFAIK libbacktrace doesn't have an msvc-like build system. You can turn off the dependency by disabling default features of this crate and selectively enabling strategies you'd like to use when generating a backtrace, more info can be found in the manifest |
Totally get how that could be a requirement for the latest version, I'm just trying to bring-up a project that used to compile on the 0.2.x series of crates. I'm actually pulling it in indirectly thought other dependencies so I'm not sure if I can actually configure the leaf dependency. I just confirmed here locally that 0.2.1 build cleanly on msvc + androideabi and the commit I referenced in post #2 is the commit that seemed to break it. Would you consider the change in dependencies to be a break in the semver? Since downstream dependencies automatically uplevel on a minor version I don't have a way to specify the specific crate I consume without manually hacking my Cargo.lock which I'm hesitant to do. |
This crate unfortunately has a bit of a colorful history. The historical versions of this crate all used libbacktrace through the standard library. That is, it used the symbols from the standard library rather than compiling its own copy. That's because the standard library didn't properly hide the libbacktrace symbols from other object files or shared objects. That was fixed in rust-lang/rust#39252 which meant that this crate would no longer compile correctly in all situations because it could no longer use libbacktrace from libstd. As a result the "regression" was actually a bug fix in that we started needing to compile libbacktrace. Compiling C code is always pretty tricky to get right (brings in more system dependencies) and tends to not work immediately out of the box. Does that make sense? |
Oh totally makes sense, it's just from a functionality standpoint it seems like a breakage to have something that compiled before fail. Without a way to pin a specific crate it leaves users in a bad spot. I managed to fork each of my dependencies and plumb through a set of feature flags so I'm unblocked. I understand if it's too core/complex dependency chain to fix. Just wanted to let you know it's definitely a pain point. |
I had a dependency on v0.2 which I've now upgraded to the revision you mentioned here. However I still get an error:
However, I am not sure what causes this new issue, but this part does look weird to me:
If the revision is being passed as a URL argument, what is the purpose of the |
Ok thanks for the heads up @vvanders always good to be aware of this! It may be a plausible strategy here to just auto-disable libbacktrace if it fails to compile? That'd at least restore compilation and just use a different strategy for generating backtraces. Either that or libbacktrace could just get disabled on Android entirely if it's not too useful anyway. @JoeyAcc it looks like you're trying to cross-compile from Windows to Linux, but that typically doesn't work for a number of reasons? Has that worked for you in the past? |
I've been cross-compiling successfully from Windows to Linux (Raspberry Pi) using the toolchain from http://gnutoolchains.com/raspberry, but I'm now running into the same error as @JoeyAcc when using the error-chain crate. For now I'm just disabling backtrace support entirely in error-chain, but that's not really ideal as my project is a library. As far as I can tell, there isn't a way to set dependencies for certain host/target cross compilation pairs in Cargo.toml, right? I suppose I could add a feature to my library to make it the caller's decision, though that's still not ideal. Would it be possible to teach the configure script about |
Yes it's possible to turn this off but that's typically the wrong thing to do. What's probably happening is you're the first with a particular configuration to run the build script and there's a bug in the build script to fix to be compatible with your configuration. Can you try editing the build script to avoid passing |
Thanks, Alex! I was able to get it working by doing the following:
With those changes, I can successfully build the binary, run it on the Pi, and get backtraces. :) Now, what's the proper way to address these? Presumably we only want to do number 2 on Windows, but not sure about the other two. Happy to provide a PR. |
Awesome! Those changes all sound right to me, want to send a PR? |
Done, thanks. Please let me know if you have any suggestions to make the backslash replacement nicer. :) |
The build system was redone, so I think this should be solved now |
Hitting this with some JNI libraries, not quite sure what the fix is here but happy to take a shot at it if I could get some pointers.
The text was updated successfully, but these errors were encountered: