public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* error: ‘__libc_single_threaded_internal’ undeclared
@ 2022-11-20 13:55 Saifi Khan
  2022-11-20 17:18 ` Adhemerval Zanella
  0 siblings, 1 reply; 5+ messages in thread
From: Saifi Khan @ 2022-11-20 13:55 UTC (permalink / raw)
  To: libc-help

Hi:

Trying to perform a 'out-of-source-tree' build glibc 'main' on K:  6.0.0-4-amd64, L: (Debian GLIBC 2.36-5), C: gcc 12.2.0.

The following error is encountered.

gcc-12 ../sysdeps/unix/sysv/linux/sigsuspend.c -c -std=gnu11 -fgnu89-inline  -O2 -pipe -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common -Wstrict-prototypes -Wold-style-definition -fmath-errno    -fPIC -fexceptions -fasynchronous-unwind-tables  -ftls-model=initial-exec      -I../include -I/opt/work/linux/glibc/build/signal  -I/opt/work/linux/glibc/build  -I../sysdeps/unix/sysv/linux/x86_64/64  -I../sysdeps/unix/sysv/linux/x86_64  -I../sysdeps/unix/sysv/linux/x86/include -I../sysdeps/unix/sysv/linux/x86  -I../sysdeps/x86/nptl  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/x86_64/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/x86_64  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/x86_64/64  -I../sysdeps/x86_64/fpu/multiarch  -I../sysdeps/x86_64/fpu  -I../sysdeps/x86/fpu  -I../sysdeps/x86_64/multiarch  -I../sysdeps/x86_64  -I../sysdeps/x86/include -I../sysdeps/x86  -I../sysdeps/ieee754/float128  -I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/wordsize-64  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.  -D_LIBC_REENTRANT -include /opt/work/linux/glibc/build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h  -DPIC -DSHARED     -DTOP_NAMESPACE=glibc -o /opt/work/linux/glibc/build/signal/sigsuspend.os -MD -MP -MF /opt/work/linux/glibc/build/signal/sigsuspend.os.dt -MT /opt/work/linux/glibc/build/signal/sigsuspend.os
In file included from ../sysdeps/unix/sysv/linux/x86_64/single-thread.h:2,
                 from ../sysdeps/unix/sysdep.h:19,
                 from ../sysdeps/unix/x86_64/sysdep.h:18,
                 from ../sysdeps/unix/sysv/linux/x86_64/sysdep.h:23,
                 from ../sysdeps/unix/sysv/linux/sysdep-cancel.h:23,
                 from ../sysdeps/unix/sysv/linux/sigsuspend.c:19:
../sysdeps/unix/sysv/linux/sigsuspend.c: In function ‘__sigsuspend’:
../sysdeps/unix/sysv/linux/single-thread.h:38:27: error: ‘__libc_single_threaded_internal’ undeclared (first use in this function); did you mean ‘__libc_single_threaded’?

   38 | # define SINGLE_THREAD_P (__libc_single_threaded_internal != 0)
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../sysdeps/unix/sysdep.h:115:37: note: in expansion of macro ‘SINGLE_THREAD_P’
  115 | # define NO_SYSCALL_CANCEL_CHECKING SINGLE_THREAD_P
      |                                     ^~~~~~~~~~~~~~~
../sysdeps/unix/sysdep.h:121:9: note: in expansion of macro ‘NO_SYSCALL_CANCEL_CHECKING’
  121 |     if (NO_SYSCALL_CANCEL_CHECKING)                                          \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/sigsuspend.c:26:10: note: in expansion of macro ‘SYSCALL_CANCEL’
   26 |   return SYSCALL_CANCEL (rt_sigsuspend, set, __NSIG_BYTES);
      |          ^~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/single-thread.h:38:27: note: each undeclared identifier is reported only once for each function it appears in
   38 | # define SINGLE_THREAD_P (__libc_single_threaded_internal != 0)
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../sysdeps/unix/sysdep.h:115:37: note: in expansion of macro ‘SINGLE_THREAD_P’
  115 | # define NO_SYSCALL_CANCEL_CHECKING SINGLE_THREAD_P
      |                                     ^~~~~~~~~~~~~~~
../sysdeps/unix/sysdep.h:121:9: note: in expansion of macro ‘NO_SYSCALL_CANCEL_CHECKING’
  121 |     if (NO_SYSCALL_CANCEL_CHECKING)                                          \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/sigsuspend.c:26:10: note: in expansion of macro ‘SYSCALL_CANCEL’
   26 |   return SYSCALL_CANCEL (rt_sigsuspend, set, __NSIG_BYTES);
      |          ^~~~~~~~~~~~~~
make[2]: *** [/opt/work/linux/glibc/build/sysd-rules:229: /opt/work/linux/glibc/build/signal/sigsuspend.os] Error 1
make[2]: Leaving directory '/opt/work/linux/glibc/src/signal'
make[1]: *** [Makefile:484: signal/subdir_lib] Error 2
make[1]: Leaving directory '/opt/work/linux/glibc/src'
make: *** [Makefile:9: all] Error 2

Has anybody encountered this before ? Any pointers ?

warm regards
Saifi.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: error: ‘__libc_single_threaded_internal’ undeclared
  2022-11-20 13:55 error: ‘__libc_single_threaded_internal’ undeclared Saifi Khan
@ 2022-11-20 17:18 ` Adhemerval Zanella
  2022-11-20 17:41   ` Saifi Khan
  0 siblings, 1 reply; 5+ messages in thread
From: Adhemerval Zanella @ 2022-11-20 17:18 UTC (permalink / raw)
  To: Saifi Khan; +Cc: libc-help

On Sun, Nov 20, 2022 at 10:55 AM Saifi Khan <saifi.khan@nishan.io> wrote:
>
> Hi:
>
> Trying to perform a 'out-of-source-tree' build glibc 'main' on K:  6.0.0-4-amd64, L: (Debian GLIBC 2.36-5), C: gcc 12.2.0.
>
> The following error is encountered.
>
> gcc-12 ../sysdeps/unix/sysv/linux/sigsuspend.c -c -std=gnu11 -fgnu89-inline  -O2 -pipe -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common -Wstrict-prototypes -Wold-style-definition -fmath-errno    -fPIC -fexceptions -fasynchronous-unwind-tables  -ftls-model=initial-exec      -I../include -I/opt/work/linux/glibc/build/signal  -I/opt/work/linux/glibc/build  -I../sysdeps/unix/sysv/linux/x86_64/64  -I../sysdeps/unix/sysv/linux/x86_64  -I../sysdeps/unix/sysv/linux/x86/include -I../sysdeps/unix/sysv/linux/x86  -I../sysdeps/x86/nptl  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/x86_64/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/x86_64  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/x86_64/64  -I../sysdeps/x86_64/fpu/multiarch  -I../sysdeps/x86_64/fpu  -I../sysdeps/x86
>  /fpu  -I../sysdeps/x86_64/multiarch  -I../sysdeps/x86_64  -I../sysdeps/x86/include -I../sysdeps/x86  -I../sysdeps/ieee754/float128  -I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/wordsize-64  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.  -D_LIBC_REENTRANT -include /opt/work/linux/glibc/build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h  -DPIC -DSHARED     -DTOP_NAMESPACE=glibc -o /opt/work/linux/glibc/build/signal/sigsuspend.os -MD -MP -MF /opt/work/linux/glibc/build/signal/sigsuspend.os.dt -MT /opt/work/linux/glibc/build/signal/sigsuspend.os
> In file included from ../sysdeps/unix/sysv/linux/x86_64/single-thread.h:2,
>                  from ../sysdeps/unix/sysdep.h:19,
>                  from ../sysdeps/unix/x86_64/sysdep.h:18,
>                  from ../sysdeps/unix/sysv/linux/x86_64/sysdep.h:23,
>                  from ../sysdeps/unix/sysv/linux/sysdep-cancel.h:23,
>                  from ../sysdeps/unix/sysv/linux/sigsuspend.c:19:
> ../sysdeps/unix/sysv/linux/sigsuspend.c: In function ‘__sigsuspend’:
> ../sysdeps/unix/sysv/linux/single-thread.h:38:27: error: ‘__libc_single_threaded_internal’ undeclared (first use in this function); did you mean ‘__libc_single_threaded’?
>
>    38 | # define SINGLE_THREAD_P (__libc_single_threaded_internal != 0)
>       |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../sysdeps/unix/sysdep.h:115:37: note: in expansion of macro ‘SINGLE_THREAD_P’
>   115 | # define NO_SYSCALL_CANCEL_CHECKING SINGLE_THREAD_P
>       |                                     ^~~~~~~~~~~~~~~
> ../sysdeps/unix/sysdep.h:121:9: note: in expansion of macro ‘NO_SYSCALL_CANCEL_CHECKING’
>   121 |     if (NO_SYSCALL_CANCEL_CHECKING)                                          \
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
> ../sysdeps/unix/sysv/linux/sigsuspend.c:26:10: note: in expansion of macro ‘SYSCALL_CANCEL’
>    26 |   return SYSCALL_CANCEL (rt_sigsuspend, set, __NSIG_BYTES);
>       |          ^~~~~~~~~~~~~~
> ../sysdeps/unix/sysv/linux/single-thread.h:38:27: note: each undeclared identifier is reported only once for each function it appears in
>    38 | # define SINGLE_THREAD_P (__libc_single_threaded_internal != 0)
>       |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../sysdeps/unix/sysdep.h:115:37: note: in expansion of macro ‘SINGLE_THREAD_P’
>   115 | # define NO_SYSCALL_CANCEL_CHECKING SINGLE_THREAD_P
>       |                                     ^~~~~~~~~~~~~~~
> ../sysdeps/unix/sysdep.h:121:9: note: in expansion of macro ‘NO_SYSCALL_CANCEL_CHECKING’
>   121 |     if (NO_SYSCALL_CANCEL_CHECKING)                                          \
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
> ../sysdeps/unix/sysv/linux/sigsuspend.c:26:10: note: in expansion of macro ‘SYSCALL_CANCEL’
>    26 |   return SYSCALL_CANCEL (rt_sigsuspend, set, __NSIG_BYTES);
>       |          ^~~~~~~~~~~~~~
> make[2]: *** [/opt/work/linux/glibc/build/sysd-rules:229: /opt/work/linux/glibc/build/signal/sigsuspend.os] Error 1
> make[2]: Leaving directory '/opt/work/linux/glibc/src/signal'
> make[1]: *** [Makefile:484: signal/subdir_lib] Error 2
> make[1]: Leaving directory '/opt/work/linux/glibc/src'
> make: *** [Makefile:9: all] Error 2
>
> Has anybody encountered this before ? Any pointers ?
>
> warm regards
> Saifi.

Do you mean by 'out-of-source-tree' that you are just trying to
compile the source without all
the internal files and definitions? If so you will need to copy and/or
add any required definition
(requires either by compiler or by the linker).

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: error: ‘__libc_single_threaded_internal’ undeclared
  2022-11-20 17:18 ` Adhemerval Zanella
