Fix build on Windows 10

This commit is contained in:
Adrián Arroyo Calle
2022-05-22 13:18:11 +02:00
parent bef8eb538c
commit 6feb1f8b82
4 changed files with 48 additions and 56 deletions

78
Cargo.lock generated
View File

@@ -144,12 +144,6 @@ version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "1.0.0" version = "1.0.0"
@@ -250,6 +244,16 @@ dependencies = [
"subtle", "subtle",
] ]
[[package]]
name = "ctrlc"
version = "3.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b37feaa84e6861e00a1f5e5aa8da3ee56d605c9992d33e082786754828e20865"
dependencies = [
"nix 0.24.1",
"winapi",
]
[[package]] [[package]]
name = "difflib" name = "difflib"
version = "0.4.0" version = "0.4.0"
@@ -271,7 +275,7 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"dirs-sys-next", "dirs-sys-next",
] ]
@@ -365,7 +369,7 @@ version = "3.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46e245f4c8ec30c6415c56cb132c07e69e74f1942f6b4a4061da748b49f486ca" checksum = "46e245f4c8ec30c6415c56cb132c07e69e74f1942f6b4a4061da748b49f486ca"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"rustix", "rustix",
"windows-sys 0.30.0", "windows-sys 0.30.0",
] ]
@@ -470,7 +474,7 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"libc", "libc",
"wasi 0.10.2+wasi-snapshot-preview1", "wasi 0.10.2+wasi-snapshot-preview1",
] ]
@@ -662,7 +666,7 @@ version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
] ]
[[package]] [[package]]
@@ -713,7 +717,7 @@ version = "5.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f404a90a744e32e8be729034fc33b90cf2a56418fbf594d69aa3c0214ad414e5" checksum = "f404a90a744e32e8be729034fc33b90cf2a56418fbf594d69aa3c0214ad414e5"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"lexical-core", "lexical-core",
] ]
@@ -725,7 +729,7 @@ checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
"cfg-if 1.0.0", "cfg-if",
"ryu", "ryu",
"static_assertions", "static_assertions",
] ]
@@ -769,7 +773,7 @@ version = "0.4.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
] ]
[[package]] [[package]]
@@ -904,19 +908,6 @@ dependencies = [
"smallvec", "smallvec",
] ]
[[package]]
name = "nix"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229"
dependencies = [
"bitflags",
"cc",
"cfg-if 0.1.10",
"libc",
"void",
]
[[package]] [[package]]
name = "nix" name = "nix"
version = "0.23.1" version = "0.23.1"
@@ -925,11 +916,22 @@ checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cc", "cc",
"cfg-if 1.0.0", "cfg-if",
"libc", "libc",
"memoffset", "memoffset",
] ]
[[package]]
name = "nix"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9"
dependencies = [
"bitflags",
"cfg-if",
"libc",
]
[[package]] [[package]]
name = "ntapi" name = "ntapi"
version = "0.3.7" version = "0.3.7"
@@ -1022,7 +1024,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cfg-if 1.0.0", "cfg-if",
"foreign-types", "foreign-types",
"libc", "libc",
"once_cell", "once_cell",
@@ -1094,7 +1096,7 @@ version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"instant", "instant",
"libc", "libc",
"redox_syscall", "redox_syscall",
@@ -1108,7 +1110,7 @@ version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"libc", "libc",
"redox_syscall", "redox_syscall",
"smallvec", "smallvec",
@@ -1565,7 +1567,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db7826789c0e25614b03e5a54a0717a86f9ff6e6e5247f92b369472869320039" checksum = "db7826789c0e25614b03e5a54a0717a86f9ff6e6e5247f92b369472869320039"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cfg-if 1.0.0", "cfg-if",
"clipboard-win", "clipboard-win",
"dirs-next", "dirs-next",
"fd-lock", "fd-lock",
@@ -1623,6 +1625,7 @@ dependencies = [
"chrono", "chrono",
"cpu-time", "cpu-time",
"crossterm", "crossterm",
"ctrlc",
"dirs-next", "dirs-next",
"divrem", "divrem",
"fxhash", "fxhash",
@@ -1636,7 +1639,6 @@ dependencies = [
"libc", "libc",
"modular-bitfield", "modular-bitfield",
"native-tls", "native-tls",
"nix 0.15.0",
"num-rug-adapter", "num-rug-adapter",
"openssl", "openssl",
"ordered-float", "ordered-float",
@@ -1949,7 +1951,7 @@ version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"fastrand", "fastrand",
"libc", "libc",
"redox_syscall", "redox_syscall",
@@ -2092,7 +2094,7 @@ version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"pin-project-lite", "pin-project-lite",
"tracing-core", "tracing-core",
] ]
@@ -2166,12 +2168,6 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "void"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
[[package]] [[package]]
name = "wait-timeout" name = "wait-timeout"
version = "0.2.0" version = "0.2.0"
@@ -2220,7 +2216,7 @@ version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"wasm-bindgen-macro", "wasm-bindgen-macro",
] ]

