AlexEne / AlexEne/rust_hawktracer_sys

Issues cross-compiling from Linux to Windows

Offen
#13 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
0
Forks
4
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

I am cross-compiling from x86-64-unknown-linux-gnu to i686-pc-windows-gnu. Here are some issues I encountered:
- ```
/home/yalter/.cargo/registry/src/github.com-1ecc6299db9ec823/rust_hawktracer_sys-0.4.2/hawktracer/lib/tcp_server.cpp:96:10: fatal error: WinSock2.h: No such file or directory
96 | #include
| ^~~~~~~~~~~~
```
```
/home/yalter/.cargo/registry/src/github.com-1ecc6299db9ec823/rust_hawktracer_sys-0.4.2/hawktracer/lib/platform/windows/memory_usage.c:4:10: fatal error: Windows.h: No such file or directory
4 | #include
| ^~~~~~~~~~~
```
```
/home/yalter/.cargo/registry/src/github.com-1ecc6299db9ec823/rust_hawktracer_sys-0.4.2/hawktracer/lib/platform/windows/memory_usage.c:5:10: fatal error: Psapi.h: No such file or directory
5 | #include
| ^~~~~~~~~
```
Fixed by making those includes all-lowercase.
- ```
cargo:rustc-link-search=all=/home/yalter/source/rs/bxt-rs/target/i686-pc-windows-gnu/debug/build/rust_hawktracer_sys-c9794263c9fe5873/out/build/lib/Debug
```
When using MinGW there's no additional `Debug`/`Release`/`RelWithDebInfo` folder in the end. Fixed by commenting out a line in `build.rs`.
- A lot of C++ linking errors. Fixed by copying the `println!("cargo:rustc-link-lib=dylib=stdc++");` line into the Windows branch as well. Although that made the built .dll require `libstdc++-6.dll` and a few other MinGW dlls; I couldn't change the line to say `static` because it couldn't find the static libstdc++ for some reason.

With those hack fixes in place, everything seemed to work fine.

I suspect these issues are specific to windows-gnu in general and not to just cross-compiling.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.