r-lib / ps

R package to query, list, manipulate system processes
https://ps.r-lib.org/
Other
72 stars 18 forks source link

Can't build the package on OpenBSD 7.1 #125

Closed jp-luiggi closed 2 years ago

jp-luiggi commented 2 years ago

While trying to install the "tidyverse" package, that one needed the "ps" package. The latter cannot build on OpenBSD 7.1 because of the lack of some data.

undefined symbol 'psll_memory_uss' undefined symbol 'psll_get_cpu_aff' undefined symbol 'psll_set_cpu_aff' undefined symbol 'ps__memory_maps'


"ps" package cannot build on OpenBSD 7.1

cc -I"/usr/local/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -pipe  -c error-codes.c -o error-codes.o
cc -shared -fPIC -L/usr/local/lib/R/lib -L/usr/local/lib -Wl,-R/usr/local/lib/R/lib -o ps.so init.o api-common.o common.o extra.o dummy.o error-codes.o -L/usr/local/lib/R/lib -lR
installing via 'install.libs.R' to /usr/local/lib/R/library/00LOCK-ps/00new/ps
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
R:/usr/local/lib/R/library/00LOCK-ps/00new/ps/libs/ps.so: undefined symbol 'psll_memory_uss'
R:/usr/local/lib/R/library/00LOCK-ps/00new/ps/libs/ps.so: undefined symbol 'psll_get_cpu_aff'
R:/usr/local/lib/R/library/00LOCK-ps/00new/ps/libs/ps.so: undefined symbol 'psll_set_cpu_aff'
R:/usr/local/lib/R/library/00LOCK-ps/00new/ps/libs/ps.so: undefined symbol 'ps__memory_maps'
Error: package or namespace load failed for ‘ps’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/local/lib/R/library/00LOCK-ps/00new/ps/libs/ps.so':
  Cannot load specified object
Error: loading failed
Execution halted
jp-luiggi commented 2 years ago

I did not tried to install the package on FreeBSD (will do it soonly) but I managed to did a fix on OpenBSD using preprocessor in "init.c"

ifdef PS__LINUX

ifdef PS__MACOS

ifdef PS__WINDOWS

{ "psll_memory_uss", (DL_FUNC) psll_memory_uss, 1 },

endif

endif

endif

ifdef PS__LINUX

ifdef PS__MACOS

ifdef PS__WINDOWS

{ "psll_get_cpu_aff", (DL_FUNC) psll_get_cpu_aff, 1 }, { "psll_set_cpu_aff", (DL_FUNC) psll_set_cpu_aff, 2 },

endif

endif

endif

ifdef PS__LINUX

ifdef PS__MACOS

ifdef PS__WINDOWS

{ "psmemory_maps", (DL_FUNC) psmemory_maps, 1 },

endif

endif

endif

gaborcsardi commented 2 years ago

Did you try the latest commit in the main branch?

wesnm commented 2 years ago

Can confirm that it now builds on FreeBSD, with these warnings:

dummy.c:74:49: warning: non-void function does not return a value
      [-Wreturn-type]
SEXP ps__tty_size() { ps__dummy("ps_tty_size"); }
                                                ^
dummy.c:75:69: warning: non-void function does not return a value
      [-Wreturn-type]
SEXP ps__disk_partitions(SEXP x) { ps__dummy("ps_disk_partitions"); }
                                                                    ^
dummy.c:76:53: warning: non-void function does not return a value
      [-Wreturn-type]
SEXP ps__disk_usage() { ps__dummy("ps_disk_usage"); }
                                                    ^
dummy.c:78:59: warning: non-void function does not return a value
      [-Wreturn-type]
SEXP ps__system_memory() { ps__dummy("ps_system_memory"); }
                                                          ^
dummy.c:79:55: warning: non-void function does not return a value
      [-Wreturn-type]
SEXP ps__system_swap() { ps__dummy("ps_system_swap"); }