View File

@@ -43,7 +43,7 @@ lazy_static = "1.4.0"
lexical = "5.2.2" lexical = "5.2.2"
libc = "0.2.62" libc = "0.2.62"
modular-bitfield = "0.11.2" modular-bitfield = "0.11.2"
nix = "0.15.0" ctrlc = "3.2.2"
num-rug-adapter = { version = "0.1.6", optional = true } num-rug-adapter = { version = "0.1.6", optional = true }
ordered-float = "2.6.0" ordered-float = "2.6.0"
phf = { version = "0.9", features = ["macros"] } phf = { version = "0.9", features = ["macros"] }

View File

@@ -102,7 +102,7 @@ strings.
## Installing Scryer Prolog ## Installing Scryer Prolog
### Native Install (Unix Only) ### Native Install
First, install the latest stable version of First, install the latest stable version of
[Rust](https://www.rust-lang.org/en-US/install.html) using your [Rust](https://www.rust-lang.org/en-US/install.html) using your
@@ -125,9 +125,13 @@ $> cargo run [--release]
The optional `--release` flag will perform various optimizations, The optional `--release` flag will perform various optimizations,
producing a faster executable. producing a faster executable.
On Windows, Scryer Prolog is easier to build inside a [MSYS2](https://www.msys2.org/)
environment as some crates may require native C compilation. However,
the resulting binary does not need MSYS2 to run. When executing Scryer in a shell, it is recommended to use a more advanced shell than mintty (the default MSYS2 shell). The [Windows Terminal](https://github.com/microsoft/terminal) works correctly.
Scryer Prolog must be built with **Rust 1.57 and up**. Scryer Prolog must be built with **Rust 1.57 and up**.
### Docker Install (All Platforms) ### Docker Install
First, install [Docker](https://docs.docker.com/get-docker/) on Linux, First, install [Docker](https://docs.docker.com/get-docker/) on Linux,
Windows, or Mac. Windows, or Mac.

View File

@@ -1,19 +1,11 @@
fn main() { fn main() {
use nix::sys::signal; use std::sync::atomic::Ordering;
use scryer_prolog::*; use scryer_prolog::*;
let handler = signal::SigHandler::Handler(handle_sigint); ctrlc::set_handler(move || {
unsafe { signal::signal(signal::Signal::SIGINT, handler) }.unwrap(); scryer_prolog::machine::INTERRUPT.store(true, Ordering::Relaxed);
}).unwrap();
let mut wam = machine::Machine::new(); let mut wam = machine::Machine::new();
wam.run_top_level(); wam.run_top_level();
} }
pub extern "C" fn handle_sigint(signal: libc::c_int) {
use nix::sys::signal;
use std::sync::atomic::Ordering;
let signal = signal::Signal::from_c_int(signal).unwrap();
if signal == signal::Signal::SIGINT {
scryer_prolog::machine::INTERRUPT.store(true, Ordering::Relaxed);
}
}