scsibug / nostr-rs-relay

Mirror of https://sr.ht/~gheartsfield/nostr-rs-relay/
MIT License
593 stars 161 forks source link

OpenBSD/jemalloc: `src/background_thread.c:87:2: error: unknown type name 'cpuset_t'; did you mean 'psset_t'?` #187

Closed mrusme closed 3 months ago

mrusme commented 9 months ago

I'm trying to build nostr-rs-relay on OpenBSD 7.4 and I'm getting the following output:

The following warnings were emitted during compilation:

error: failed to run custom build command for `tikv-jemalloc-sys v0.5.4+5.3.0-patched`

Caused by:
  process didn't exit successfully: `/root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-6525a1ca08c83db7/build-script-build` (exi
t status: 101)
  --- stdout
  TARGET=x86_64-unknown-openbsd
  HOST=x86_64-unknown-openbsd
  NUM_JOBS=1
  OUT_DIR="/root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-5e127b369745e7b9/out"
  BUILD_DIR="/root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-5e127b369745e7b9/out/build"
  SRC_DIR="/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tikv-jemalloc-sys-0.5.4+5.3.0-patched"
  cargo:warning="jemalloc support for `x86_64-unknown-openbsd` is untested"
  cargo:rustc-cfg=prefixed
  cargo:rerun-if-env-changed=JEMALLOC_OVERRIDE
  OPT_LEVEL = Some("3")
  TARGET = Some("x86_64-unknown-openbsd")
  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=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  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
  CC="cc"
  CFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC -m64 -Wall"
  JEMALLOC_REPO_DIR="jemalloc"
  cargo:rerun-if-env-changed=JEMALLOC_SYS_WITH_MALLOC_CONF
  cargo:rerun-if-env-changed=JEMALLOC_SYS_WITH_LG_PAGE
  cargo:rerun-if-env-changed=JEMALLOC_SYS_WITH_LG_HUGEPAGE
  cargo:rerun-if-env-changed=JEMALLOC_SYS_WITH_LG_QUANTUM
  cargo:rerun-if-env-changed=JEMALLOC_SYS_WITH_LG_VADDR
  --with-jemalloc-prefix=_rjem_
  running: cd "/root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-5e127b369745e7b9/out/build" && CC="cc" CFLAGS="-O3 -ffunction-s
