Koka / gettext-rs

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

gettext-rs failed to build with clang16 due to -Wincompatible-function-pointer-types #114

Open Endle opened 6 months ago

Endle commented 6 months ago

I'm trying to build gettext-rs in such environment

However, I got such error

  /tmp/te8c1-0/gettext/libtextstyle/lib/obstack.c:351:31: error: incompatible function pointer types initializing 'void (*)(void) __attribute__((noreturn))' with an expression of type 'void (void)' [-Wincompatible-function-pointer-types]
  __attribute_noreturn__ void (*obstack_alloc_failed_handler) (void)
                                ^
  1 error generated.

My environment

$ rustc --version
rustc 1.73.0 (cc66ad468 2023-10-03) (built from a source tarball)

$ cc --version
clang version 16.0.6
Target: arm64-apple-darwin
Thread model: posix
InstalledDir: /nix/store/a5v30qll5i02vr9y97bk1rdx3mm6kvlm-clang-16.0.6/bin

I checked gettext-0.22.4.tar.gz, and this part of code remains untouched

Endle commented 6 months ago

By adding -Wno-error=incompatible-function-pointer-types, I can compile the package.

https://github.com/Koka/gettext-rs/commit/838ee637d1c48fdba8379e5b3c6d91c734bb6ceb

Well, I don't think I should use darwin as the flag. I think I can try to detect the clang version

Endle commented 6 months ago

I tried to catch this issue with github action. However, clang16 is not available in github action yet

https://github.com/Endle/gettext-rs/blob/41f65c5702fa727f163f861f270bf0a54745ed52/.github/workflows/macos.yml#L22