The Following 15 Users Say Thank You to alfmar For This Useful Post: | ||
|
2016-09-28
, 16:11
|
Posts: 88 |
Thanked: 411 times |
Joined on Mar 2010
@ southern Italy
|
#2
|
rustup target install armv7-unknown-linux-gnueabihf
[target.armv7-unknown-linux-gnueabihf] linker = "arm-linux-gnueabihf-gcc"
sudo apt-get install gcc-arm-linux-gnueabihf
The Following 3 Users Say Thank You to alfmar For This Useful Post: | ||
|
2016-10-03
, 20:28
|
Posts: 88 |
Thanked: 411 times |
Joined on Mar 2010
@ southern Italy
|
#4
|
cargo new x11n900 --bin
[dependencies] libc = "*" x11-dl = "*"
cargo run
37c37 < x11_link! { Xlib, x11, ["libX11.so.6", "libX11.so"], 767, --- > x11_link! { Xlib, x11, ["libX11.so.6", "libX11.so"], 763, 241d240 < pub fn XESetCopyEventCookie (_3: *mut Display, _2: c_int, _1: Option<unsafe extern "C" fn (*mut Display, *mut XGenericEventCookie, *mut XGenericEventCookie) -> c_int>) -> Option<unsafe extern "C" fn (*mut Display, *mut XGenericEventCookie, *mut XGenericEventCookie) -> c_int>, 254d252 < pub fn XESetWireToEventCookie (_3: *mut Display, _2: c_int, _1: Option<unsafe extern "C" fn (*mut Display, *mut XGenericEventCookie, *mut xEvent) -> c_int>) -> Option<unsafe extern "C" fn (*mut Display, *mut XGenericEventCookie, *mut xEvent) -> c_int>, 278d275 < pub fn XFreeEventData (_2: *mut Display, _1: *mut XGenericEventCookie) -> (), 298d294 < pub fn XGetEventData (_2: *mut Display, _1: *mut XGenericEventCookie) -> c_int,
cargo clean cargo run ldd target/debug/x11n900
cargo build --target=armv7-unknown-linux-gnueabihf --release rsync -ave ssh target/armv7-unknown-linux-gnueabihf/release/x11n900 root@n900:/root/rust/
LD_LIBRARY_PATH=/root/rust/ /root/rust/x11n900
The Following 3 Users Say Thank You to alfmar For This Useful Post: | ||
|
2016-10-03
, 20:45
|
Posts: 88 |
Thanked: 411 times |
Joined on Mar 2010
@ southern Italy
|
#5
|
The Following 2 Users Say Thank You to alfmar For This Useful Post: | ||
|
2016-10-03
, 21:08
|
Posts: 88 |
Thanked: 411 times |
Joined on Mar 2010
@ southern Italy
|
#6
|
I'd be interested to know if Rust and the Nuklear UI library (Rust bindings here) could be used to write apps that run on Sailfish.
I just found a way to cross-compile Rust programs to run on a N900.
Scenario:
- write/debug some Rust program on my Ubuntu PC
- cross-compile it for ARMv7 target (thanks, Rustup!)
- copy executable file on the N900 and execute it there.
On the N900:
- have a directory with updated libc/ldso/libgcc_s...
- use it:
- latest Rust releases require at least glibc 2.18 on the target N900
- (and glibc versions newer than 2.18 require kernel 2.6.32 or newer)
- I didn't want to try risky upgrades.
N900 preparation:
- grab a glibc 2.18 binary (I found one from OpenSUSE 13.1/ARM)
- grab the related libgcc_s binary (I found one from OpenSUSE 13.2/ARM)
- unpack them on your desktop PC, for example:
Why did it work?
- Rust-compiled executables only require a few essential libraries (generally libc, libm, libpthread, libdl)
- Rust-compiled executables are happy with glibc 2.18 (this is why the same executable for N900 works on the Beagleboard and Jolla phones)
- I was lucky: N900 stock software uses legacy ld-linux.so.3 loader name instead of ld-linux-armhf.so.3
Note:
- a trick like this will work on any platform as long as it uses the legacy loader name and the kernel is not too old for the glibc "updated" version;
- some "updated" features may require extra fiddling (nsswitch, rpc, bindresvport; check the etc directory of the glibc package if you need them).
Mission: accomplished.