ections -fdata-sections -fPIC -m64 -Wall" CPPFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC -m64 -Wall" LDFLAGS="-O3 -ffunction-sect
ions -fdata-sections -fPIC -m64 -Wall" "sh" "/root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-5e127b369745e7b9/out/build/config
ure" "--disable-cxx" "--enable-doc=no" "--enable-shared=no" "--with-jemalloc-prefix=_rjem_" "--with-private-namespace=_rjem_" "--host=x86_
64-unknown-openbsd" "--build=x86_64-unknown-openbsd" "--prefix=/root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-5e127b369745e7b
9/out"
  checking for xsltproc... false
  checking for x86_64-unknown-openbsd-gcc... cc
  checking whether the C compiler works... yes
  checking for C compiler default output file name... a.out
  checking for suffix of executables...
  checking whether we are cross compiling... no
  checking for suffix of object files... o
  checking whether we are using the GNU C compiler... yes
  checking whether cc accepts -g... yes
  checking for cc option to accept ISO C89... none needed
  checking whether compiler is cray... no
  checking whether compiler supports -std=gnu11... yes
  checking whether compiler supports -Werror=unknown-warning-option... yes
  checking whether compiler supports -Wall... yes
  checking whether compiler supports -Wextra... yes
  checking whether compiler supports -Wshorten-64-to-32... yes
  checking whether compiler supports -Wsign-compare... yes
  checking whether compiler supports -Wundef... yes
  checking whether compiler supports -Wno-format-zero-length... yes
  checking whether compiler supports -Wpointer-arith... yes
  checking whether compiler supports -Wno-missing-braces... yes
  checking whether compiler supports -Wno-missing-field-initializers... yes
  checking whether compiler supports -Wno-missing-attributes... no
  checking whether compiler supports -pipe... yes
  checking whether compiler supports -g3... yes
  checking how to run the C preprocessor... cc -E
  checking for grep that handles long lines and -e... /usr/bin/grep
  checking for egrep... /usr/bin/grep -E
  checking for ANSI C header files... yes
  checking for sys/types.h... yes
  checking for sys/stat.h... yes
  checking for stdlib.h... yes
  checking for string.h... yes
  checking for memory.h... yes
  checking for strings.h... yes
  checking for inttypes.h... yes
  checking for stdint.h... yes
  checking for unistd.h... yes
  checking whether byte ordering is bigendian... no
  checking size of void *... 8
  checking size of int... 4
  checking size of long... 8
  checking size of long long... 8
  checking size of intmax_t... 8
  checking build system type... x86_64-unknown-openbsd
  checking host system type... x86_64-unknown-openbsd
  checking whether pause instruction is compilable... yes
  checking number of significant virtual address bits... 48
  checking for x86_64-unknown-openbsd-ar... no
  checking for ar... ar
  checking for x86_64-unknown-openbsd-nm... no
  checking for nm... nm
  checking for gawk... no
  checking for mawk... no
  checking for nawk... no
  checking for awk... awk
  checking malloc.h usability... no
  checking malloc.h presence... no
  checking for malloc.h... no
  checking for library containing log... -lm
  checking whether __attribute__ syntax is compilable... yes
  checking whether compiler supports -fvisibility=hidden... yes
  checking whether compiler supports -fvisibility=hidden... no
  checking whether compiler supports -Werror... yes
  checking whether compiler supports -herror_on_warning... no
  checking whether tls_model attribute is compilable... yes
  checking whether compiler supports -Werror... yes
  checking whether compiler supports -herror_on_warning... no
  checking whether alloc_size attribute is compilable... yes
  checking whether compiler supports -Werror... yes
  checking whether compiler supports -herror_on_warning... no
  checking whether format(gnu_printf, ...) attribute is compilable... no
  checking whether compiler supports -Werror... yes
  checking whether compiler supports -herror_on_warning... no
  checking whether format(printf, ...) attribute is compilable... yes
  checking whether compiler supports -Werror... yes
  checking whether compiler supports -herror_on_warning... no
  checking whether format(printf, ...) attribute is compilable... yes
  checking whether compiler supports -Wimplicit-fallthrough... yes
  checking whether fallthrough attribute is compilable... yes
  checking whether compiler supports -Wimplicit-fallthrough... yes
  checking whether compiler supports -Wimplicit-fallthrough... no
  checking whether compiler supports -Werror... yes
  checking whether compiler supports -herror_on_warning... no
  checking whether cold attribute is compilable... yes
  checking whether vm_make_tag is compilable... no
  checking for a BSD-compatible install... /usr/bin/install -c
  checking for x86_64-unknown-openbsd-ranlib... no
  checking for ranlib... ranlib
  checking for ld... /usr/bin/ld
  checking for autoconf... false
  checking for memalign... no
  checking for valloc... yes
  checking for malloc_size... no
  checking whether compiler supports -O3... yes
  checking whether compiler supports -O3... no
  checking whether compiler supports -funroll-loops... yes
  checking configured backtracing method... N/A
  checking for sbrk... yes
  checking whether utrace(2) is compilable... no
  checking whether utrace(2) with label is compilable... yes
  checking whether a program using __builtin_unreachable is compilable... yes
  checking whether a program using __builtin_ffsl is compilable... yes
  checking whether a program using __builtin_popcountl is compilable... yes
  checking LG_PAGE... 12
  checking pthread.h usability... yes
  checking pthread.h presence... yes
  checking for pthread.h... yes
  checking for pthread_create in -lpthread... yes
  checking dlfcn.h usability... yes
  checking dlfcn.h presence... yes
  checking for dlfcn.h... yes
  checking for dlsym... yes
  checking whether pthread_atfork(3) is compilable... yes
  checking whether pthread_setname_np(3) is compilable... no
  checking whether pthread_getname_np(3) is compilable... no
  checking whether pthread_get_name_np(3) is compilable... yes
  checking for library containing clock_gettime... none required
  checking whether clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is compilable... no
  checking whether clock_gettime(CLOCK_MONOTONIC, ...) is compilable... yes
  checking whether mach_absolute_time() is compilable... no
  checking whether clock_gettime(CLOCK_REALTIME, ...) is compilable... yes
  checking whether compiler supports -Werror... yes
  checking whether syscall(2) is compilable... yes
  checking for secure_getenv... no
  checking for sched_getcpu... no
  checking for sched_setaffinity... no
  checking for issetugid... yes
  checking for _malloc_thread_cleanup... no
  checking for _pthread_mutex_init_calloc_cb... no
  checking for memcntl... no
  checking whether C11 atomics is compilable... yes
  checking whether GCC __atomic atomics is compilable... yes
  checking whether GCC 8-bit __atomic atomics is compilable... yes
  checking whether GCC __sync atomics is compilable... yes
  checking whether GCC 8-bit __sync atomics is compilable... yes
  checking whether Darwin OSAtomic*() is compilable... no
  checking whether madvise(2) is compilable... yes
  checking whether madvise(..., MADV_FREE) is compilable... yes
  checking whether madvise(..., MADV_DONTNEED) is compilable... yes
  checking whether madvise(..., MADV_DO[NT]DUMP) is compilable... no
  checking whether madvise(..., MADV_[NO]HUGEPAGE) is compilable... no
  checking whether madvise(..., MADV_[NO]CORE) is compilable... no
  checking whether mprotect(2) is compilable... yes
  checking for __builtin_clz... yes
  checking whether Darwin os_unfair_lock_*() is compilable... no
  checking whether pthreads adaptive mutexes is compilable... no
  checking whether compiler supports -D_GNU_SOURCE... yes
  checking whether compiler supports -Werror... yes
  checking whether compiler supports -herror_on_warning... no
  checking whether strerror_r returns char with gnu source is compilable... no
  checking for stdbool.h that conforms to C99... yes
  checking for _Bool... yes
  configure: creating ./config.status
  config.status: creating Makefile
  config.status: creating jemalloc.pc
  config.status: creating doc/html.xsl
  config.status: creating doc/manpages.xsl
  config.status: creating doc/jemalloc.xml
  config.status: creating include/jemalloc/jemalloc_macros.h
  config.status: creating include/jemalloc/jemalloc_protos.h
  config.status: creating include/jemalloc/jemalloc_typedefs.h
  config.status: creating include/jemalloc/internal/jemalloc_preamble.h
  config.status: creating test/test.sh
  config.status: creating test/include/test/jemalloc_test.h
  config.status: creating config.stamp
  config.status: creating bin/jemalloc-config
  config.status: creating bin/jemalloc.sh
  config.status: creating bin/jeprof
  config.status: creating include/jemalloc/jemalloc_defs.h
  config.status: creating include/jemalloc/internal/jemalloc_internal_defs.h
  config.status: creating test/include/test/jemalloc_test_defs.h
  config.status: executing include/jemalloc/internal/public_symbols.txt commands
  config.status: executing include/jemalloc/internal/private_symbols.awk commands
  config.status: executing include/jemalloc/internal/private_symbols_jet.awk commands
  config.status: executing include/jemalloc/internal/public_namespace.h commands
  config.status: executing include/jemalloc/internal/public_unnamespace.h commands
  config.status: executing include/jemalloc/jemalloc_protos_jet.h commands
  config.status: executing include/jemalloc/jemalloc_rename.h commands
  config.status: executing include/jemalloc/jemalloc_mangle.h commands
  config.status: executing include/jemalloc/jemalloc_mangle_jet.h commands
  config.status: executing include/jemalloc/jemalloc.h commands
  ===============================================================================
  jemalloc version   : 0.8.9-63-gc5fb16cd9814fa8f46850da123f2b30093ebb26d
  library revision   : 2

  CONFIG             : --disable-cxx --enable-doc=no --enable-shared=no --with-jemalloc-prefix=_rjem_ --with-private-namespace=_rjem_ --ho