@ 2022-11-20 17:41   ` Saifi Khan
  2022-11-20 18:15     ` Adhemerval Zanella
  2022-11-20 18:27     ` Florian Weimer
  0 siblings, 2 replies; 5+ messages in thread
From: Saifi Khan @ 2022-11-20 17:41 UTC (permalink / raw)
  To: libc-help

>  -------Original Message-------
>  From: Adhemerval Zanella
>  
>  Do you mean by 'out-of-source-tree' that you are just trying to
>  compile the source without all the internal files and definitions?
>

Adhemerval, thanks for your kind reply.

The directory tree structure looks like this

/opt/work/linux/glibc/
├── build
└── src

In the build directory, i first execute a configure script (b02.sh)

DIR_ONE=/opt/work/linux/glibc

DIR_SRC=${DIR_ONE}/src
DIR_DST=${DIR_ONE}/root

      CC="gcc-12"
     CXX="g++-12"
  CFLAGS="-O2 -pipe"
CXXFLAGS="${CFLAGS}"

CC="gcc-12"  CXX="g++-12"  CFLAGS="-O2 -pipe"  CXXFLAGS="${CFLAGS}" ${DIR_SRC}/configure                        \
          --prefix=${DIR_DST}               \
          --exec-prefix=${DIR_DST}          \
          --datarootdir=${DIR_DST}/doc/share   \
          --datadir=${DIR_DST}/doc          \
          --docdir=${DIR_DST}/doc           \
          --htmldir=${DIR_DST}/doc          \
          --mandir=${DIR_DST}/doc/man       \
          --infodir=${DIR_DST}/doc/info     \
          --enable-add-ons                  \
          --disable-hidden-plt              \
          --disable-profile                 \
          --enable-stack-protector=no       \
          --enable-shared                   \
          --enable-ld=yes                   \
          --with-gnu-ld                     \
          --without-selinux
exit 0;

next i execute the build script (b04.sh)

make -j1

that's when the above mentioned error was seen.

Do you think anything needs to be changed in the options that are being passed to the configure script ?

warm regards
Saifi.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: error: ‘__libc_single_threaded_internal’ undeclared
  2022-11-20 17:41   ` Saifi Khan
