Koka / gettext-rs

GNU Gettext FFI binding for Rust
51 stars 25 forks source link

build.rs checks fail in PowerShell #105

Closed Minoru closed 1 year ago

Minoru commented 1 year ago
    thread 'main' panicked at 'failed to excute process: Error { kind: NotFound, message: "program not found" }', C:\Users\toto\.cargo\registry\src\github.com-1ecc6299db9ec823\gettext-sys-0.21.3\build.rs:69:14

I'm getting this error when I'm building in a powershell.

Originally posted by @dabrain34 in https://github.com/Koka/gettext-rs/issues/81#issuecomment-1317074449

Minoru commented 1 year ago

@dabrain34, this error comes from here:

https://github.com/Koka/gettext-rs/blob/ea91043635cfc44f442379d2b552166b7ec981a5/gettext-sys/build.rs#L63-L83

which is called from here:

https://github.com/Koka/gettext-rs/blob/ea91043635cfc44f442379d2b552166b7ec981a5/gettext-sys/build.rs#L160

This code checks that you have all the necessary tools to build GNU gettext from source. I guess PowerShell can't be invoked as sh. If you could write equivalent code for PowerShell and send a pull request, that'd be swell!

dabrain34 commented 1 year ago

Thanks @Minoru to explain what to do here. I will keep it in mind if I can do something soon.

dabrain34 commented 1 year ago

I had a look to this issue but the solution to solve the windows support gets more clear to me. We wont be able to run configure on cmd/powershell but only on mingw.

We should not use this approach of building gettext but use the gettext binary directly and pkg-config to link with.

Unfortunately gettext does not provide any pc file. So either to generate a temporary one and use system-deps or fix this crate to search for the library.

dabrain34 commented 1 year ago

Otherwise I can provide you a branch to fix the sh and the tar thing with powershell but you wont be able to fix the autotools/configure issue ...

Minoru commented 1 year ago

Sorry for the slow response!

So either to generate a temporary one and use system-deps

For this to work, we'd have to find an existing gettext library, which doesn't seem an easy problem. Luckily, searching for the library is already covered by GETTEXT_DIR, GETTEXT_LIB_DIR and other environment variables; see gettext-sys/README.md.

I'm closing the issue because it's clear now that it's fruitless to try and build with PowerShell.