st=x86_64-unknown-openbsd --build=x86_64-unknown-openbsd --prefix=/root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-5e127b369745
e7b9/out build_alias=x86_64-unknown-openbsd host_alias=x86_64-unknown-openbsd CC=cc 'CFLAGS=-O3 -ffunction-sections -fdata-sections -fPIC
-m64 -Wall' 'LDFLAGS=-O3 -ffunction-sections -fdata-sections -fPIC -m64 -Wall' 'CPPFLAGS=-O3 -ffunction-sections -fdata-sections -fPIC -m6
4 -Wall'
  CC                 : cc
  CONFIGURE_CFLAGS   : -std=gnu11 -Werror=unknown-warning-option -Wall -Wextra -Wshorten-64-to-32 -Wsign-compare -Wundef -Wno-format-zero-
length -Wpointer-arith -Wno-missing-braces -Wno-missing-field-initializers -pipe -g3 -fvisibility=hidden -Wimplicit-fallthrough -O3 -funro
ll-loops
  SPECIFIED_CFLAGS   : -O3 -ffunction-sections -fdata-sections -fPIC -m64 -Wall
  EXTRA_CFLAGS       :
  CPPFLAGS           : -O3 -ffunction-sections -fdata-sections -fPIC -m64 -Wall -D_REENTRANT
  CXX                :
  CONFIGURE_CXXFLAGS :
  SPECIFIED_CXXFLAGS :
  EXTRA_CXXFLAGS     :
  LDFLAGS            : -O3 -ffunction-sections -fdata-sections -fPIC -m64 -Wall
  EXTRA_LDFLAGS      :
  DSO_LDFLAGS        : -shared -Wl,-soname,$(@F)
  LIBS               : -lm  -pthread
  RPATH_EXTRA        :

  XSLTPROC           : false
  XSLROOT            :

  PREFIX             : /root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-5e127b369745e7b9/out
  BINDIR             : /root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-5e127b369745e7b9/out/bin
  DATADIR            : /root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-5e127b369745e7b9/out/share
  INCLUDEDIR         : /root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-5e127b369745e7b9/out/include
  LIBDIR             : /root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-5e127b369745e7b9/out/lib
  MANDIR             : /root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-5e127b369745e7b9/out/share/man
                                                                                                                                   [0/882]
  srcroot            :
  abs_srcroot        : /root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-5e127b369745e7b9/out/build/
  objroot            :
  abs_objroot        : /root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-5e127b369745e7b9/out/build/

  JEMALLOC_PREFIX    : _rjem_
  JEMALLOC_PRIVATE_NAMESPACE
                     : _rjem_je_
  install_suffix     :
  malloc_conf        :
  documentation      : 0
  shared libs        : 0
  static libs        : 1
  autogen            : 0
  debug              : 0
  stats              : 1
  experimental_smallocx : 0
  prof               : 0
  prof-libunwind     : 0
  prof-libgcc        : 0
  prof-gcc           : 0
  fill               : 1
  utrace             : 0
  xmalloc            : 0
  log                : 0
  lazy_lock          : 0
  cache-oblivious    : 1
  cxx                : 0
  ===============================================================================
  running: cd "/root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-5e127b369745e7b9/out/build" && "gmake" "-j" "1"
  cc -std=gnu11 -Werror=unknown-warning-option -Wall -Wextra -Wshorten-64-to-32 -Wsign-compare -Wundef -Wno-format-zero-length -Wpointer-a