@ 2022-11-20 18:15     ` Adhemerval Zanella
  2022-11-20 18:27     ` Florian Weimer
  1 sibling, 0 replies; 5+ messages in thread
From: Adhemerval Zanella @ 2022-11-20 18:15 UTC (permalink / raw)
  To: Saifi Khan; +Cc: libc-help

On Sun, Nov 20, 2022 at 2:41 PM Saifi Khan <saifi.khan@nishan.io> wrote:
>
> >  -------Original Message-------
> >  From: Adhemerval Zanella
> >
> >  Do you mean by 'out-of-source-tree' that you are just trying to
> >  compile the source without all the internal files and definitions?
> >
>
> Adhemerval, thanks for your kind reply.
>
> The directory tree structure looks like this
>
> /opt/work/linux/glibc/
> ├── build
> └── src
>
> In the build directory, i first execute a configure script (b02.sh)
>
> DIR_ONE=/opt/work/linux/glibc
>
> DIR_SRC=${DIR_ONE}/src
> DIR_DST=${DIR_ONE}/root
>
>       CC="gcc-12"
>      CXX="g++-12"
>   CFLAGS="-O2 -pipe"
> CXXFLAGS="${CFLAGS}"
>
> CC="gcc-12"  CXX="g++-12"  CFLAGS="-O2 -pipe"  CXXFLAGS="${CFLAGS}" ${DIR_SRC}/configure                        \
>           --prefix=${DIR_DST}               \
>           --exec-prefix=${DIR_DST}          \
>           --datarootdir=${DIR_DST}/doc/share   \
>           --datadir=${DIR_DST}/doc          \
>           --docdir=${DIR_DST}/doc           \
>           --htmldir=${DIR_DST}/doc          \
>           --mandir=${DIR_DST}/doc/man       \
>           --infodir=${DIR_DST}/doc/info     \
>           --enable-add-ons                  \
>           --disable-hidden-plt              \
>           --disable-profile                 \
>           --enable-stack-protector=no       \
>           --enable-shared                   \
>           --enable-ld=yes                   \
>           --with-gnu-ld                     \
>           --without-selinux
> exit 0;
>
> next i execute the build script (b04.sh)
>
> make -j1
>
> that's when the above mentioned error was seen.
>
> Do you think anything needs to be changed in the options that are being passed to the configure script ?
>
> warm regards
> Saifi.

This is due --disable-hidden-plt option, which is a bit rotten option
that I think we should remove
it (it is required for Hurd, but it can handle on its internal
definition). Even the following fix:

diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index f4437ff6ad..221fa18294 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -599,7 +599,12 @@ for linking")
   extern thread __typeof (name) internal __hidden_proto_hiddenattr (attrs);
 # else
 #   define hidden_proto(name, attrs...)
-#   define hidden_proto_alias(name, alias, attrs...)
+#  define __hidden_proto_hiddenattr(attrs...) \
+  __attribute__ ((visibility ("hidden"), ##attrs))
+#  define __hidden_proto_alias(name, thread, internal, attrs...)            \
+  extern thread __typeof (name) internal __hidden_proto_hiddenattr (attrs);
+#   define hidden_proto_alias(name, alias, attrs...) \
+  __hidden_proto_alias (name, , alias, ##attrs)
 #   define hidden_tls_proto(name, attrs...)
 # endif
 # else

It fails later for setrlimit64.c build (at least for aarch64). I
advise just removing it, it is not actively tested.

Also, --enable-add-ons is not required anymore, --enable-shared is the
default, --enable-ld=yes and  --with-gnu-ld
is also not required.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: error: ‘__libc_single_threaded_internal’ undeclared
  2022-11-20 17:41   ` Saifi Khan
  2022-11-20 18:15     ` Adhemerval Zanella
@ 2022-11-20 18:27     ` Florian Weimer
  1 sibling, 0 replies; 5+ messages in thread
From: Florian Weimer @ 2022-11-20 18:27 UTC (permalink / raw)
  To: Saifi Khan; +Cc: libc-help

* Saifi Khan:

> Do you think anything needs to be changed in the options that are
> being passed to the configure script ?

I suspect it's related to --disable-hidden-plt.  The way we define
__libc_single_threaded_internal using libc_hidden_proto_alias in
include/sys/single_threaded.h is suspicious.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-20 18:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-20 13:55 error: ‘__libc_single_threaded_internal’ undeclared Saifi Khan
2022-11-20 17:18 ` Adhemerval Zanella
2022-11-20 17:41   ` Saifi Khan
2022-11-20 18:15     ` Adhemerval Zanella
2022-11-20 18:27     ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).