vorner / signal-hook

Rust library allowing to register multiple handlers for the same signal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build fails on OpenBSD 7.3

andinus opened this issue · comments

Faced when trying to build static-web-server:

The following warnings were emitted during compilation:                                                                                                                                      
                                                                                              
warning: src/low_level/extract.c:26:7: error: use of undeclared identifier 'SI_MESGQ'
warning:     { SI_MESGQ, -1, 5 },  
warning:       ^
warning: src/low_level/extract.c:36:37: error: invalid application of 'sizeof' to an incomplete type 'struct Const []'
warning:     const size_t const_len = sizeof consts / sizeof *consts;
warning:                                     ^~~~~~
warning: 2 errors generated.
                                                                                                                                                                                             
error: failed to run custom build command for `signal-hook v0.3.15`                                                                                                                          
                                               
Caused by:
  process didn't exit successfully: `/home/andinus/dev/other/static-web-server-2.19.0/target/debug/build/signal-hook-7482100cb62ccacc/build-script-build` (exit status: 1)
  --- stdout                                                                                  
  TARGET = Some("x86_64-unknown-openbsd")                                                                                                                                                    
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-unknown-openbsd")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-openbsd
  CC_x86_64-unknown-openbsd = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_openbsd
  CC_x86_64_unknown_openbsd = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-openbsd
  CFLAGS_x86_64-unknown-openbsd = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_openbsd
  CFLAGS_x86_64_unknown_openbsd = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/home/andinus/dev/other/static-web-server-2.19.0/target/debug/build/signal-hook-932164e25ff6283b/out/src/low_level/extract.o" "-c" "src/low_level/extract.c"
  cargo:warning=src/low_level/extract.c:26:7: error: use of undeclared identifier 'SI_MESGQ'
  cargo:warning=    { SI_MESGQ, -1, 5 },
  cargo:warning=      ^
  cargo:warning=src/low_level/extract.c:36:37: error: invalid application of 'sizeof' to an incomplete type 'struct Const []'
  cargo:warning=    const size_t const_len = sizeof consts / sizeof *consts;
  cargo:warning=                                    ^~~~~~
  cargo:warning=2 errors generated.
  exit status: 1

  --- stderr


  error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/home/andinus/dev/other/static-web-server-2.19.0/target/debug/build/signal-hook-932164e25ff6283b/out/src/low_level/extract.o" "-c" "src/low_level/extract.c" with args "cc" did not execute successfully (status code exit status: 1).

Hello.

According to Posix, that SI_MESGQ should be available. Can you somehow find out if OpenBSD just misses that thing (which is related to functions like mq_notify), or if it's available in some other header? I don't have that OS around and I would like to decide on how to fix that problem based on the info.

It seems like OpenBSD is missing that: boostorg/test#231

OK, if this is a good enough fix for Boost, it should be good enough for this crate.

Can you test #147 before I merge it?

I ran cargo test ; cargo build on openbsd-compile-fix branch, it works. Thanks!

Released to crates.io as 0.3.16. Thank you.