rith -Wno-missing-braces -Wno-missing-field-initializers -pipe -g3 -fvisibility=hidden -Wimplicit-fallthrough -O3 -funroll-loops -O3 -ffun
ction-sections -fdata-sections -fPIC -m64 -Wall -c -O3 -ffunction-sections -fdata-sections -fPIC -m64 -Wall -D_REENTRANT -Iinclude -Iinclu
de -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/jemalloc.sym.o src/jemalloc.c
  nm -a src/jemalloc.sym.o | awk -f include/jemalloc/internal/private_symbols.awk > src/jemalloc.sym
  cc -std=gnu11 -Werror=unknown-warning-option -Wall -Wextra -Wshorten-64-to-32 -Wsign-compare -Wundef -Wno-format-zero-length -Wpointer-a
rith -Wno-missing-braces -Wno-missing-field-initializers -pipe -g3 -fvisibility=hidden -Wimplicit-fallthrough -O3 -funroll-loops -O3 -ffun
ction-sections -fdata-sections -fPIC -m64 -Wall -c -O3 -ffunction-sections -fdata-sections -fPIC -m64 -Wall -D_REENTRANT -Iinclude -Iinclu
de -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/arena.sym.o src/arena.c
  nm -a src/arena.sym.o | awk -f include/jemalloc/internal/private_symbols.awk > src/arena.sym
  cc -std=gnu11 -Werror=unknown-warning-option -Wall -Wextra -Wshorten-64-to-32 -Wsign-compare -Wundef -Wno-format-zero-length -Wpointer-a
rith -Wno-missing-braces -Wno-missing-field-initializers -pipe -g3 -fvisibility=hidden -Wimplicit-fallthrough -O3 -funroll-loops -O3 -ffun
ction-sections -fdata-sections -fPIC -m64 -Wall -c -O3 -ffunction-sections -fdata-sections -fPIC -m64 -Wall -D_REENTRANT -Iinclude -Iinclu
de -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/background_thread.sym.o src/background_thread.c

  --- stderr
  src/background_thread.c:87:2: error: unknown type name 'cpuset_t'; did you mean 'psset_t'?
          cpuset_t cpuset;
          ^~~~~~~~
          psset_t
  include/jemalloc/internal/psset.h:63:24: note: 'psset_t' declared here
  typedef struct psset_s psset_t;
                         ^
  src/background_thread.c:94:2: warning: implicit declaration of function 'CPU_ZERO' is invalid in C99 [-Wimplicit-function-declaration]
          CPU_ZERO(&cpuset);
          ^
  src/background_thread.c:95:2: warning: implicit declaration of function 'CPU_SET' is invalid in C99 [-Wimplicit-function-declaration]
          CPU_SET(cpu, &cpuset);
          ^
  src/background_thread.c:104:12: warning: implicit declaration of function 'pthread_setaffinity_np' is invalid in C99 [-Wimplicit-functio
n-declaration]
          int ret = pthread_setaffinity_np(pthread_self(), sizeof(cpuset_t),
                    ^
  src/background_thread.c:104:58: error: use of undeclared identifier 'cpuset_t'
          int ret = pthread_setaffinity_np(pthread_self(), sizeof(cpuset_t),
                                                                  ^
  3 warnings and 2 errors generated.
  gmake: *** [Makefile:479: src/background_thread.sym.o] Error 1
  thread 'main' panicked at 'command did not execute successfully: cd "/root/nostr-rs-relay/target/release/build/tikv-jemalloc-sys-5e127b3
69745e7b9/out/build" && "gmake" "-j" "1"
  expected success, got: exit status: 2', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tikv-jemalloc-sys-0.5.4+5.3.0-patched
/build.rs:351:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I assume cpuset_t is coming from cpuset (linux, freebsd). However, from what I saw, there is (was?) no such thing in OpenBSD.

Would it be possible to make jemalloc an optional dependency for only platforms supporting it? From what I've seen other projects have had similar issues with this package before.