colis-anr / morbig

A static parser for POSIX Shell
Other
190 stars 8 forks source link

Building the examples fails in CI on Debian and openSUSE #139

Closed Niols closed 1 year ago

Niols commented 1 year ago

Actually, since the opam-based CI does not build the examples, I am a bit afraid that it might be more general than that. I will need to investigate.

To reproduce

Build the Docker image for Debian:

$ docker build . --tag morbig --build-arg tag=debian

This should be fine.

Then run the tests in the same way the CI does:

$ docker run --entrypoint /bin/sh morbig -c 'eval $(opam env) && cd /home/opam/morbig && make check && make install && make examples && make uninstall'

... a bunch of things ...

find examples -name 'Makefile' | \
    while read file; do dirname "$file"; done | \
    xargs -n1 make -C
make[1]: Entering directory '/home/opam/morbig/examples/c'
cc -o dump -I /home/opam/.opam/5.0/lib/ocaml -I /home/opam/.opam/5.0/lib/morbig \
            dump.c /home/opam/.opam/5.0/lib/morbig/libmorbigc.o -lm -ldl
/usr/bin/ld: /home/opam/.opam/5.0/lib/morbig/libmorbigc.o: in function `install_backup_thread':
/home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/domain.c:1005: undefined reference to `pthread_sigmask'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/domain.c:1009: undefined reference to `pthread_create'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/domain.c:1012: undefined reference to `pthread_sigmask'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/domain.c:1018: undefined reference to `pthread_detach'
/usr/bin/ld: /home/opam/.opam/5.0/lib/morbig/libmorbigc.o: in function `domain_thread_func':
/home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/domain.c:1086: undefined reference to `pthread_sigmask'
/usr/bin/ld: /home/opam/.opam/5.0/lib/morbig/libmorbigc.o: in function `domain_terminate':
/home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/domain.c:1662: undefined reference to `pthread_sigmask'
/usr/bin/ld: /home/opam/.opam/5.0/lib/morbig/libmorbigc.o: in function `caml_domain_spawn':
/home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/domain.c:1148: undefined reference to `pthread_sigmask'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/domain.c:1151: undefined reference to `pthread_create'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/domain.c:1154: undefined reference to `pthread_sigmask'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/domain.c:1178: undefined reference to `pthread_detach'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/domain.c:1182: undefined reference to `pthread_join'
/usr/bin/ld: /home/opam/.opam/5.0/lib/morbig/libmorbigc.o: in function `caml_plat_try_lock':
/home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/caml/platform.h:162: undefined reference to `pthread_mutex_trylock'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/caml/platform.h:162: undefined reference to `pthread_mutex_trylock'
/usr/bin/ld: /home/opam/.opam/5.0/lib/morbig/libmorbigc.o: in function `caml_recommended_domain_count':
/home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/domain.c:1795: undefined reference to `pthread_getaffinity_np'
/usr/bin/ld: /home/opam/.opam/5.0/lib/morbig/libmorbigc.o: in function `caml_plat_try_lock':
/home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/caml/platform.h:162: undefined reference to `pthread_mutex_trylock'
/usr/bin/ld: /home/opam/.opam/5.0/lib/morbig/libmorbigc.o: in function `caml_plat_mutex_init':
/home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/platform.c:50: undefined reference to `pthread_mutexattr_init'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/platform.c:52: undefined reference to `pthread_mutexattr_settype'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/platform.c:57: undefined reference to `pthread_mutexattr_destroy'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/platform.c:57: undefined reference to `pthread_mutexattr_destroy'
/usr/bin/ld: /home/opam/.opam/5.0/lib/morbig/libmorbigc.o: in function `caml_plat_cond_init_aux':
/home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/platform.c:96: undefined reference to `pthread_condattr_setclock'
/usr/bin/ld: /home/opam/.opam/5.0/lib/morbig/libmorbigc.o: in function `caml_execute_signal_exn':
/home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/signals.c:216: undefined reference to `pthread_sigmask'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/signals.c:229: undefined reference to `pthread_sigmask'
/usr/bin/ld: /home/opam/.opam/5.0/lib/morbig/libmorbigc.o: in function `caml_process_pending_signals_exn':
/home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/signals.c:75: undefined reference to `pthread_sigmask'
/usr/bin/ld: /home/opam/.opam/5.0/lib/morbig/libmorbigc.o: in function `sync_mutex_create':
/home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/sync_posix.h:40: undefined reference to `pthread_mutexattr_init'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/sync_posix.h:54: undefined reference to `pthread_mutexattr_destroy'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/sync_posix.h:42: undefined reference to `pthread_mutexattr_settype'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/sync_posix.h:54: undefined reference to `pthread_mutexattr_destroy'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/sync_posix.h:48: undefined reference to `pthread_mutexattr_destroy'
/usr/bin/ld: /home/opam/.opam/5.0/lib/morbig/libmorbigc.o: in function `sync_mutex_trylock':
/home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/sync_posix.h:77: undefined reference to `pthread_mutex_trylock'
/usr/bin/ld: /home/opam/.opam/5.0/.opam-switch/build/ocaml-base-compiler.5.0.0/runtime/sync_posix.h:77: undefined reference to `pthread_mutex_trylock'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:7: all] Error 1
make[1]: Leaving directory '/home/opam/morbig/examples/c'
make: *** [Makefile:42: examples] Error 123
Niols commented 1 year ago

Note: this seems to be the same for openSUSE.

yurug commented 1 year ago

The issue looks like a -lpthreads missing somewhere.

Niols commented 1 year ago

Surprisingly, building the examples is fine on all the other infrastructures, in all OPAM-based and APT-based CIs. The only two infrastructures where building examples does not work are the ones mentioned above, Debian (stable) and openSUSE. Still, I will look for a potentially missing -lpthreads.

Niols commented 1 year ago

Nice catch! cf #143.