-
Notifications
You must be signed in to change notification settings - Fork 101
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
Cannot crosscompile for armv7 #184
Comments
Ah indeed, the current build.rs script compiles and execute a small program, which makes it hard to cross-compile it. The absurd solution would be to install something like The real solution is a bit trickier. Ncurses is a dynamically-linked library, but not all versions are ABI compatible. There is a bunch of options that can be enabled when building ncurses for the system, and as a result, when building a binary that links to ncurses, it's not guaranteed that it'll run seamlessly when linking the ncurses lib from another system. For example, on 64-bits architectures, there are 2 possible sizes for the Another possible difference is the version of the mouse API; different OS may ship ncurses libs with different version of the mouse API, even when the version of ncurses itself is the same. This is here again done with macro definitions in The first point doesn't apply on armv7 (it's 32-bits anyway), but the second point is still valid. It means that running a binary on a different system than the one it was built on is not safe in general. So when cross-compiling, we have no idea what options will be used on the target system. The result is that we can't safely predict what will be compatible with the target system, but we could let the user override it - in which case we wouldn't need to try to guess it. This means when cross-compiling, you will need to somehow transmit some information about the target system: what is the size of a How to transmit this information? There are a few ways: we could use env variables, or rustc/cargo features... not sure which option is easiest to integrate in a larger build (when |
To detect type size at compile time this trick can be used: int main()
{
int dummy;
int a_type;
switch (dummy) {
case 4:
case sizeof(a_type):
break;
}
return 0;
} Program will not compile if int size is 4 bytes. Same approach can be used to detect mouse API version: some programs will compile, some not. Just generate a sample program and then test is it compilable, like autoconf does. |
But the problem remains: it only tests the host ncurses config, not the target. |
If you will compile sample program using target compiler, then it will be tested with target ncurses config. TARGET_CC = Some("/opt/scel/17.2/sysroots/x86_64-scelsdk-linux/usr/bin/arm-scel-linux-gnueabi/arm-scel-linux-gnueabi-gcc")
TARGET_CFLAGS = Some("--sysroot=/opt/scel/17.2/sysroots/armv7ahf-neon-scel-linux-gnueabi -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=hard -marm") |
I commented out |
I'm having a similar problem when trying to create a package with TARGET x86_64-unknown-linux-musl on travis-ci:
|
Any updates on this? |
I have the same exact problem with --target=aarch64-unknown-linux-gnu
|
Cannot crosscompile ncurses-rs, because it compiles test program for armv7 and tries to execute it on x86_64. How to disable that?
The text was updated successfully, but these errors were encountered: