[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1001352: libc6-dev: pthread.h, setjmp.h: Include order matters (__sigsetjmp compilation error)



Package: libc6-dev
Version: 2.32-5
Severity: normal
Tags: upstream
X-Debbugs-Cc: alx.manpages@gmail.com, libc-alpha@sourceware.org, unit@nginx.org

Dear Maintainer,

Building Nginx Unit from source results in a compilation error.
I tried both Debian 11 and Debian Sid (12),
and the bug is reproducible in Sid only.

To reproduce the problem, install the following packages:

  git, build-essential, libpcre2-dev

Then execute the following commands:

  git clone https://github.com/nginx/unit.git
  cd unit/
  ./configure
  make

You will see the following error:


---

cc -c -pipe -fPIC -fvisibility=hidden -O -W -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wmissing-prototypes -Werror -g -I src -I build   \
                      \
                     \
-o build/src/nxt_thread.o \
-MMD -MF build/src/nxt_thread.dep -MT build/src/nxt_thread.o \
src/nxt_thread.c
In file included from src/nxt_unix.h:187,
                 from src/nxt_main.h:31,
                 from src/nxt_thread.c:7:
src/nxt_thread.c: In function ‘nxt_thread_trampoline’:
src/nxt_thread.c:114:5: error: ‘__sigsetjmp’ accessing 200 bytes in a region of size 72 [-Werror=stringop-overflow=]
  114 |     pthread_cleanup_push(nxt_thread_time_cleanup, thr);
      |     ^~~~~~~~~~~~~~~~~~~~
src/nxt_thread.c:114:5: note: referencing argument 1 of type ‘struct __jmp_buf_tag *’
/usr/include/pthread.h:734:12: note: in a call to function ‘__sigsetjmp’
  734 | extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;
      |            ^~~~~~~~~~~
cc1: all warnings being treated as errors 

---


If you reverse the order of the includes <pthread.h> and <setjmp.h>,
which are included in <src/nxt_unix.h> (in the nginx unit source code),
the error disappears:


On 12/8/21 22:37, Valentin V. Bartenev wrote:
> diff --git a/src/nxt_unix.h b/src/nxt_unix.h
> --- a/src/nxt_unix.h
> +++ b/src/nxt_unix.h
> @@ -153,6 +153,7 @@
>   #include <poll.h>
>   #include <pwd.h>
>   #include <semaphore.h>
> +#include <pthread.h>
>   #include <setjmp.h>
>   #include <sched.h>
>   #include <signal.h>
> @@ -184,7 +185,6 @@
>   #include <sys/wait.h>
>   #include <time.h>
>   #include <unistd.h>
> -#include <pthread.h>
>   
>   #if (NXT_HAVE_EPOLL)
>   #include <sys/epoll.h>

The above workaround silences the error.


Regards,
Alex


-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.15.0-2-amd64 (SMP w/12 CPU threads)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libc6-dev depends on:
ii  libc-dev-bin    2.32-5
ii  libc6           2.32-5
ii  libcrypt-dev    1:4.4.26-1
ii  libnsl-dev      1.3.0-2
ii  linux-libc-dev  5.15.5-1
ii  rpcsvc-proto    1.4.2-4

libc6-dev recommends no packages.

Versions of packages libc6-dev suggests:
pn  glibc-doc     <none>
ii  manpages-dev  5.10-1

-- no debconf information

Reply to: