Hello,
I recently tried to build uclibc-ng configured with NPTL posix threads implementation for x86_64 system. Build fails, which I believe is a bug.
The error occurs when compiling `libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S`, it takes the false branch in
``` #if USE___THREAD ... #else ... #endif ```
which contains #error preprocessor directive.
I tried to understand why it happens. Turns out the `USE___THREAD` macro is not defined when compiling this file and false branch in always taken. This macro is defined in tls.h, however this header files in not included directly or indirectly.
This issue should affect all assembler code in `libpthread/nptl/sysdeps/unix/sysv/linux/x86_64` since it all have preprocessor conditions depending on `USE___THREAD` macro.
Directly including tls.h fixes the build error.
- Kirill Makurin
Hi, Kirill Makurin wrote,
Hello,
I recently tried to build uclibc-ng configured with NPTL posix threads implementation for x86_64 system. Build fails, which I believe is a bug.
Did you cross-compile or native? What version of binutils,gcc and Linux are you using? Can you attach your .config? What is the exact build error you get?
best regards Waldemar
I attached the config I am currently using. It enables most of library features, except for some glibc-compatibility and obsolete stuff.
I was doing native compilation on a Debian 12 system (gcc 12.2, binutils 2.40), but I was using Linux headers v6.14 for the build.
Compilation fails with the following diagnostic:
``` libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:122:3: error: #error "not supported. %rcx and %rdi must be preserved" 122 | # error "not supported. %rcx and %rdi must be preserve | ^~~~~
```
As I have mentioned, including tls.h from this file seems to fix the issue.
- Kirill Makurin
________________________________ From: Waldemar Brodkorb wbx@openadk.org Sent: Monday, May 26, 2025 3:34 PM To: Kirill Makurin maiddaisuki@outlook.com Cc: devel@uclibc-ng.org devel@uclibc-ng.org Subject: Re: [uclibc-ng-devel] build error for x86_64 with NPTL
Hi, Kirill Makurin wrote,
Hello,
I recently tried to build uclibc-ng configured with NPTL posix threads implementation for x86_64 system. Build fails, which I believe is a bug.
Did you cross-compile or native? What version of binutils,gcc and Linux are you using? Can you attach your .config? What is the exact build error you get?
best regards Waldemar
Hi Kirill, Kirill Makurin wrote,
I attached the config I am currently using. It enables most of library features, except for some glibc-compatibility and obsolete stuff.
I was doing native compilation on a Debian 12 system (gcc 12.2, binutils 2.40), but I was using Linux headers v6.14 for the build.
Compilation fails with the following diagnostic:
libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:122:3: error: #error "not supported. %rcx and %rdi must be preserved" 122 | # error "not supported. %rcx and %rdi must be preserve | ^~~~~
As I have mentioned, including tls.h from this file seems to fix the issue.
Hmm, I can't reproduce the issue. Makefile.arch does set ASFLAGS. Did you override ASFLAGS somehow in your environment overwriting the default from uClibc-ng?
best regards Waldemar
Oh, it really seems to be my mistake. I was using my own build script to build and install uclibc-ng (together with some other packages) and I was passing ASFLAGS among other common variables to make invocation.
Removing ASFLAGS from make invocation fixes the build error. Thank you for pointing out.
- Kirill Makurin ________________________________ From: Waldemar Brodkorb wbx@openadk.org Sent: Monday, May 26, 2025 11:22 PM To: Kirill Makurin maiddaisuki@outlook.com Cc: devel@uclibc-ng.org devel@uclibc-ng.org Subject: Re: [uclibc-ng-devel] Re: build error for x86_64 with NPTL
Hi Kirill, Kirill Makurin wrote,
I attached the config I am currently using. It enables most of library features, except for some glibc-compatibility and obsolete stuff.
I was doing native compilation on a Debian 12 system (gcc 12.2, binutils 2.40), but I was using Linux headers v6.14 for the build.
Compilation fails with the following diagnostic:
libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:122:3: error: #error "not supported. %rcx and %rdi must be preserved" 122 | # error "not supported. %rcx and %rdi must be preserve | ^~~~~
As I have mentioned, including tls.h from this file seems to fix the issue.
Hmm, I can't reproduce the issue. Makefile.arch does set ASFLAGS. Did you override ASFLAGS somehow in your environment overwriting the default from uClibc-ng?
best regards Waldemar