public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
@ 2023-11-14 20:37 David Edelsohn
  2023-11-14 23:06 ` Arsen Arsenović
  0 siblings, 1 reply; 60+ messages in thread
From: David Edelsohn @ 2023-11-14 20:37 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: Richard Biener, GCC Patches

[-- Attachment #1: Type: text/plain, Size: 98 bytes --]

Arsen,

Unfortunately this broke bootstrap on AIX.

I had not seen this series of patches.

David

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-14 20:37 [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext David Edelsohn
@ 2023-11-14 23:06 ` Arsen Arsenović
  2023-11-15  1:49   ` David Edelsohn
  0 siblings, 1 reply; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-14 23:06 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Richard Biener, GCC Patches, Bruno Haible

[-- Attachment #1: Type: text/plain, Size: 458 bytes --]

Hi David,

David Edelsohn <dje.gcc@gmail.com> writes:

> Arsen,
>
> Unfortunately this broke bootstrap on AIX.
>
> I had not seen this series of patches.

I've added Bruno to CC as the libintl maintainer, to keep him in the
loop.  Could you provide some extra information w.r.t. the failure mode?

I'll try to investigate ASAP.

In the meanwhile, does disabling NLS etc work?

Thanks in advance, have a lovely night.
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-14 23:06 ` Arsen Arsenović
@ 2023-11-15  1:49   ` David Edelsohn
  2023-11-15 12:29     ` building GNU gettext on AIX Bruno Haible
  2023-11-15 14:14     ` [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext Arsen Arsenović
  0 siblings, 2 replies; 60+ messages in thread
From: David Edelsohn @ 2023-11-15  1:49 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: Richard Biener, GCC Patches, Bruno Haible

[-- Attachment #1: Type: text/plain, Size: 1529 bytes --]

On Tue, Nov 14, 2023 at 6:09 PM Arsen Arsenović <arsen@aarsen.me> wrote:

> Hi David,
>
> David Edelsohn <dje.gcc@gmail.com> writes:
>
> > Arsen,
> >
> > Unfortunately this broke bootstrap on AIX.
> >
> > I had not seen this series of patches.
>
> I've added Bruno to CC as the libintl maintainer, to keep him in the
> loop.  Could you provide some extra information w.r.t. the failure mode?
>
> I'll try to investigate ASAP.
>
> In the meanwhile, does disabling NLS etc work?
>
> Thanks in advance, have a lovely night.
>
> GCC had been working on AIX with NLS, using "--with-included-gettext".
--disable-nls gets past the breakage, but GCC does not build for me on AIX
with NLS enabled.

A change in dependencies for GCC should have been announced and more widely
socialized in the GCC development mailing list, not just GCC patches
mailing list.

I have tried both the AIX Open Source libiconv and libgettext package, and
the ones that I previously built.  Both fail because GCC configure decides
to disable NLS, despite being requested, while libcpp is satisfied, so
tools in the gcc subdirectory don't link against libiconv and the build
fails.  With the included gettext, I was able to rely on a self-consistent
solution.

The current gettext-0.22.3 fails to build for me on AIX.

libcpp configure believes that NLS functions on AIX, but gcc configure
fails in its tests of gettext functionality, which leads to an inconsistent
configuration and build breakage.

Thanks, David

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

* Re: building GNU gettext on AIX
  2023-11-15  1:49   ` David Edelsohn
@ 2023-11-15 12:29     ` Bruno Haible
  2023-11-15 19:26       ` David Edelsohn
  2023-11-15 14:14     ` [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext Arsen Arsenović
  1 sibling, 1 reply; 60+ messages in thread
From: Bruno Haible @ 2023-11-15 12:29 UTC (permalink / raw)
  To: Arsen Arsenović, David Edelsohn
  Cc: Richard Biener, GCC Patches, bug-gettext

[CCing bug-gettext]

David Edelsohn wrote in
<https://gcc.gnu.org/pipermail/gcc-patches/2023-November/636558.html>:
> The current gettext-0.22.3 fails to build for me on AIX.

Here are some hints to get a successful build of GNU gettext on AIX:

1. Set the recommended environment variables before running configure:
   https://gitlab.com/ghwiki/gnow-how/-/wikis/Platforms/Configuration

   Namely:
   * for a 32-bit build with gcc:
     CC=gcc
     CXX=g++
     CPPFLAGS="-I$PREFIX/include"
     LDFLAGS="-L$PREFIX/lib"
     unset AR NM
   * for a 32-bit build with xlc:
     CC="xlc -qthreaded -qtls"
     CXX="xlC -qthreaded -qtls"
     CPPFLAGS="-I$PREFIX/include"
     LDFLAGS="-L$PREFIX/lib"
     unset AR NM
   * for a 64-bit build with gcc:
     CC="gcc -maix64"
     CXX="g++ -maix64"
     CPPFLAGS="-I$PREFIX/include"
     LDFLAGS="-L$PREFIX/lib"
     AR="ar -X 64"; NM="nm -X 64 -B"
   * for a 64-bit build with xlc:
     CC="xlc -q64 -qthreaded -qtls"
     CXX="xlC -q64 -qthreaded -qtls"
     CPPFLAGS="-I$PREFIX/include"
     LDFLAGS="-L$PREFIX/lib"
     AR="ar -X 64"; NM="nm -X 64 -B"

   where $PREFIX is the value that you pass to the --prefix configure option.

   Rationale: you can run into all sorts of problems if you choose compiler
   options at random and haven't experience with compiler options on that
   platform.

2. Don't use ibm-clang.

   Rationale: It's broken.

3. Don't use -Wall with gcc 10.3.

   Rationale: If you specify -Wall, gettext's configure adds -fanalyzer, which
   has excessive memory requirements in gcc 10.x. In particular, on AIX, it
   makes cc1 crash while compiling regex.c after it has consumed 1 GiB of RAM.

4. Avoid using a --prefix that contains earlier installations of the same
   package.

   Rationale: Because the AIX linker hardcodes directory names in shared
   libraries, GNU libtool has a peculiar configuration on AIX. It ends up
   mixing the in-build-tree libraries with the libraries in the install
   locations, leading to all sorts of errors.

   If you really need to use a --prefix that contains an earlier
   installation of the same package:
     - Either use --disable-shared and remove libgettextlib.a and
       libgettextsrc.a from $PREFIX/lib before starting the build.
     - Or use a mix of "make -k", "make -k install" and ad-hoc workarounds
       that cannot be described in a general way.

Bruno




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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-15  1:49   ` David Edelsohn
  2023-11-15 12:29     ` building GNU gettext on AIX Bruno Haible
@ 2023-11-15 14:14     ` Arsen Arsenović
  2023-11-15 15:51       ` Xi Ruoyao
                         ` (2 more replies)
  1 sibling, 3 replies; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-15 14:14 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Richard Biener, GCC Patches, Bruno Haible

[-- Attachment #1: Type: text/plain, Size: 1684 bytes --]


David Edelsohn <dje.gcc@gmail.com> writes:

> GCC had been working on AIX with NLS, using "--with-included-gettext".
> --disable-nls gets past the breakage, but GCC does not build for me on AIX
> with NLS enabled.

That should still work with gettext 0.22+ extracted in-tree (it should
be fetched by download_prerequisites).

> A change in dependencies for GCC should have been announced and more widely
> socialized in the GCC development mailing list, not just GCC patches
> mailing list.
>
> I have tried both the AIX Open Source libiconv and libgettext package, and
> the ones that I previously built.  Both fail because GCC configure decides
> to disable NLS, despite being requested, while libcpp is satisfied, so
> tools in the gcc subdirectory don't link against libiconv and the build
> fails.  With the included gettext, I was able to rely on a self-consistent
> solution.

That is interesting.  They should be using the same checks.  I've
checked trunk and regenerated files on it, and saw no significant diff
(some whitespace changes only).  Could you post the config.log of both?

I've never used AIX.  Can I reproduce this on one of the cfarm machines
to poke around?  I've tried cfarm119, but that one lacked git, and I
haven't poked around much further due to time constraints.

TIA, sorry about the inconvenience.  Have a lovely day.

> The current gettext-0.22.3 fails to build for me on AIX.
>
> libcpp configure believes that NLS functions on AIX, but gcc configure
> fails in its tests of gettext functionality, which leads to an inconsistent
> configuration and build breakage.
>
> Thanks, David


-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-15 14:14     ` [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext Arsen Arsenović
@ 2023-11-15 15:51       ` Xi Ruoyao
  2023-11-16 18:48         ` Arsen Arsenović
  2023-11-15 17:19       ` David Edelsohn
  2023-11-15 19:58       ` David Edelsohn
  2 siblings, 1 reply; 60+ messages in thread
From: Xi Ruoyao @ 2023-11-15 15:51 UTC (permalink / raw)
  To: Arsen Arsenovi�0�4, David Edelsohn
  Cc: Richard Biener, GCC Patches, Bruno Haible

On Wed, 2023-11-15 at 15:14 +0100, Arsen Arsenović wrote:
> That is interesting.  They should be using the same checks.  I've
> checked trunk and regenerated files on it, and saw no significant diff
> (some whitespace changes only).  Could you post the config.log of
> both?

You did not regenerate config.in.  But I've regenerated it in r14-5434
anyway.

The related changes:

+/* Define to 1 if you have the Mac OS X function
+   CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES
+#endif
+
+
+/* Define to 1 if you have the Mac OS X function
CFPreferencesCopyAppValue in
+   the CoreFoundation framework. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_CFPREFERENCESCOPYAPPVALUE
+#endif

+/* Define if the GNU dcgettext() function is already present or preinstalled.
+   */
+#ifndef USED_FOR_TARGET
+#undef HAVE_DCGETTEXT
+#endif

+/* Define if the GNU gettext() function is already present or preinstalled. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_GETTEXT
+#endif

I don't know if they are related to the issue on AIX though.

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-15 14:14     ` [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext Arsen Arsenović
  2023-11-15 15:51       ` Xi Ruoyao
@ 2023-11-15 17:19       ` David Edelsohn
  2023-11-16 18:33         ` Arsen Arsenović
  2023-11-15 19:58       ` David Edelsohn
  2 siblings, 1 reply; 60+ messages in thread
From: David Edelsohn @ 2023-11-15 17:19 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: Richard Biener, GCC Patches, Bruno Haible

[-- Attachment #1: Type: text/plain, Size: 2264 bytes --]

On Wed, Nov 15, 2023 at 9:22 AM Arsen Arsenović <arsen@aarsen.me> wrote:

>
> David Edelsohn <dje.gcc@gmail.com> writes:
>
> > GCC had been working on AIX with NLS, using "--with-included-gettext".
> > --disable-nls gets past the breakage, but GCC does not build for me on
> AIX
> > with NLS enabled.
>
> That should still work with gettext 0.22+ extracted in-tree (it should
> be fetched by download_prerequisites).
>
> > A change in dependencies for GCC should have been announced and more
> widely
> > socialized in the GCC development mailing list, not just GCC patches
> > mailing list.
> >
> > I have tried both the AIX Open Source libiconv and libgettext package,
> and
> > the ones that I previously built.  Both fail because GCC configure
> decides
> > to disable NLS, despite being requested, while libcpp is satisfied, so
> > tools in the gcc subdirectory don't link against libiconv and the build
> > fails.  With the included gettext, I was able to rely on a
> self-consistent
> > solution.
>
> That is interesting.  They should be using the same checks.  I've
> checked trunk and regenerated files on it, and saw no significant diff
> (some whitespace changes only).  Could you post the config.log of both?
>
> I've never used AIX.  Can I reproduce this on one of the cfarm machines
> to poke around?  I've tried cfarm119, but that one lacked git, and I
> haven't poked around much further due to time constraints.
>

The AIX system in the Compile Farm has a complete complement of Open Source
software installed.

Please ensure that /opt/freeware/bin is in your path.  Also, the GCC Wiki
Compile Farm page has build tips that include AIX

https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines

that recommended --with-included-gettext configuration option.

Thanks, David


>
> TIA, sorry about the inconvenience.  Have a lovely day.
>
> > The current gettext-0.22.3 fails to build for me on AIX.
> >
> > libcpp configure believes that NLS functions on AIX, but gcc configure
> > fails in its tests of gettext functionality, which leads to an
> inconsistent
> > configuration and build breakage.
> >
> > Thanks, David
>
>
> --
> Arsen Arsenović
>

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

* Re: building GNU gettext on AIX
  2023-11-15 12:29     ` building GNU gettext on AIX Bruno Haible
@ 2023-11-15 19:26       ` David Edelsohn
  2023-11-15 21:22         ` Bruno Haible
  0 siblings, 1 reply; 60+ messages in thread
From: David Edelsohn @ 2023-11-15 19:26 UTC (permalink / raw)
  To: Bruno Haible; +Cc: Arsen Arsenović, GCC Patches, bug-gettext

[-- Attachment #1: Type: text/plain, Size: 4171 bytes --]

When I try to configure gettext-0.22.3, I receive the following error:

checking for socklen_t equivalent... configure: error: Cannot find a type
to use in place of socklen_t

configure: error:
/nasfarm/edelsohn/src/gettext-0.22.3/libtextstyle/configure failed for
libtextstyle


configure:43943: /nasfarm/edelsohn/install/GCC12/bin/gcc -c -g -O2
-D_THREAD_SAFE
conftest.c >&5

conftest.c:112:18: error: two or more data types in declaration specifiers

  112 | #define intmax_t long long

      |                  ^~~~

conftest.c:112:23: error: two or more data types in declaration specifiers

  112 | #define intmax_t long long

      |                       ^~~~

In file included from conftest.c:212:

conftest.c:214:24: error: conflicting types for 'ngetpeername'; have
'int(int,  void *, long unsigned int *)'

  214 |                    int getpeername (int, void *, unsigned long int
*);

      |                        ^~~~~~~~~~~

/nasfarm/edelsohn/install/GCC12/lib/gcc/powerpc-ibm-aix7.2.5.0/12.1.1/include-fixed/sys/socket.h:647:9:
note: previous declaration of 'ngetpeername' with type 'int(int,  struct
sockaddr * restrict,  socklen_t * restrict)' {aka 'int(int,  struct
sockaddr * restrict,  long unsigned int * restrict)'}

  647 | int     getpeername(int, struct sockaddr *__restrict__, socklen_t
*__restrict__);

      |         ^~~~~~~~~~~


configure and config.h seems to get itself confused about types.


David



On Wed, Nov 15, 2023 at 7:29 AM Bruno Haible <bruno@clisp.org> wrote:

> [CCing bug-gettext]
>
> David Edelsohn wrote in
> <https://gcc.gnu.org/pipermail/gcc-patches/2023-November/636558.html>:
> > The current gettext-0.22.3 fails to build for me on AIX.
>
> Here are some hints to get a successful build of GNU gettext on AIX:
>
> 1. Set the recommended environment variables before running configure:
>    https://gitlab.com/ghwiki/gnow-how/-/wikis/Platforms/Configuration
>
>    Namely:
>    * for a 32-bit build with gcc:
>      CC=gcc
>      CXX=g++
>      CPPFLAGS="-I$PREFIX/include"
>      LDFLAGS="-L$PREFIX/lib"
>      unset AR NM
>    * for a 32-bit build with xlc:
>      CC="xlc -qthreaded -qtls"
>      CXX="xlC -qthreaded -qtls"
>      CPPFLAGS="-I$PREFIX/include"
>      LDFLAGS="-L$PREFIX/lib"
>      unset AR NM
>    * for a 64-bit build with gcc:
>      CC="gcc -maix64"
>      CXX="g++ -maix64"
>      CPPFLAGS="-I$PREFIX/include"
>      LDFLAGS="-L$PREFIX/lib"
>      AR="ar -X 64"; NM="nm -X 64 -B"
>    * for a 64-bit build with xlc:
>      CC="xlc -q64 -qthreaded -qtls"
>      CXX="xlC -q64 -qthreaded -qtls"
>      CPPFLAGS="-I$PREFIX/include"
>      LDFLAGS="-L$PREFIX/lib"
>      AR="ar -X 64"; NM="nm -X 64 -B"
>
>    where $PREFIX is the value that you pass to the --prefix configure
> option.
>
>    Rationale: you can run into all sorts of problems if you choose compiler
>    options at random and haven't experience with compiler options on that
>    platform.
>
> 2. Don't use ibm-clang.
>
>    Rationale: It's broken.
>
> 3. Don't use -Wall with gcc 10.3.
>
>    Rationale: If you specify -Wall, gettext's configure adds -fanalyzer,
> which
>    has excessive memory requirements in gcc 10.x. In particular, on AIX, it
>    makes cc1 crash while compiling regex.c after it has consumed 1 GiB of
> RAM.
>
> 4. Avoid using a --prefix that contains earlier installations of the same
>    package.
>
>    Rationale: Because the AIX linker hardcodes directory names in shared
>    libraries, GNU libtool has a peculiar configuration on AIX. It ends up
>    mixing the in-build-tree libraries with the libraries in the install
>    locations, leading to all sorts of errors.
>
>    If you really need to use a --prefix that contains an earlier
>    installation of the same package:
>      - Either use --disable-shared and remove libgettextlib.a and
>        libgettextsrc.a from $PREFIX/lib before starting the build.
>      - Or use a mix of "make -k", "make -k install" and ad-hoc workarounds
>        that cannot be described in a general way.
>
> Bruno
>
>
>
>

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-15 14:14     ` [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext Arsen Arsenović
  2023-11-15 15:51       ` Xi Ruoyao
  2023-11-15 17:19       ` David Edelsohn
@ 2023-11-15 19:58       ` David Edelsohn
  2 siblings, 0 replies; 60+ messages in thread
From: David Edelsohn @ 2023-11-15 19:58 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: GCC Patches, Bruno Haible

[-- Attachment #1: Type: text/plain, Size: 4976 bytes --]

On Wed, Nov 15, 2023 at 9:22 AM Arsen Arsenović <arsen@aarsen.me> wrote:

>
> David Edelsohn <dje.gcc@gmail.com> writes:
>
> > GCC had been working on AIX with NLS, using "--with-included-gettext".
> > --disable-nls gets past the breakage, but GCC does not build for me on
> AIX
> > with NLS enabled.
>
> That should still work with gettext 0.22+ extracted in-tree (it should
> be fetched by download_prerequisites).
>
> > A change in dependencies for GCC should have been announced and more
> widely
> > socialized in the GCC development mailing list, not just GCC patches
> > mailing list.
> >
> > I have tried both the AIX Open Source libiconv and libgettext package,
> and
> > the ones that I previously built.  Both fail because GCC configure
> decides
> > to disable NLS, despite being requested, while libcpp is satisfied, so
> > tools in the gcc subdirectory don't link against libiconv and the build
> > fails.  With the included gettext, I was able to rely on a
> self-consistent
> > solution.
>
> That is interesting.  They should be using the same checks.  I've
> checked trunk and regenerated files on it, and saw no significant diff
> (some whitespace changes only).  Could you post the config.log of both?
>

GCC configured with --with-libintl-prefix and --with-libiconv-prefix

libcpp/config.log:

configure:7610: checking for GNU gettext in libc

configure:7639: /nasfarm/edelsohn/install/GCC12/bin/gcc -std=gnu99 -o
conftest -g  -static-libstdc++ -static-libgcc -Wl,-bbigtoc conftest.c  >&5

conftest.c:71:10: fatal error: libintl.h: No such file or directory

   71 | #include <libintl.h>

      |          ^~~~~~~~~~~

configure:8318: checking for GNU gettext in libintl

configure:8355: /nasfarm/edelsohn/install/GCC12/bin/gcc -std=gnu99 -o
conftest -g -I/nasfarm/edelsohn/install/include  -static-libstdc++
-static-libgcc -Wl,-bbigtoc conftest.c  /nasfarm/edelsohn/install/lib/
libintl.a >&5

ld: 0711-317 ERROR: Undefined symbol: .libiconv_open

ld: 0711-317 ERROR: Undefined symbol: .libiconv_set_relocation_prefix

ld: 0711-317 ERROR: Undefined symbol: .libiconv_close

ld: 0711-317 ERROR: Undefined symbol: .libiconv

ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
information.

collect2: error: ld returned 8 exit status

configure:8355: $? = 1

configure:8392: /nasfarm/edelsohn/install/GCC12/bin/gcc -std=gnu99 -o
conftest -g -I/nasfarm/edelsohn/install/include  -static-libstdc++
-static-libgcc -Wl,-bbigtoc conftest.c  /nasfarm/edelsohn/install/lib/
libintl.a /nasfarm/edelsohn/install/lib/libiconv.a >&5

configure:8392: $? = 0

configure:8405: result: yes

configure:8440: checking whether to use NLS

configure:8442: result: yes

configure:8445: checking where the gettext function comes from

configure:8456: result: external libintl

configure:8464: checking how to link with libintl

configure:8466: result: /nasfarm/edelsohn/install/lib/libintl.a
/nasfarm/edelsohn/install/lib/libiconv.a

configure:8525: checking whether NLS is requested

configure:8531: result: yes

gcc/config.log:

configure:14002: checking for GNU gettext in libc

configure:14031: /nasfarm/edelsohn/install/GCC12/bin/g++ -std=c++11 -o
conftest

-g    -static-libstdc++ -static-libgcc -Wl,-bbigtoc  conftest.cpp  >&5

conftest.cpp:196:10: fatal error: libintl.h: No such file or directory

  196 | #include <libintl.h>

      |          ^~~~~~~~~~~

configure:14710: checking for GNU gettext in libintl

configure:14747: /nasfarm/edelsohn/install/GCC12/bin/g++ -std=c++11 -o
conftest -g    -I/nasfarm/edelsohn/install/include -static-libstdc++
-static-libgcc -Wl,-bbigtoc  conftest.cpp  /nasfarm/edelsohn/install/lib/
libintl.a >&5

ld: 0711-317 ERROR: Undefined symbol: .libiconv_open

ld: 0711-317 ERROR: Undefined symbol: .libiconv_set_relocation_prefix

ld: 0711-317 ERROR: Undefined symbol: .libiconv_close

ld: 0711-317 ERROR: Undefined symbol: .libiconv

ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
information.

collect2: error: ld returned 8 exit status

configure:14747: $? = 1

configure:14797: result: no

configure:14832: checking whether to use NLS

configure:14834: result: no

configure:14917: checking whether NLS is requested

configure:14920: result: no




> I've never used AIX.  Can I reproduce this on one of the cfarm machines
> to poke around?  I've tried cfarm119, but that one lacked git, and I
> haven't poked around much further due to time constraints.
>
> TIA, sorry about the inconvenience.  Have a lovely day.
>
> > The current gettext-0.22.3 fails to build for me on AIX.
> >
> > libcpp configure believes that NLS functions on AIX, but gcc configure
> > fails in its tests of gettext functionality, which leads to an
> inconsistent
> > configuration and build breakage.
> >
> > Thanks, David
>
>
> --
> Arsen Arsenović
>

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

* Re: building GNU gettext on AIX
  2023-11-15 19:26       ` David Edelsohn
@ 2023-11-15 21:22         ` Bruno Haible
  2023-11-15 21:31           ` David Edelsohn
  0 siblings, 1 reply; 60+ messages in thread
From: Bruno Haible @ 2023-11-15 21:22 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Arsen Arsenović, GCC Patches, bug-gettext

David Edelsohn wrote:
> When I try to configure gettext-0.22.3, I receive the following error:
> 
> checking for socklen_t equivalent... configure: error: Cannot find a type
> to use in place of socklen_t
> 
> configure: error:
> /nasfarm/edelsohn/src/gettext-0.22.3/libtextstyle/configure failed for
> libtextstyle
> 
> 
> configure:43943: /nasfarm/edelsohn/install/GCC12/bin/gcc -c -g -O2
> -D_THREAD_SAFE
> conftest.c >&5
> 
> conftest.c:112:18: error: two or more data types in declaration specifiers
> 
>   112 | #define intmax_t long long
> 
>       |                  ^~~~
> 
> conftest.c:112:23: error: two or more data types in declaration specifiers
> 
>   112 | #define intmax_t long long
> 
>       |                       ^~~~
> 
> In file included from conftest.c:212:
> 
> conftest.c:214:24: error: conflicting types for 'ngetpeername'; have
> 'int(int,  void *, long unsigned int *)'
> 
>   214 |                    int getpeername (int, void *, unsigned long int
> *);
> 
>       |                        ^~~~~~~~~~~
> 
> /nasfarm/edelsohn/install/GCC12/lib/gcc/powerpc-ibm-aix7.2.5.0/12.1.1/include-fixed/sys/socket.h:647:9:
> note: previous declaration of 'ngetpeername' with type 'int(int,  struct
> sockaddr * restrict,  socklen_t * restrict)' {aka 'int(int,  struct
> sockaddr * restrict,  long unsigned int * restrict)'}
> 
>   647 | int     getpeername(int, struct sockaddr *__restrict__, socklen_t
> *__restrict__);
> 
>       |         ^~~~~~~~~~~
> 
> 
> configure and config.h seems to get itself confused about types.

There seem to be two problems, both related to the include files of
your compiler:

  - The configure test "checking for intmax_t..." must have found the
    answer "no". But on a modern system, <stdint.h> should be defining
    intmax_t already.

  - This configure test that tries to find the getpeername declaration,
    but cannot find it (maybe because of the first problem?):

================================================================================
         for arg2 in "struct sockaddr" void; do
           for t in int size_t "unsigned int" "long int" "unsigned long int"; do
             cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <sys/types.h>
                   #include <sys/socket.h>

                   int getpeername (int, $arg2 *, $t *);
int
main (void)
{
$t len;
                  getpeername (0, 0, &len);
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
  gl_cv_socklen_t_equiv="$t"
fi
================================================================================

I would concentrate on the first problem. If you don't get it fixed, then I'd
suggest to try 'gcc' from the AIX Toolbox [1] or 'xlc' (as an IBM product)
instead of 'gcc' (that looks like you built it yourself).

Bruno

[1] https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/SPECS/gcc12-12.3.0-1.spec




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

* Re: building GNU gettext on AIX
  2023-11-15 21:22         ` Bruno Haible
@ 2023-11-15 21:31           ` David Edelsohn
  2023-11-15 22:39             ` Bruno Haible
  0 siblings, 1 reply; 60+ messages in thread
From: David Edelsohn @ 2023-11-15 21:31 UTC (permalink / raw)
  To: Bruno Haible; +Cc: Arsen Arsenović, GCC Patches, bug-gettext

[-- Attachment #1: Type: text/plain, Size: 3445 bytes --]

On Wed, Nov 15, 2023 at 4:22 PM Bruno Haible <bruno@clisp.org> wrote:

> David Edelsohn wrote:
> > When I try to configure gettext-0.22.3, I receive the following error:
> >
> > checking for socklen_t equivalent... configure: error: Cannot find a type
> > to use in place of socklen_t
> >
> > configure: error:
> > /nasfarm/edelsohn/src/gettext-0.22.3/libtextstyle/configure failed for
> > libtextstyle
> >
> >
> > configure:43943: /nasfarm/edelsohn/install/GCC12/bin/gcc -c -g -O2
> > -D_THREAD_SAFE
> > conftest.c >&5
> >
> > conftest.c:112:18: error: two or more data types in declaration
> specifiers
> >
> >   112 | #define intmax_t long long
> >
> >       |                  ^~~~
> >
> > conftest.c:112:23: error: two or more data types in declaration
> specifiers
> >
> >   112 | #define intmax_t long long
> >
> >       |                       ^~~~
> >
> > In file included from conftest.c:212:
> >
> > conftest.c:214:24: error: conflicting types for 'ngetpeername'; have
> > 'int(int,  void *, long unsigned int *)'
> >
> >   214 |                    int getpeername (int, void *, unsigned long
> int
> > *);
> >
> >       |                        ^~~~~~~~~~~
> >
> >
> /nasfarm/edelsohn/install/GCC12/lib/gcc/powerpc-ibm-aix7.2.5.0/12.1.1/include-fixed/sys/socket.h:647:9:
> > note: previous declaration of 'ngetpeername' with type 'int(int,  struct
> > sockaddr * restrict,  socklen_t * restrict)' {aka 'int(int,  struct
> > sockaddr * restrict,  long unsigned int * restrict)'}
> >
> >   647 | int     getpeername(int, struct sockaddr *__restrict__, socklen_t
> > *__restrict__);
> >
> >       |         ^~~~~~~~~~~
> >
> >
> > configure and config.h seems to get itself confused about types.
>
> There seem to be two problems, both related to the include files of
> your compiler:
>
>   - The configure test "checking for intmax_t..." must have found the
>     answer "no". But on a modern system, <stdint.h> should be defining
>     intmax_t already.
>
>   - This configure test that tries to find the getpeername declaration,
>     but cannot find it (maybe because of the first problem?):
>
>
> ================================================================================
>          for arg2 in "struct sockaddr" void; do
>            for t in int size_t "unsigned int" "long int" "unsigned long
> int"; do
>              cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> /* end confdefs.h.  */
> #include <sys/types.h>
>                    #include <sys/socket.h>
>
>                    int getpeername (int, $arg2 *, $t *);
> int
> main (void)
> {
> $t len;
>                   getpeername (0, 0, &len);
>   ;
>   return 0;
> }
> _ACEOF
> if ac_fn_c_try_compile "$LINENO"
> then :
>   gl_cv_socklen_t_equiv="$t"
> fi
>
> ================================================================================
>
> I would concentrate on the first problem. If you don't get it fixed, then
> I'd
> suggest to try 'gcc' from the AIX Toolbox [1] or 'xlc' (as an IBM product)
> instead of 'gcc' (that looks like you built it yourself).
>
> Bruno
>
> [1]
> https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/SPECS/gcc12-12.3.0-1.spec


Bruno,

I am using my own install of GCC for a reason.  The build of GCC works for
everything else, including bootstrap of GCC, GDB, GMP, etc.  The only
problem is gettext.

Thanks, David

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

* Re: building GNU gettext on AIX
  2023-11-15 21:31           ` David Edelsohn
@ 2023-11-15 22:39             ` Bruno Haible
  2023-11-16 16:00               ` David Edelsohn
  0 siblings, 1 reply; 60+ messages in thread
From: Bruno Haible @ 2023-11-15 22:39 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Arsen Arsenović, GCC Patches, bug-gettext

David Edelsohn wrote:
> I am using my own install of GCC for a reason.

I have built GNU gettext 0.22.3 in various configurations on the AIX 7.1
and 7.3 machines in the compilefarm, and haven't encountered issues with
'max_align_t' nor with 'getpeername'. So, from my point of view, GNU gettext
works fine on AIX with gcc and xlc (but not ibm-clang, which I haven't
tested).

You will surely understand that I cannot test a release against a compiler
that exists only on your hard disk.

The hint I gave you, based on the partial logs that you provided, is to
look at the configure test for intmax_t first.

Bruno




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

* Re: building GNU gettext on AIX
  2023-11-15 22:39             ` Bruno Haible
@ 2023-11-16 16:00               ` David Edelsohn
  2023-11-16 16:35                 ` David Edelsohn
       [not found]                 ` <84B39BF1-33D5-488E-8CF5-D08B09417568@gmail.com>
  0 siblings, 2 replies; 60+ messages in thread
From: David Edelsohn @ 2023-11-16 16:00 UTC (permalink / raw)
  To: Bruno Haible, Arsen Arsenović; +Cc: GCC Patches, bug-gettext

[-- Attachment #1: Type: text/plain, Size: 1712 bytes --]

Bruno,

I have been able to tweak the environment and build gettext and libintl.
With the updated libintl and environment, GCC reliably does not use NLS.

The issue is that libintl utilizes pthreads.  AIX does not provide no-op
pthread stubs in libc.  pthreads is an explicit multilib on AIX.

It is great that gettext and libintl can be built thread-safe, but GCC
(cc1, gcov, etc.) are not pthreads applications and are not built with
pthreads.  Because libintl defaults to pthreads enabled, NLS cannot
function in GCC on AIX by default.  The GCC included gettext was built in
the default for GCC libraries, which was not pthreads enabled.

I can rebuild libintl with --disable-pthreads and I will see if that works,
but the default, distributed libintl library will not allow GCC to be built
with NLS enabled.  And, no, GCC on AIX should not be forced to build with
pthreads.

This is a regression in NLS support in GCC.

Thanks, David


On Wed, Nov 15, 2023 at 5:39 PM Bruno Haible <bruno@clisp.org> wrote:

> David Edelsohn wrote:
> > I am using my own install of GCC for a reason.
>
> I have built GNU gettext 0.22.3 in various configurations on the AIX 7.1
> and 7.3 machines in the compilefarm, and haven't encountered issues with
> 'max_align_t' nor with 'getpeername'. So, from my point of view, GNU
> gettext
> works fine on AIX with gcc and xlc (but not ibm-clang, which I haven't
> tested).
>
> You will surely understand that I cannot test a release against a compiler
> that exists only on your hard disk.
>
> The hint I gave you, based on the partial logs that you provided, is to
> look at the configure test for intmax_t first.
>
> Bruno
>
>
>
>

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

* Re: building GNU gettext on AIX
  2023-11-16 16:00               ` David Edelsohn
@ 2023-11-16 16:35                 ` David Edelsohn
  2023-11-16 18:01                   ` David Edelsohn
       [not found]                 ` <84B39BF1-33D5-488E-8CF5-D08B09417568@gmail.com>
  1 sibling, 1 reply; 60+ messages in thread
From: David Edelsohn @ 2023-11-16 16:35 UTC (permalink / raw)
  To: Bruno Haible, Arsen Arsenović; +Cc: GCC Patches, bug-gettext

[-- Attachment #1: Type: text/plain, Size: 2890 bytes --]

I configured gettext with --disable-pthreads and libintl.a still contains
references to pthread_mutex_lock and pthread_mutex_unlock, which causes NLS
configure to fail on AIX.

How can this be corrected?

Thanks, David

libintl.a[libgnu_la-mbrtowc.o]:

         - U __lc_charmap

         - U errno

         - U .locale_encoding_classification

         - U .gl_get_mbtowc_lock

         - U .pthread_mutex_lock

         - U .mbtowc

         - U .pthread_mutex_unlock

         - U .abort

         0 T ._libintl_mbrtowc

      1952 D _libintl_mbrtowc

libintl.a[libgnu_la-setlocale_null.o]:

         - U .gl_get_setlocale_null_lock

         - U .pthread_mutex_lock

         - U .setlocale

         - U .strlen

         - U .memcpy

         - U .pthread_mutex_unlock

         - U .abort

         - U .strcpy

       336 T ._libintl_setlocale_null_r

       400 T ._libintl_setlocale_null

       812 D _libintl_setlocale_null_r

       824 D _libintl_setlocale_null

On Thu, Nov 16, 2023 at 11:00 AM David Edelsohn <dje.gcc@gmail.com> wrote:

> Bruno,
>
> I have been able to tweak the environment and build gettext and libintl.
> With the updated libintl and environment, GCC reliably does not use NLS.
>
> The issue is that libintl utilizes pthreads.  AIX does not provide no-op
> pthread stubs in libc.  pthreads is an explicit multilib on AIX.
>
> It is great that gettext and libintl can be built thread-safe, but GCC
> (cc1, gcov, etc.) are not pthreads applications and are not built with
> pthreads.  Because libintl defaults to pthreads enabled, NLS cannot
> function in GCC on AIX by default.  The GCC included gettext was built in
> the default for GCC libraries, which was not pthreads enabled.
>
> I can rebuild libintl with --disable-pthreads and I will see if that
> works, but the default, distributed libintl library will not allow GCC to
> be built with NLS enabled.  And, no, GCC on AIX should not be forced to
> build with pthreads.
>
> This is a regression in NLS support in GCC.
>
> Thanks, David
>
>
> On Wed, Nov 15, 2023 at 5:39 PM Bruno Haible <bruno@clisp.org> wrote:
>
>> David Edelsohn wrote:
>> > I am using my own install of GCC for a reason.
>>
>> I have built GNU gettext 0.22.3 in various configurations on the AIX 7.1
>> and 7.3 machines in the compilefarm, and haven't encountered issues with
>> 'max_align_t' nor with 'getpeername'. So, from my point of view, GNU
>> gettext
>> works fine on AIX with gcc and xlc (but not ibm-clang, which I haven't
>> tested).
>>
>> You will surely understand that I cannot test a release against a compiler
>> that exists only on your hard disk.
>>
>> The hint I gave you, based on the partial logs that you provided, is to
>> look at the configure test for intmax_t first.
>>
>> Bruno
>>
>>
>>
>>

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

* Re: building GNU gettext on AIX
       [not found]                 ` <84B39BF1-33D5-488E-8CF5-D08B09417568@gmail.com>
@ 2023-11-16 17:44                   ` David Edelsohn
  2023-11-16 18:47                     ` Bruno Haible
  0 siblings, 1 reply; 60+ messages in thread
From: David Edelsohn @ 2023-11-16 17:44 UTC (permalink / raw)
  To: Richard Biener
  Cc: Bruno Haible, Arsen Arsenović, GCC Patches, bug-gettext

[-- Attachment #1: Type: text/plain, Size: 2270 bytes --]

On Thu, Nov 16, 2023 at 11:58 AM Richard Biener <richard.guenther@gmail.com>
wrote:

>
>
> Am 16.11.2023 um 17:00 schrieb David Edelsohn <dje.gcc@gmail.com>:
>
> 
> Bruno,
>
> I have been able to tweak the environment and build gettext and libintl.
> With the updated libintl and environment, GCC reliably does not use NLS.
>
> The issue is that libintl utilizes pthreads.  AIX does not provide no-op
> pthread stubs in libc.  pthreads is an explicit multilib on AIX.
>
> It is great that gettext and libintl can be built thread-safe, but GCC
> (cc1, gcov, etc.) are not pthreads applications and are not built with
> pthreads.  Because libintl defaults to pthreads enabled, NLS cannot
> function in GCC on AIX by default.  The GCC included gettext was built in
> the default for GCC libraries, which was not pthreads enabled.
>
> I can rebuild libintl with --disable-pthreads and I will see if that
> works, but the default, distributed libintl library will not allow GCC to
> be built with NLS enabled.  And, no, GCC on AIX should not be forced to
> build with pthreads.
>
> This is a regression in NLS support in GCC.
>
>
> If that’s for the in-tree libintl we can arrange configure to pass down
> —disable-pthreads like we adjust configure args for gmp and friends as well.
>

The latest issue is that a few files in gettext ignore --disable-pthreads
and creates a dependency on pthread_mutex.

David



>
> Richard
>
> Thanks, David
>
>
> On Wed, Nov 15, 2023 at 5:39 PM Bruno Haible <bruno@clisp.org> wrote:
>
>> David Edelsohn wrote:
>> > I am using my own install of GCC for a reason.
>>
>> I have built GNU gettext 0.22.3 in various configurations on the AIX 7.1
>> and 7.3 machines in the compilefarm, and haven't encountered issues with
>> 'max_align_t' nor with 'getpeername'. So, from my point of view, GNU
>> gettext
>> works fine on AIX with gcc and xlc (but not ibm-clang, which I haven't
>> tested).
>>
>> You will surely understand that I cannot test a release against a compiler
>> that exists only on your hard disk.
>>
>> The hint I gave you, based on the partial logs that you provided, is to
>> look at the configure test for intmax_t first.
>>
>> Bruno
>>
>>
>>
>>

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

* Re: building GNU gettext on AIX
  2023-11-16 16:35                 ` David Edelsohn
@ 2023-11-16 18:01                   ` David Edelsohn
  2023-11-16 18:17                     ` David Edelsohn
  0 siblings, 1 reply; 60+ messages in thread
From: David Edelsohn @ 2023-11-16 18:01 UTC (permalink / raw)
  To: Bruno Haible, Arsen Arsenović; +Cc: GCC Patches, bug-gettext

[-- Attachment #1: Type: text/plain, Size: 3355 bytes --]

Bruno,

The issue appears to be that intl/gnulib-lib/{mbrtowc.c,setlocale_null.c}
include pthread.h based on HAVE_PTHREAD_API, which is defined as 1 in
intl/config.h build directory despite requesting --disable-pthreads.

Thanks, David

On Thu, Nov 16, 2023 at 11:35 AM David Edelsohn <dje.gcc@gmail.com> wrote:

> I configured gettext with --disable-pthreads and libintl.a still contains
> references to pthread_mutex_lock and pthread_mutex_unlock, which causes NLS
> configure to fail on AIX.
>
> How can this be corrected?
>
> Thanks, David
>
> libintl.a[libgnu_la-mbrtowc.o]:
>
>          - U __lc_charmap
>
>          - U errno
>
>          - U .locale_encoding_classification
>
>          - U .gl_get_mbtowc_lock
>
>          - U .pthread_mutex_lock
>
>          - U .mbtowc
>
>          - U .pthread_mutex_unlock
>
>          - U .abort
>
>          0 T ._libintl_mbrtowc
>
>       1952 D _libintl_mbrtowc
>
> libintl.a[libgnu_la-setlocale_null.o]:
>
>          - U .gl_get_setlocale_null_lock
>
>          - U .pthread_mutex_lock
>
>          - U .setlocale
>
>          - U .strlen
>
>          - U .memcpy
>
>          - U .pthread_mutex_unlock
>
>          - U .abort
>
>          - U .strcpy
>
>        336 T ._libintl_setlocale_null_r
>
>        400 T ._libintl_setlocale_null
>
>        812 D _libintl_setlocale_null_r
>
>        824 D _libintl_setlocale_null
>
> On Thu, Nov 16, 2023 at 11:00 AM David Edelsohn <dje.gcc@gmail.com> wrote:
>
>> Bruno,
>>
>> I have been able to tweak the environment and build gettext and libintl.
>> With the updated libintl and environment, GCC reliably does not use NLS.
>>
>> The issue is that libintl utilizes pthreads.  AIX does not provide no-op
>> pthread stubs in libc.  pthreads is an explicit multilib on AIX.
>>
>> It is great that gettext and libintl can be built thread-safe, but GCC
>> (cc1, gcov, etc.) are not pthreads applications and are not built with
>> pthreads.  Because libintl defaults to pthreads enabled, NLS cannot
>> function in GCC on AIX by default.  The GCC included gettext was built in
>> the default for GCC libraries, which was not pthreads enabled.
>>
>> I can rebuild libintl with --disable-pthreads and I will see if that
>> works, but the default, distributed libintl library will not allow GCC to
>> be built with NLS enabled.  And, no, GCC on AIX should not be forced to
>> build with pthreads.
>>
>> This is a regression in NLS support in GCC.
>>
>> Thanks, David
>>
>>
>> On Wed, Nov 15, 2023 at 5:39 PM Bruno Haible <bruno@clisp.org> wrote:
>>
>>> David Edelsohn wrote:
>>> > I am using my own install of GCC for a reason.
>>>
>>> I have built GNU gettext 0.22.3 in various configurations on the AIX 7.1
>>> and 7.3 machines in the compilefarm, and haven't encountered issues with
>>> 'max_align_t' nor with 'getpeername'. So, from my point of view, GNU
>>> gettext
>>> works fine on AIX with gcc and xlc (but not ibm-clang, which I haven't
>>> tested).
>>>
>>> You will surely understand that I cannot test a release against a
>>> compiler
>>> that exists only on your hard disk.
>>>
>>> The hint I gave you, based on the partial logs that you provided, is to
>>> look at the configure test for intmax_t first.
>>>
>>> Bruno
>>>
>>>
>>>
>>>

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

* Re: building GNU gettext on AIX
  2023-11-16 18:01                   ` David Edelsohn
@ 2023-11-16 18:17                     ` David Edelsohn
  2023-11-16 18:52                       ` Bruno Haible
  0 siblings, 1 reply; 60+ messages in thread
From: David Edelsohn @ 2023-11-16 18:17 UTC (permalink / raw)
  To: Bruno Haible, Arsen Arsenović; +Cc: GCC Patches, bug-gettext

[-- Attachment #1: Type: text/plain, Size: 3904 bytes --]

I manually commented out HAVE_PTHREAD_API from config.h and produced a
libintl.a without references to pthreads.  Configuring GCC with that custom
libintl.a enables NLS.  I now am building GCC with NLS and we will see how
well it functions.

gettext depends on pthreads by default and the versions distributed.

Thanks, David


On Thu, Nov 16, 2023 at 1:01 PM David Edelsohn <dje.gcc@gmail.com> wrote:

> Bruno,
>
> The issue appears to be that intl/gnulib-lib/{mbrtowc.c,setlocale_null.c}
> include pthread.h based on HAVE_PTHREAD_API, which is defined as 1 in
> intl/config.h build directory despite requesting --disable-pthreads.
>
> Thanks, David
>
> On Thu, Nov 16, 2023 at 11:35 AM David Edelsohn <dje.gcc@gmail.com> wrote:
>
>> I configured gettext with --disable-pthreads and libintl.a still contains
>> references to pthread_mutex_lock and pthread_mutex_unlock, which causes NLS
>> configure to fail on AIX.
>>
>> How can this be corrected?
>>
>> Thanks, David
>>
>> libintl.a[libgnu_la-mbrtowc.o]:
>>
>>          - U __lc_charmap
>>
>>          - U errno
>>
>>          - U .locale_encoding_classification
>>
>>          - U .gl_get_mbtowc_lock
>>
>>          - U .pthread_mutex_lock
>>
>>          - U .mbtowc
>>
>>          - U .pthread_mutex_unlock
>>
>>          - U .abort
>>
>>          0 T ._libintl_mbrtowc
>>
>>       1952 D _libintl_mbrtowc
>>
>> libintl.a[libgnu_la-setlocale_null.o]:
>>
>>          - U .gl_get_setlocale_null_lock
>>
>>          - U .pthread_mutex_lock
>>
>>          - U .setlocale
>>
>>          - U .strlen
>>
>>          - U .memcpy
>>
>>          - U .pthread_mutex_unlock
>>
>>          - U .abort
>>
>>          - U .strcpy
>>
>>        336 T ._libintl_setlocale_null_r
>>
>>        400 T ._libintl_setlocale_null
>>
>>        812 D _libintl_setlocale_null_r
>>
>>        824 D _libintl_setlocale_null
>>
>> On Thu, Nov 16, 2023 at 11:00 AM David Edelsohn <dje.gcc@gmail.com>
>> wrote:
>>
>>> Bruno,
>>>
>>> I have been able to tweak the environment and build gettext and
>>> libintl.  With the updated libintl and environment, GCC reliably does not
>>> use NLS.
>>>
>>> The issue is that libintl utilizes pthreads.  AIX does not provide no-op
>>> pthread stubs in libc.  pthreads is an explicit multilib on AIX.
>>>
>>> It is great that gettext and libintl can be built thread-safe, but GCC
>>> (cc1, gcov, etc.) are not pthreads applications and are not built with
>>> pthreads.  Because libintl defaults to pthreads enabled, NLS cannot
>>> function in GCC on AIX by default.  The GCC included gettext was built in
>>> the default for GCC libraries, which was not pthreads enabled.
>>>
>>> I can rebuild libintl with --disable-pthreads and I will see if that
>>> works, but the default, distributed libintl library will not allow GCC to
>>> be built with NLS enabled.  And, no, GCC on AIX should not be forced to
>>> build with pthreads.
>>>
>>> This is a regression in NLS support in GCC.
>>>
>>> Thanks, David
>>>
>>>
>>> On Wed, Nov 15, 2023 at 5:39 PM Bruno Haible <bruno@clisp.org> wrote:
>>>
>>>> David Edelsohn wrote:
>>>> > I am using my own install of GCC for a reason.
>>>>
>>>> I have built GNU gettext 0.22.3 in various configurations on the AIX 7.1
>>>> and 7.3 machines in the compilefarm, and haven't encountered issues with
>>>> 'max_align_t' nor with 'getpeername'. So, from my point of view, GNU
>>>> gettext
>>>> works fine on AIX with gcc and xlc (but not ibm-clang, which I haven't
>>>> tested).
>>>>
>>>> You will surely understand that I cannot test a release against a
>>>> compiler
>>>> that exists only on your hard disk.
>>>>
>>>> The hint I gave you, based on the partial logs that you provided, is to
>>>> look at the configure test for intmax_t first.
>>>>
>>>> Bruno
>>>>
>>>>
>>>>
>>>>

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-15 17:19       ` David Edelsohn
@ 2023-11-16 18:33         ` Arsen Arsenović
  2023-11-16 21:11           ` Arsen Arsenović
  0 siblings, 1 reply; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-16 18:33 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Richard Biener, GCC Patches, Bruno Haible

[-- Attachment #1: Type: text/plain, Size: 2649 bytes --]


David Edelsohn <dje.gcc@gmail.com> writes:

> On Wed, Nov 15, 2023 at 9:22 AM Arsen Arsenović <arsen@aarsen.me> wrote:
>
>>
>> David Edelsohn <dje.gcc@gmail.com> writes:
>>
>> > GCC had been working on AIX with NLS, using "--with-included-gettext".
>> > --disable-nls gets past the breakage, but GCC does not build for me on
>> AIX
>> > with NLS enabled.
>>
>> That should still work with gettext 0.22+ extracted in-tree (it should
>> be fetched by download_prerequisites).
>>
>> > A change in dependencies for GCC should have been announced and more
>> widely
>> > socialized in the GCC development mailing list, not just GCC patches
>> > mailing list.
>> >
>> > I have tried both the AIX Open Source libiconv and libgettext package,
>> and
>> > the ones that I previously built.  Both fail because GCC configure
>> decides
>> > to disable NLS, despite being requested, while libcpp is satisfied, so
>> > tools in the gcc subdirectory don't link against libiconv and the build
>> > fails.  With the included gettext, I was able to rely on a
>> self-consistent
>> > solution.
>>
>> That is interesting.  They should be using the same checks.  I've
>> checked trunk and regenerated files on it, and saw no significant diff
>> (some whitespace changes only).  Could you post the config.log of both?
>>
>> I've never used AIX.  Can I reproduce this on one of the cfarm machines
>> to poke around?  I've tried cfarm119, but that one lacked git, and I
>> haven't poked around much further due to time constraints.
>>
>
> The AIX system in the Compile Farm has a complete complement of Open Source
> software installed.
>
> Please ensure that /opt/freeware/bin is in your path.  Also, the GCC Wiki
> Compile Farm page has build tips that include AIX
>
> https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines

Thanks, that got me further.

> that recommended --with-included-gettext configuration option.

This flag should still exist and operate the same if gettext is present
in tree.  I've cloned gcc and downloaded prerequisites (via
contrib/download_prerequisites) and I am trying to configure it now.

> Thanks, David
>
>
>>
>> TIA, sorry about the inconvenience.  Have a lovely day.
>>
>> > The current gettext-0.22.3 fails to build for me on AIX.
>> >
>> > libcpp configure believes that NLS functions on AIX, but gcc configure
>> > fails in its tests of gettext functionality, which leads to an
>> inconsistent
>> > configuration and build breakage.
>> >
>> > Thanks, David
>>
>>
>> --
>> Arsen Arsenović
>>


-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: building GNU gettext on AIX
  2023-11-16 17:44                   ` David Edelsohn
@ 2023-11-16 18:47                     ` Bruno Haible
  2023-11-16 18:50                       ` Arsen Arsenović
  2023-11-19 19:49                       ` Bruno Haible
  0 siblings, 2 replies; 60+ messages in thread
From: Bruno Haible @ 2023-11-16 18:47 UTC (permalink / raw)
  To: Richard Biener, David Edelsohn
  Cc: Arsen Arsenović, GCC Patches, bug-gettext

David Edelsohn wrote:
> > It is great that gettext and libintl can be built thread-safe, but GCC
> > (cc1, gcov, etc.) are not pthreads applications and are not built with
> > pthreads.  Because libintl defaults to pthreads enabled, NLS cannot
> > function in GCC on AIX by default.  
> ...
> The latest issue is that a few files in gettext ignore --disable-pthreads
> and creates a dependency on pthread_mutex.

GNU gettext does not have an option '--disable-pthreads'. Instead, it has
options

  --enable-threads={isoc|posix|isoc+posix|windows}
                          specify multithreading API

  --disable-threads       build without multithread safety

> The issue appears to be that intl/gnulib-lib/{mbrtowc.c,setlocale_null.c}
> include pthread.h based on HAVE_PTHREAD_API, which is defined as 1 in
> intl/config.h build directory

Yup, I confirm that the dependency comes from these two object files.

Will the next GCC release support AIX 7.1.x ? Recall that AIX 7.1 went
end-of-life on 2023-04-30 [1]

  * If no, then the simple solution would be to pass the configure option
      --enable-threads=isoc
    This should not introduce a link dependency, because the mtx_lock,
    mtx_unlock, and mtx_init functions are in libc in AIX ≥ 7.2. Currently it
    does not work (it still uses pthread_mutex_lock and pthread_mutex_unlock
    despite --enable-threads=isoc). But I could make this work and release
    a gettext 0.22.4 with the fix.

  * If yes, then the question is how distributors will in general package
    libintl on AIX. If it's installed in public locations (such as in
    /opt/freeware/{lib,lib64}/libintl.a on gcc119.fsffrance.org), then we
    have a problem: It may cause undefined behaviour in multithreaded
    packages that use GNU libintl.
    If you can guarantee that it will be installed in GCC-private directories
    (and outside the path where GCC looks for libraries to link with!) then
    it would be OK to install such a non-thread-safe libintl.
    But if you cannot guarantee that, we are in trouble.

    How do other library vendors handle this issue on AIX? Do they ship two
    libraries, one MT-safe and one not? Under different names? Or in different
    library search paths?

Bruno

[1] https://www.ibm.com/support/pages/aix-support-lifecycle-information




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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-15 15:51       ` Xi Ruoyao
@ 2023-11-16 18:48         ` Arsen Arsenović
  0 siblings, 0 replies; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-16 18:48 UTC (permalink / raw)
  To: Xi Ruoyao; +Cc: David Edelsohn, Richard Biener, GCC Patches, Bruno Haible

[-- Attachment #1: Type: text/plain, Size: 1310 bytes --]


Xi Ruoyao <xry111@xry111.site> writes:

> On Wed, 2023-11-15 at 15:14 +0100, Arsen Arsenović wrote:
>> That is interesting.  They should be using the same checks.  I've
>> checked trunk and regenerated files on it, and saw no significant diff
>> (some whitespace changes only).  Could you post the config.log of
>> both?
>
> You did not regenerate config.in.  But I've regenerated it in r14-5434
> anyway.
>
> The related changes:
>
> +/* Define to 1 if you have the Mac OS X function
> +   CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */
> +#ifndef USED_FOR_TARGET
> +#undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES
> +#endif
> +
> +
> +/* Define to 1 if you have the Mac OS X function
> CFPreferencesCopyAppValue in
> +   the CoreFoundation framework. */
> +#ifndef USED_FOR_TARGET
> +#undef HAVE_CFPREFERENCESCOPYAPPVALUE
> +#endif
>
> +/* Define if the GNU dcgettext() function is already present or preinstalled.
> +   */
> +#ifndef USED_FOR_TARGET
> +#undef HAVE_DCGETTEXT
> +#endif
>
> +/* Define if the GNU gettext() function is already present or preinstalled. */
> +#ifndef USED_FOR_TARGET
> +#undef HAVE_GETTEXT
> +#endif
>
> I don't know if they are related to the issue on AIX though.

Ah, thanks for doing that.
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: building GNU gettext on AIX
  2023-11-16 18:47                     ` Bruno Haible
@ 2023-11-16 18:50                       ` Arsen Arsenović
  2023-11-16 18:59                         ` Bruno Haible
  2023-11-19 19:49                       ` Bruno Haible
  1 sibling, 1 reply; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-16 18:50 UTC (permalink / raw)
  To: Bruno Haible; +Cc: Richard Biener, David Edelsohn, GCC Patches, bug-gettext

[-- Attachment #1: Type: text/plain, Size: 2732 bytes --]


Bruno Haible <bruno@clisp.org> writes:

> David Edelsohn wrote:
>> > It is great that gettext and libintl can be built thread-safe, but GCC
>> > (cc1, gcov, etc.) are not pthreads applications and are not built with
>> > pthreads.  Because libintl defaults to pthreads enabled, NLS cannot
>> > function in GCC on AIX by default.  
>> ...
>> The latest issue is that a few files in gettext ignore --disable-pthreads
>> and creates a dependency on pthread_mutex.
>
> GNU gettext does not have an option '--disable-pthreads'. Instead, it has
> options
>
>   --enable-threads={isoc|posix|isoc+posix|windows}
>                           specify multithreading API
>
>   --disable-threads       build without multithread safety
>
>> The issue appears to be that intl/gnulib-lib/{mbrtowc.c,setlocale_null.c}
>> include pthread.h based on HAVE_PTHREAD_API, which is defined as 1 in
>> intl/config.h build directory
>
> Yup, I confirm that the dependency comes from these two object files.
>
> Will the next GCC release support AIX 7.1.x ? Recall that AIX 7.1 went
> end-of-life on 2023-04-30 [1]
>
>   * If no, then the simple solution would be to pass the configure option
>       --enable-threads=isoc
>     This should not introduce a link dependency, because the mtx_lock,
>     mtx_unlock, and mtx_init functions are in libc in AIX ≥ 7.2. Currently it
>     does not work (it still uses pthread_mutex_lock and pthread_mutex_unlock
>     despite --enable-threads=isoc). But I could make this work and release
>     a gettext 0.22.4 with the fix.
>
>   * If yes, then the question is how distributors will in general package
>     libintl on AIX. If it's installed in public locations (such as in
>     /opt/freeware/{lib,lib64}/libintl.a on gcc119.fsffrance.org), then we
>     have a problem: It may cause undefined behaviour in multithreaded
>     packages that use GNU libintl.
>     If you can guarantee that it will be installed in GCC-private directories
>     (and outside the path where GCC looks for libraries to link with!) then
>     it would be OK to install such a non-thread-safe libintl.
>     But if you cannot guarantee that, we are in trouble.

The in-tree configuration already passes --disable-shared, so I imagine
passing --disable-threads would be OK too, for the case that it is
utilized.  (relevant for the latter case: GCC-private build of libintl)

>     How do other library vendors handle this issue on AIX? Do they ship two
>     libraries, one MT-safe and one not? Under different names? Or in different
>     library search paths?
>
> Bruno
>
> [1] https://www.ibm.com/support/pages/aix-support-lifecycle-information


-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: building GNU gettext on AIX
  2023-11-16 18:17                     ` David Edelsohn
@ 2023-11-16 18:52                       ` Bruno Haible
  2023-11-16 22:18                         ` David Edelsohn
  0 siblings, 1 reply; 60+ messages in thread
From: Bruno Haible @ 2023-11-16 18:52 UTC (permalink / raw)
  To: Arsen Arsenović, David Edelsohn; +Cc: GCC Patches, bug-gettext

David Edelsohn wrote:
> I manually commented out HAVE_PTHREAD_API from config.h and produced a
> libintl.a without references to pthreads.

Good finding!

Commenting out HAVE_PTHREAD_API from config.h is also what makes the
option --enable-threads=isoc work as expected on AIX 7.3.

Bruno




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

* Re: building GNU gettext on AIX
  2023-11-16 18:50                       ` Arsen Arsenović
@ 2023-11-16 18:59                         ` Bruno Haible
  2023-11-16 19:14                           ` Arsen Arsenović
  0 siblings, 1 reply; 60+ messages in thread
From: Bruno Haible @ 2023-11-16 18:59 UTC (permalink / raw)
  To: Arsen Arsenović
  Cc: Richard Biener, David Edelsohn, GCC Patches, bug-gettext

Arsen Arsenović wrote:
> >   * If yes, then the question is how distributors will in general package
> >     libintl on AIX. If it's installed in public locations (such as in
> >     /opt/freeware/{lib,lib64}/libintl.a on gcc119.fsffrance.org), then we
> >     have a problem: It may cause undefined behaviour in multithreaded
> >     packages that use GNU libintl.
> >     If you can guarantee that it will be installed in GCC-private directories
> >     (and outside the path where GCC looks for libraries to link with!) then
> >     it would be OK to install such a non-thread-safe libintl.
> >     But if you cannot guarantee that, we are in trouble.
> 
> The in-tree configuration already passes --disable-shared, so I imagine
> passing --disable-threads would be OK too, for the case that it is
> utilized.  (relevant for the latter case: GCC-private build of libintl)

Yeah, but this affects only those people who use the in-tree build of
the libraries.

The problem for distributors remains the same: They have a strong tendency
of building libraries indepently, with --enable-shared (so that they can
easily apply fixes without rebuilding the world). These distributors on AIX
would notice that the GCC configuration attempts to link with "-lintl"
but not with "-lintl -pthread" and thus the configuration detects that NLS
is not usable.

Arsen: Where in the GCC tree is this part of the GCC configuration? Is it
in some configure.ac owned by GCC, or does it come from gettext.m4 ?

Bruno




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

* Re: building GNU gettext on AIX
  2023-11-16 18:59                         ` Bruno Haible
@ 2023-11-16 19:14                           ` Arsen Arsenović
  0 siblings, 0 replies; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-16 19:14 UTC (permalink / raw)
  To: Bruno Haible; +Cc: Richard Biener, David Edelsohn, GCC Patches, bug-gettext

[-- Attachment #1: Type: text/plain, Size: 2089 bytes --]


Bruno Haible <bruno@clisp.org> writes:

> Arsen Arsenović wrote:
>> >   * If yes, then the question is how distributors will in general package
>> >     libintl on AIX. If it's installed in public locations (such as in
>> >     /opt/freeware/{lib,lib64}/libintl.a on gcc119.fsffrance.org), then we
>> >     have a problem: It may cause undefined behaviour in multithreaded
>> >     packages that use GNU libintl.
>> >     If you can guarantee that it will be installed in GCC-private directories
>> >     (and outside the path where GCC looks for libraries to link with!) then
>> >     it would be OK to install such a non-thread-safe libintl.
>> >     But if you cannot guarantee that, we are in trouble.
>> 
>> The in-tree configuration already passes --disable-shared, so I imagine
>> passing --disable-threads would be OK too, for the case that it is
>> utilized.  (relevant for the latter case: GCC-private build of libintl)
>
> Yeah, but this affects only those people who use the in-tree build of
> the libraries.
>
> The problem for distributors remains the same: They have a strong tendency
> of building libraries indepently, with --enable-shared (so that they can
> easily apply fixes without rebuilding the world). These distributors on AIX
> would notice that the GCC configuration attempts to link with "-lintl"
> but not with "-lintl -pthread" and thus the configuration detects that NLS
> is not usable.
>
> Arsen: Where in the GCC tree is this part of the GCC configuration? Is it
> in some configure.ac owned by GCC, or does it come from gettext.m4 ?

See Makefile.def.  It specifies a host-gettext module that has the extra
flags set.

If the in-tree configuration is used, then the uninstalled-config.sh
gettext generates is used.  See config/gettext-sister.m4.

gettext.m4 is unaltered, but it is essentially only used when the
gettext in-tree source is not present (because, otherwise,
gettext-runtime generates uninstalled-config.sh even if it builds
nothing)

Hope that answers it.

> Bruno


-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-16 18:33         ` Arsen Arsenović
@ 2023-11-16 21:11           ` Arsen Arsenović
  2023-11-16 21:40             ` David Edelsohn
  0 siblings, 1 reply; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-16 21:11 UTC (permalink / raw)
  To: Arsen Arsenović
  Cc: David Edelsohn, Richard Biener, Bruno Haible, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 3613 bytes --]


Arsen Arsenović <arsen@aarsen.me> writes:

> [[PGP Signed Part:Good signature from 52C294301EA2C493 Arsen Arsenović (Gentoo Developer UID) <arsen@gentoo.org> (trust ultimate) created at 2023-11-16T19:47:16+0100 using EDDSA]]
>
> David Edelsohn <dje.gcc@gmail.com> writes:
>
>> On Wed, Nov 15, 2023 at 9:22 AM Arsen Arsenović <arsen@aarsen.me> wrote:
>>
>>>
>>> David Edelsohn <dje.gcc@gmail.com> writes:
>>>
>>> > GCC had been working on AIX with NLS, using "--with-included-gettext".
>>> > --disable-nls gets past the breakage, but GCC does not build for me on
>>> AIX
>>> > with NLS enabled.
>>>
>>> That should still work with gettext 0.22+ extracted in-tree (it should
>>> be fetched by download_prerequisites).
>>>
>>> > A change in dependencies for GCC should have been announced and more
>>> widely
>>> > socialized in the GCC development mailing list, not just GCC patches
>>> > mailing list.
>>> >
>>> > I have tried both the AIX Open Source libiconv and libgettext package,
>>> and
>>> > the ones that I previously built.  Both fail because GCC configure
>>> decides
>>> > to disable NLS, despite being requested, while libcpp is satisfied, so
>>> > tools in the gcc subdirectory don't link against libiconv and the build
>>> > fails.  With the included gettext, I was able to rely on a
>>> self-consistent
>>> > solution.
>>>
>>> That is interesting.  They should be using the same checks.  I've
>>> checked trunk and regenerated files on it, and saw no significant diff
>>> (some whitespace changes only).  Could you post the config.log of both?
>>>
>>> I've never used AIX.  Can I reproduce this on one of the cfarm machines
>>> to poke around?  I've tried cfarm119, but that one lacked git, and I
>>> haven't poked around much further due to time constraints.
>>>
>>
>> The AIX system in the Compile Farm has a complete complement of Open Source
>> software installed.
>>
>> Please ensure that /opt/freeware/bin is in your path.  Also, the GCC Wiki
>> Compile Farm page has build tips that include AIX
>>
>> https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
>
> Thanks, that got me further.
>
>> that recommended --with-included-gettext configuration option.
>
> This flag should still exist and operate the same if gettext is present
> in tree.  I've cloned gcc and downloaded prerequisites (via
> contrib/download_prerequisites) and I am trying to configure it now.

The build failed.  After gettext/gmp/... (in-tree hostlibs) get built
and added to library paths, further GCC processes fail to run:

configure:3305: gcc -g  -static-libstdc++ -static-libgcc -Wl,-bbigtoc conftest.c  >&5
Could not load program /opt/freeware/libexec/gcc/powerpc-ibm-aix7.3.0.0/10/cc1:
        Dependent module /home/arsen/build/./gmp/.libs/libgmp.a(libgmp.so.10) could not be loaded.
        Member libgmp.so.10 is not found in archive 

This seems odd.  I am not sure what compels the RTDL (?) to look up .sos
in archives, or how it knows about these archives..  I suspect it's
getting tripped by something in HOST_EXPORTS.

>> Thanks, David
>>
>>
>>>
>>> TIA, sorry about the inconvenience.  Have a lovely day.
>>>
>>> > The current gettext-0.22.3 fails to build for me on AIX.
>>> >
>>> > libcpp configure believes that NLS functions on AIX, but gcc configure
>>> > fails in its tests of gettext functionality, which leads to an
>>> inconsistent
>>> > configuration and build breakage.
>>> >
>>> > Thanks, David
>>>
>>>
>>> --
>>> Arsen Arsenović
>>>


-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-16 21:11           ` Arsen Arsenović
@ 2023-11-16 21:40             ` David Edelsohn
  2023-11-16 22:19               ` Arsen Arsenović
  0 siblings, 1 reply; 60+ messages in thread
From: David Edelsohn @ 2023-11-16 21:40 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: Richard Biener, Bruno Haible, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 4343 bytes --]

Don't build with the dependent libraries in tree.  Don't build the
dependent libraries as shared libraries. The libraries are already built
and in /opt/cfarm, as mentioned in the Compile Farm wiki.

AIX is not Solaris and not Linux.  It doesn't use ELF.  AIX shared
libraries *ARE* shared object files in archives.  Shared object versioning
is handled by multiple objects in the same archive.

Thanks, David



On Thu, Nov 16, 2023 at 4:15 PM Arsen Arsenović <arsen@aarsen.me> wrote:

>
> Arsen Arsenović <arsen@aarsen.me> writes:
>
> > [[PGP Signed Part:Good signature from 52C294301EA2C493 Arsen Arsenović
> (Gentoo Developer UID) <arsen@gentoo.org> (trust ultimate) created at
> 2023-11-16T19:47:16+0100 using EDDSA]]
> >
> > David Edelsohn <dje.gcc@gmail.com> writes:
> >
> >> On Wed, Nov 15, 2023 at 9:22 AM Arsen Arsenović <arsen@aarsen.me>
> wrote:
> >>
> >>>
> >>> David Edelsohn <dje.gcc@gmail.com> writes:
> >>>
> >>> > GCC had been working on AIX with NLS, using
> "--with-included-gettext".
> >>> > --disable-nls gets past the breakage, but GCC does not build for me
> on
> >>> AIX
> >>> > with NLS enabled.
> >>>
> >>> That should still work with gettext 0.22+ extracted in-tree (it should
> >>> be fetched by download_prerequisites).
> >>>
> >>> > A change in dependencies for GCC should have been announced and more
> >>> widely
> >>> > socialized in the GCC development mailing list, not just GCC patches
> >>> > mailing list.
> >>> >
> >>> > I have tried both the AIX Open Source libiconv and libgettext
> package,
> >>> and
> >>> > the ones that I previously built.  Both fail because GCC configure
> >>> decides
> >>> > to disable NLS, despite being requested, while libcpp is satisfied,
> so
> >>> > tools in the gcc subdirectory don't link against libiconv and the
> build
> >>> > fails.  With the included gettext, I was able to rely on a
> >>> self-consistent
> >>> > solution.
> >>>
> >>> That is interesting.  They should be using the same checks.  I've
> >>> checked trunk and regenerated files on it, and saw no significant diff
> >>> (some whitespace changes only).  Could you post the config.log of both?
> >>>
> >>> I've never used AIX.  Can I reproduce this on one of the cfarm machines
> >>> to poke around?  I've tried cfarm119, but that one lacked git, and I
> >>> haven't poked around much further due to time constraints.
> >>>
> >>
> >> The AIX system in the Compile Farm has a complete complement of Open
> Source
> >> software installed.
> >>
> >> Please ensure that /opt/freeware/bin is in your path.  Also, the GCC
> Wiki
> >> Compile Farm page has build tips that include AIX
> >>
> >>
> https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
> >
> > Thanks, that got me further.
> >
> >> that recommended --with-included-gettext configuration option.
> >
> > This flag should still exist and operate the same if gettext is present
> > in tree.  I've cloned gcc and downloaded prerequisites (via
> > contrib/download_prerequisites) and I am trying to configure it now.
>
> The build failed.  After gettext/gmp/... (in-tree hostlibs) get built
> and added to library paths, further GCC processes fail to run:
>
> configure:3305: gcc -g  -static-libstdc++ -static-libgcc -Wl,-bbigtoc
> conftest.c  >&5
> Could not load program
> /opt/freeware/libexec/gcc/powerpc-ibm-aix7.3.0.0/10/cc1:
>         Dependent module
> /home/arsen/build/./gmp/.libs/libgmp.a(libgmp.so.10) could not be loaded.
>         Member libgmp.so.10 is not found in archive
>
> This seems odd.  I am not sure what compels the RTDL (?) to look up .sos
> in archives, or how it knows about these archives..  I suspect it's
> getting tripped by something in HOST_EXPORTS.
>
> >> Thanks, David
> >>
> >>
> >>>
> >>> TIA, sorry about the inconvenience.  Have a lovely day.
> >>>
> >>> > The current gettext-0.22.3 fails to build for me on AIX.
> >>> >
> >>> > libcpp configure believes that NLS functions on AIX, but gcc
> configure
> >>> > fails in its tests of gettext functionality, which leads to an
> >>> inconsistent
> >>> > configuration and build breakage.
> >>> >
> >>> > Thanks, David
> >>>
> >>>
> >>> --
> >>> Arsen Arsenović
> >>>
>
>
> --
> Arsen Arsenović
>

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

* Re: building GNU gettext on AIX
  2023-11-16 18:52                       ` Bruno Haible
@ 2023-11-16 22:18                         ` David Edelsohn
  2023-11-16 22:46                           ` Bruno Haible
  0 siblings, 1 reply; 60+ messages in thread
From: David Edelsohn @ 2023-11-16 22:18 UTC (permalink / raw)
  To: Bruno Haible; +Cc: Arsen Arsenović, GCC Patches, bug-gettext

[-- Attachment #1: Type: text/plain, Size: 1642 bytes --]

On Thu, Nov 16, 2023 at 1:52 PM Bruno Haible <bruno@clisp.org> wrote:

> David Edelsohn wrote:
> > I manually commented out HAVE_PTHREAD_API from config.h and produced a
> > libintl.a without references to pthreads.
>
> Good finding!
>
> Commenting out HAVE_PTHREAD_API from config.h is also what makes the
> option --enable-threads=isoc work as expected on AIX 7.3.
>

I reconfigured and built gettext with --enable-threads=isoc .  libintl.a
still contains references to pthread_mutex and friends:

$ nm -BCpg libintl.a  | grep pthread

         - U __n_pthreads

         - U .pthread_mutex_lock

         - U .pthread_mutex_unlock

         - U .pthread_mutex_lock

         - U .pthread_mutex_unlock
         - U __n_pthreads

from files mbrtowc, setlocale_null, and vasnwprintf.

I tested on an AIX 7.2.5 system and confirmed that libc does provide the
mtx_ symbols:

$ nm -BCpg libc.a | grep mtx_

         0 T .mtx_timedlock

       160 T .mtx_unlock

       256 T .mtx_trylock

       416 T .mtx_lock

       512 T .mtx_init

       736 T .mtx_destroy

        80 D mtx_timedlock

        92 D mtx_unlock

       104 D mtx_trylock

       116 D mtx_lock

       128 D mtx_init

       140 D mtx_destroy


Were you suggesting that --enable-threads=isoc would work now or that it
would require further changes for a future release?


At the moment, configuring gettext with --disable-threads and manually
modifying config.h is the only method that produces

libintl.a without references to pthreads allowing GCC to build on AIX with
NLS enabled.


Thanks, David

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-16 21:40             ` David Edelsohn
@ 2023-11-16 22:19               ` Arsen Arsenović
  2023-11-16 22:30                 ` David Edelsohn
  0 siblings, 1 reply; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-16 22:19 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Richard Biener, Bruno Haible, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 5164 bytes --]


David Edelsohn <dje.gcc@gmail.com> writes:

> Don't build with the dependent libraries in tree.  Don't build the
> dependent libraries as shared libraries. The libraries are already built
> and in /opt/cfarm, as mentioned in the Compile Farm wiki.
>
> AIX is not Solaris and not Linux.  It doesn't use ELF.  AIX shared
> libraries *ARE* shared object files in archives.  Shared object versioning
> is handled by multiple objects in the same archive.

Hmm, I see.  I removed all the deps but gettext from the tree.

This leaves gettext-runtime fulfilling the previous role of intl/.

However, I'm confused about how this worked before, in that case, since,
IIRC, intl also produced libraries and was also put into host exports.

Leaving gettext in tree produces:

Could not load program gawk:
        Dependent module /home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8) could not be loaded.
        Member libintl.so.8 is not found in archive 

I'll try to see why intl/ didn't cause the same issue soon.

Thanks, have a lovely evening.

> Thanks, David
>
>
>
> On Thu, Nov 16, 2023 at 4:15 PM Arsen Arsenović <arsen@aarsen.me> wrote:
>
>>
>> Arsen Arsenović <arsen@aarsen.me> writes:
>>
>> > [[PGP Signed Part:Good signature from 52C294301EA2C493 Arsen Arsenović
>> (Gentoo Developer UID) <arsen@gentoo.org> (trust ultimate) created at
>> 2023-11-16T19:47:16+0100 using EDDSA]]
>> >
>> > David Edelsohn <dje.gcc@gmail.com> writes:
>> >
>> >> On Wed, Nov 15, 2023 at 9:22 AM Arsen Arsenović <arsen@aarsen.me>
>> wrote:
>> >>
>> >>>
>> >>> David Edelsohn <dje.gcc@gmail.com> writes:
>> >>>
>> >>> > GCC had been working on AIX with NLS, using
>> "--with-included-gettext".
>> >>> > --disable-nls gets past the breakage, but GCC does not build for me
>> on
>> >>> AIX
>> >>> > with NLS enabled.
>> >>>
>> >>> That should still work with gettext 0.22+ extracted in-tree (it should
>> >>> be fetched by download_prerequisites).
>> >>>
>> >>> > A change in dependencies for GCC should have been announced and more
>> >>> widely
>> >>> > socialized in the GCC development mailing list, not just GCC patches
>> >>> > mailing list.
>> >>> >
>> >>> > I have tried both the AIX Open Source libiconv and libgettext
>> package,
>> >>> and
>> >>> > the ones that I previously built.  Both fail because GCC configure
>> >>> decides
>> >>> > to disable NLS, despite being requested, while libcpp is satisfied,
>> so
>> >>> > tools in the gcc subdirectory don't link against libiconv and the
>> build
>> >>> > fails.  With the included gettext, I was able to rely on a
>> >>> self-consistent
>> >>> > solution.
>> >>>
>> >>> That is interesting.  They should be using the same checks.  I've
>> >>> checked trunk and regenerated files on it, and saw no significant diff
>> >>> (some whitespace changes only).  Could you post the config.log of both?
>> >>>
>> >>> I've never used AIX.  Can I reproduce this on one of the cfarm machines
>> >>> to poke around?  I've tried cfarm119, but that one lacked git, and I
>> >>> haven't poked around much further due to time constraints.
>> >>>
>> >>
>> >> The AIX system in the Compile Farm has a complete complement of Open
>> Source
>> >> software installed.
>> >>
>> >> Please ensure that /opt/freeware/bin is in your path.  Also, the GCC
>> Wiki
>> >> Compile Farm page has build tips that include AIX
>> >>
>> >>
>> https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
>> >
>> > Thanks, that got me further.
>> >
>> >> that recommended --with-included-gettext configuration option.
>> >
>> > This flag should still exist and operate the same if gettext is present
>> > in tree.  I've cloned gcc and downloaded prerequisites (via
>> > contrib/download_prerequisites) and I am trying to configure it now.
>>
>> The build failed.  After gettext/gmp/... (in-tree hostlibs) get built
>> and added to library paths, further GCC processes fail to run:
>>
>> configure:3305: gcc -g  -static-libstdc++ -static-libgcc -Wl,-bbigtoc
>> conftest.c  >&5
>> Could not load program
>> /opt/freeware/libexec/gcc/powerpc-ibm-aix7.3.0.0/10/cc1:
>>         Dependent module
>> /home/arsen/build/./gmp/.libs/libgmp.a(libgmp.so.10) could not be loaded.
>>         Member libgmp.so.10 is not found in archive
>>
>> This seems odd.  I am not sure what compels the RTDL (?) to look up .sos
>> in archives, or how it knows about these archives..  I suspect it's
>> getting tripped by something in HOST_EXPORTS.
>>
>> >> Thanks, David
>> >>
>> >>
>> >>>
>> >>> TIA, sorry about the inconvenience.  Have a lovely day.
>> >>>
>> >>> > The current gettext-0.22.3 fails to build for me on AIX.
>> >>> >
>> >>> > libcpp configure believes that NLS functions on AIX, but gcc
>> configure
>> >>> > fails in its tests of gettext functionality, which leads to an
>> >>> inconsistent
>> >>> > configuration and build breakage.
>> >>> >
>> >>> > Thanks, David
>> >>>
>> >>>
>> >>> --
>> >>> Arsen Arsenović
>> >>>
>>
>>
>> --
>> Arsen Arsenović
>>


-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-16 22:19               ` Arsen Arsenović
@ 2023-11-16 22:30                 ` David Edelsohn
  2023-11-16 22:32                   ` Arsen Arsenović
  0 siblings, 1 reply; 60+ messages in thread
From: David Edelsohn @ 2023-11-16 22:30 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: Richard Biener, Bruno Haible, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 6105 bytes --]

On Thu, Nov 16, 2023 at 5:22 PM Arsen Arsenović <arsen@aarsen.me> wrote:

>
> David Edelsohn <dje.gcc@gmail.com> writes:
>
> > Don't build with the dependent libraries in tree.  Don't build the
> > dependent libraries as shared libraries. The libraries are already built
> > and in /opt/cfarm, as mentioned in the Compile Farm wiki.
> >
> > AIX is not Solaris and not Linux.  It doesn't use ELF.  AIX shared
> > libraries *ARE* shared object files in archives.  Shared object
> versioning
> > is handled by multiple objects in the same archive.
>
> Hmm, I see.  I removed all the deps but gettext from the tree.
>
> This leaves gettext-runtime fulfilling the previous role of intl/.
>
> However, I'm confused about how this worked before, in that case, since,
> IIRC, intl also produced libraries and was also put into host exports.
>
> Leaving gettext in tree produces:
>
> Could not load program gawk:
>         Dependent module
> /home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8) could not be
> loaded.
>         Member libintl.so.8 is not found in archive
>
> I'll try to see why intl/ didn't cause the same issue soon.
>
> Thanks, have a lovely evening.
>

The previous version of "intl" was built as a static library.  Configure in
the older package had the option --enable-host-shared,
which I did not use.  Based on the failure message, the in-tree gettext
seems to be built as a shared library.  If you explicitly
pass --disable-shared to the in-tree configure, you may get farther.  I'm
currently using --disable-shared --disable-threads.
As we have discussed, the current gettext will retain some references to
pthreads despite the configure option.

Thanks, David


>
> > Thanks, David
> >
> >
> >
> > On Thu, Nov 16, 2023 at 4:15 PM Arsen Arsenović <arsen@aarsen.me> wrote:
> >
> >>
> >> Arsen Arsenović <arsen@aarsen.me> writes:
> >>
> >> > [[PGP Signed Part:Good signature from 52C294301EA2C493 Arsen Arsenović
> >> (Gentoo Developer UID) <arsen@gentoo.org> (trust ultimate) created at
> >> 2023-11-16T19:47:16+0100 using EDDSA]]
> >> >
> >> > David Edelsohn <dje.gcc@gmail.com> writes:
> >> >
> >> >> On Wed, Nov 15, 2023 at 9:22 AM Arsen Arsenović <arsen@aarsen.me>
> >> wrote:
> >> >>
> >> >>>
> >> >>> David Edelsohn <dje.gcc@gmail.com> writes:
> >> >>>
> >> >>> > GCC had been working on AIX with NLS, using
> >> "--with-included-gettext".
> >> >>> > --disable-nls gets past the breakage, but GCC does not build for
> me
> >> on
> >> >>> AIX
> >> >>> > with NLS enabled.
> >> >>>
> >> >>> That should still work with gettext 0.22+ extracted in-tree (it
> should
> >> >>> be fetched by download_prerequisites).
> >> >>>
> >> >>> > A change in dependencies for GCC should have been announced and
> more
> >> >>> widely
> >> >>> > socialized in the GCC development mailing list, not just GCC
> patches
> >> >>> > mailing list.
> >> >>> >
> >> >>> > I have tried both the AIX Open Source libiconv and libgettext
> >> package,
> >> >>> and
> >> >>> > the ones that I previously built.  Both fail because GCC configure
> >> >>> decides
> >> >>> > to disable NLS, despite being requested, while libcpp is
> satisfied,
> >> so
> >> >>> > tools in the gcc subdirectory don't link against libiconv and the
> >> build
> >> >>> > fails.  With the included gettext, I was able to rely on a
> >> >>> self-consistent
> >> >>> > solution.
> >> >>>
> >> >>> That is interesting.  They should be using the same checks.  I've
> >> >>> checked trunk and regenerated files on it, and saw no significant
> diff
> >> >>> (some whitespace changes only).  Could you post the config.log of
> both?
> >> >>>
> >> >>> I've never used AIX.  Can I reproduce this on one of the cfarm
> machines
> >> >>> to poke around?  I've tried cfarm119, but that one lacked git, and I
> >> >>> haven't poked around much further due to time constraints.
> >> >>>
> >> >>
> >> >> The AIX system in the Compile Farm has a complete complement of Open
> >> Source
> >> >> software installed.
> >> >>
> >> >> Please ensure that /opt/freeware/bin is in your path.  Also, the GCC
> >> Wiki
> >> >> Compile Farm page has build tips that include AIX
> >> >>
> >> >>
> >>
> https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
> >> >
> >> > Thanks, that got me further.
> >> >
> >> >> that recommended --with-included-gettext configuration option.
> >> >
> >> > This flag should still exist and operate the same if gettext is
> present
> >> > in tree.  I've cloned gcc and downloaded prerequisites (via
> >> > contrib/download_prerequisites) and I am trying to configure it now.
> >>
> >> The build failed.  After gettext/gmp/... (in-tree hostlibs) get built
> >> and added to library paths, further GCC processes fail to run:
> >>
> >> configure:3305: gcc -g  -static-libstdc++ -static-libgcc -Wl,-bbigtoc
> >> conftest.c  >&5
> >> Could not load program
> >> /opt/freeware/libexec/gcc/powerpc-ibm-aix7.3.0.0/10/cc1:
> >>         Dependent module
> >> /home/arsen/build/./gmp/.libs/libgmp.a(libgmp.so.10) could not be
> loaded.
> >>         Member libgmp.so.10 is not found in archive
> >>
> >> This seems odd.  I am not sure what compels the RTDL (?) to look up .sos
> >> in archives, or how it knows about these archives..  I suspect it's
> >> getting tripped by something in HOST_EXPORTS.
> >>
> >> >> Thanks, David
> >> >>
> >> >>
> >> >>>
> >> >>> TIA, sorry about the inconvenience.  Have a lovely day.
> >> >>>
> >> >>> > The current gettext-0.22.3 fails to build for me on AIX.
> >> >>> >
> >> >>> > libcpp configure believes that NLS functions on AIX, but gcc
> >> configure
> >> >>> > fails in its tests of gettext functionality, which leads to an
> >> >>> inconsistent
> >> >>> > configuration and build breakage.
> >> >>> >
> >> >>> > Thanks, David
> >> >>>
> >> >>>
> >> >>> --
> >> >>> Arsen Arsenović
> >> >>>
> >>
> >>
> >> --
> >> Arsen Arsenović
> >>
>
>
> --
> Arsen Arsenović
>

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-16 22:30                 ` David Edelsohn
@ 2023-11-16 22:32                   ` Arsen Arsenović
  2023-11-16 23:59                     ` David Edelsohn
  0 siblings, 1 reply; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-16 22:32 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Richard Biener, Bruno Haible, gcc-patches


[-- Attachment #1.1: Type: text/plain, Size: 4105 bytes --]


David Edelsohn <dje.gcc@gmail.com> writes:

> On Thu, Nov 16, 2023 at 5:22 PM Arsen Arsenović <arsen@aarsen.me> wrote:
>
>>
>> David Edelsohn <dje.gcc@gmail.com> writes:
>>
>> > Don't build with the dependent libraries in tree.  Don't build the
>> > dependent libraries as shared libraries. The libraries are already built
>> > and in /opt/cfarm, as mentioned in the Compile Farm wiki.
>> >
>> > AIX is not Solaris and not Linux.  It doesn't use ELF.  AIX shared
>> > libraries *ARE* shared object files in archives.  Shared object
>> versioning
>> > is handled by multiple objects in the same archive.
>>
>> Hmm, I see.  I removed all the deps but gettext from the tree.
>>
>> This leaves gettext-runtime fulfilling the previous role of intl/.
>>
>> However, I'm confused about how this worked before, in that case, since,
>> IIRC, intl also produced libraries and was also put into host exports.
>>
>> Leaving gettext in tree produces:
>>
>> Could not load program gawk:
>>         Dependent module
>> /home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8) could not be
>> loaded.
>>         Member libintl.so.8 is not found in archive
>>
>> I'll try to see why intl/ didn't cause the same issue soon.
>>
>> Thanks, have a lovely evening.
>>
>
> The previous version of "intl" was built as a static library.  Configure in
> the older package had the option --enable-host-shared,
> which I did not use.  Based on the failure message, the in-tree gettext
> seems to be built as a shared library.  If you explicitly
> pass --disable-shared to the in-tree configure, you may get farther.  I'm
> currently using --disable-shared --disable-threads.
> As we have discussed, the current gettext will retain some references to
> pthreads despite the configure option.

Sure, but my patch does insert --disable-shared:

--8<---------------cut here---------------start------------->8---
host_modules= { module= gettext; bootstrap=true; no_install=true;
                module_srcdir= "gettext/gettext-runtime";
		// We always build gettext with pic, because some packages (e.g. gdbserver)
		// need it in some configuratons, which is determined via nontrivial tests.
		// Always enabling pic seems to make sense for something tied to
		// user-facing output.
                extra_configure_flags='--disable-shared --disable-java --disable-csharp --with-pic';
                lib_path=intl/.libs; };
--8<---------------cut here---------------end--------------->8---

... and it is applied:

--8<---------------cut here---------------start------------->8---
-bash-5.1$ ./config.status --config
--srcdir=../../gcc/gettext/gettext-runtime --cache-file=./config.cache
  --disable-werror --with-gmp=/opt/cfarm
  --with-libiconv-prefix=/opt/cfarm --disable-libstdcxx-pch
  --with-included-gettext --program-transform-name=s,y,y,
  --disable-option-checking --build=powerpc-ibm-aix7.3.1.0
  --host=powerpc-ibm-aix7.3.1.0 --target=powerpc-ibm-aix7.3.1.0
  --disable-intermodule --enable-checking=yes,types,extra
  --disable-coverage --enable-languages=c,c++
  --disable-build-format-warnings --disable-shared --disable-java
  --disable-csharp --with-pic build_alias=powerpc-ibm-aix7.3.1.0
  host_alias=powerpc-ibm-aix7.3.1.0 target_alias=powerpc-ibm-aix7.3.1.0
  CC=gcc CFLAGS=-g 'LDFLAGS=-static-libstdc++ -static-libgcc
  -Wl,-bbigtoc' 'CXX=g++ -std=c++11' CXXFLAGS=-g
--8<---------------cut here---------------end--------------->8---

I'm unsure how to tell what the produced binaries are w.r.t static or
shared, but I only see .o files inside intl/.libs/libintl.a, while I see
a .so.1 in (e.g.) /lib/libz.a, hinting at it not being shared (?)

I do see that the build system adds intl to the LD_LIBRARY_PATH.

I will be testing dropping lib_path from the module definition above.
It might be superflous (I think it is only used for LD_LIBRARY_PATH, for
when the libs built by the build system are shared - which they never
are for in-tree gettext).  I'll take the shot to add --disable-threads,
too, for this test.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: drop gettext lib_path --]
[-- Type: text/x-patch, Size: 6259 bytes --]

From 4b75355d5ee9162a922a85517ef3c0a16931544d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= <arsen@aarsen.me>
Date: Thu, 16 Nov 2023 23:50:30 +0100
Subject: [PATCH] disable threads, lib_path on gettext

---
 Makefile.def |  3 +--
 Makefile.in  | 27 +++++++++++----------------
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/Makefile.def b/Makefile.def
index 792f81447e1b..78414b4cd89c 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -80,8 +80,7 @@ host_modules= { module= gettext; bootstrap=true; no_install=true;
 		// need it in some configuratons, which is determined via nontrivial tests.
 		// Always enabling pic seems to make sense for something tied to
 		// user-facing output.
-                extra_configure_flags='--disable-shared --disable-java --disable-csharp --with-pic';
-                lib_path=intl/.libs; };
+                extra_configure_flags='--disable-shared --disable-threads --disable-java --disable-csharp --with-pic'; };
 host_modules= { module= tcl;
                 missing=mostlyclean; };
 host_modules= { module= itcl; };
diff --git a/Makefile.in b/Makefile.in
index b65ab4953bce..796717665eb7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -768,7 +768,7 @@ TARGET_LIB_PATH_libatomic = $$r/$(TARGET_SUBDIR)/libatomic/.libs:
 
 # This is the list of directories that may be needed in RPATH_ENVVAR
 # so that programs built for the host machine work.
-HOST_LIB_PATH = $(HOST_LIB_PATH_gmp)$(HOST_LIB_PATH_mpfr)$(HOST_LIB_PATH_mpc)$(HOST_LIB_PATH_isl)$(HOST_LIB_PATH_gettext)
+HOST_LIB_PATH = $(HOST_LIB_PATH_gmp)$(HOST_LIB_PATH_mpfr)$(HOST_LIB_PATH_mpc)$(HOST_LIB_PATH_isl)
 
 # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
 @if gcc
@@ -796,11 +796,6 @@ HOST_LIB_PATH_isl = \
   $$r/$(HOST_SUBDIR)/isl/.libs:$$r/$(HOST_SUBDIR)/prev-isl/.libs:
 @endif isl
 
-@if gettext
-HOST_LIB_PATH_gettext = \
-  $$r/$(HOST_SUBDIR)/gettext/intl/.libs:$$r/$(HOST_SUBDIR)/prev-gettext/intl/.libs:
-@endif gettext
-
 
 CXX_FOR_TARGET_FLAG_TO_PASS = \
 	"CXX_FOR_TARGET=$(CXX_FOR_TARGET)"
@@ -19827,7 +19822,7 @@ configure-gettext:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=${target_alias} --disable-shared --disable-java --disable-csharp --with-pic \
+	  --target=${target_alias} --disable-shared --disable-threads --disable-java --disable-csharp --with-pic \
 	  || exit 1
 @endif gettext
 
@@ -19863,7 +19858,7 @@ configure-stage1-gettext:
 	  --target=${target_alias} \
 	   \
 	  $(STAGE1_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic
 @endif gettext-bootstrap
 
 .PHONY: configure-stage2-gettext maybe-configure-stage2-gettext
@@ -19897,7 +19892,7 @@ configure-stage2-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGE2_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic
 @endif gettext-bootstrap
 
 .PHONY: configure-stage3-gettext maybe-configure-stage3-gettext
@@ -19931,7 +19926,7 @@ configure-stage3-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGE3_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic
 @endif gettext-bootstrap
 
 .PHONY: configure-stage4-gettext maybe-configure-stage4-gettext
@@ -19965,7 +19960,7 @@ configure-stage4-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGE4_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic
 @endif gettext-bootstrap
 
 .PHONY: configure-stageprofile-gettext maybe-configure-stageprofile-gettext
@@ -19999,7 +19994,7 @@ configure-stageprofile-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGEprofile_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic
 @endif gettext-bootstrap
 
 .PHONY: configure-stagetrain-gettext maybe-configure-stagetrain-gettext
@@ -20033,7 +20028,7 @@ configure-stagetrain-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGEtrain_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic
 @endif gettext-bootstrap
 
 .PHONY: configure-stagefeedback-gettext maybe-configure-stagefeedback-gettext
@@ -20067,7 +20062,7 @@ configure-stagefeedback-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGEfeedback_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic
 @endif gettext-bootstrap
 
 .PHONY: configure-stageautoprofile-gettext maybe-configure-stageautoprofile-gettext
@@ -20101,7 +20096,7 @@ configure-stageautoprofile-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGEautoprofile_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic
 @endif gettext-bootstrap
 
 .PHONY: configure-stageautofeedback-gettext maybe-configure-stageautofeedback-gettext
@@ -20135,7 +20130,7 @@ configure-stageautofeedback-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGEautofeedback_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic
 @endif gettext-bootstrap
 
 
-- 
2.42.1


[-- Attachment #1.3: Type: text/plain, Size: 4551 bytes --]


> Thanks, David
>
>
>>
>> > Thanks, David
>> >
>> >
>> >
>> > On Thu, Nov 16, 2023 at 4:15 PM Arsen Arsenović <arsen@aarsen.me> wrote:
>> >
>> >>
>> >> Arsen Arsenović <arsen@aarsen.me> writes:
>> >>
>> >> > [[PGP Signed Part:Good signature from 52C294301EA2C493 Arsen Arsenović
>> >> (Gentoo Developer UID) <arsen@gentoo.org> (trust ultimate) created at
>> >> 2023-11-16T19:47:16+0100 using EDDSA]]
>> >> >
>> >> > David Edelsohn <dje.gcc@gmail.com> writes:
>> >> >
>> >> >> On Wed, Nov 15, 2023 at 9:22 AM Arsen Arsenović <arsen@aarsen.me>
>> >> wrote:
>> >> >>
>> >> >>>
>> >> >>> David Edelsohn <dje.gcc@gmail.com> writes:
>> >> >>>
>> >> >>> > GCC had been working on AIX with NLS, using
>> >> "--with-included-gettext".
>> >> >>> > --disable-nls gets past the breakage, but GCC does not build for
>> me
>> >> on
>> >> >>> AIX
>> >> >>> > with NLS enabled.
>> >> >>>
>> >> >>> That should still work with gettext 0.22+ extracted in-tree (it
>> should
>> >> >>> be fetched by download_prerequisites).
>> >> >>>
>> >> >>> > A change in dependencies for GCC should have been announced and
>> more
>> >> >>> widely
>> >> >>> > socialized in the GCC development mailing list, not just GCC
>> patches
>> >> >>> > mailing list.
>> >> >>> >
>> >> >>> > I have tried both the AIX Open Source libiconv and libgettext
>> >> package,
>> >> >>> and
>> >> >>> > the ones that I previously built.  Both fail because GCC configure
>> >> >>> decides
>> >> >>> > to disable NLS, despite being requested, while libcpp is
>> satisfied,
>> >> so
>> >> >>> > tools in the gcc subdirectory don't link against libiconv and the
>> >> build
>> >> >>> > fails.  With the included gettext, I was able to rely on a
>> >> >>> self-consistent
>> >> >>> > solution.
>> >> >>>
>> >> >>> That is interesting.  They should be using the same checks.  I've
>> >> >>> checked trunk and regenerated files on it, and saw no significant
>> diff
>> >> >>> (some whitespace changes only).  Could you post the config.log of
>> both?
>> >> >>>
>> >> >>> I've never used AIX.  Can I reproduce this on one of the cfarm
>> machines
>> >> >>> to poke around?  I've tried cfarm119, but that one lacked git, and I
>> >> >>> haven't poked around much further due to time constraints.
>> >> >>>
>> >> >>
>> >> >> The AIX system in the Compile Farm has a complete complement of Open
>> >> Source
>> >> >> software installed.
>> >> >>
>> >> >> Please ensure that /opt/freeware/bin is in your path.  Also, the GCC
>> >> Wiki
>> >> >> Compile Farm page has build tips that include AIX
>> >> >>
>> >> >>
>> >>
>> https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
>> >> >
>> >> > Thanks, that got me further.
>> >> >
>> >> >> that recommended --with-included-gettext configuration option.
>> >> >
>> >> > This flag should still exist and operate the same if gettext is
>> present
>> >> > in tree.  I've cloned gcc and downloaded prerequisites (via
>> >> > contrib/download_prerequisites) and I am trying to configure it now.
>> >>
>> >> The build failed.  After gettext/gmp/... (in-tree hostlibs) get built
>> >> and added to library paths, further GCC processes fail to run:
>> >>
>> >> configure:3305: gcc -g  -static-libstdc++ -static-libgcc -Wl,-bbigtoc
>> >> conftest.c  >&5
>> >> Could not load program
>> >> /opt/freeware/libexec/gcc/powerpc-ibm-aix7.3.0.0/10/cc1:
>> >>         Dependent module
>> >> /home/arsen/build/./gmp/.libs/libgmp.a(libgmp.so.10) could not be
>> loaded.
>> >>         Member libgmp.so.10 is not found in archive
>> >>
>> >> This seems odd.  I am not sure what compels the RTDL (?) to look up .sos
>> >> in archives, or how it knows about these archives..  I suspect it's
>> >> getting tripped by something in HOST_EXPORTS.
>> >>
>> >> >> Thanks, David
>> >> >>
>> >> >>
>> >> >>>
>> >> >>> TIA, sorry about the inconvenience.  Have a lovely day.
>> >> >>>
>> >> >>> > The current gettext-0.22.3 fails to build for me on AIX.
>> >> >>> >
>> >> >>> > libcpp configure believes that NLS functions on AIX, but gcc
>> >> configure
>> >> >>> > fails in its tests of gettext functionality, which leads to an
>> >> >>> inconsistent
>> >> >>> > configuration and build breakage.
>> >> >>> >
>> >> >>> > Thanks, David
>> >> >>>
>> >> >>>
>> >> >>> --
>> >> >>> Arsen Arsenović
>> >> >>>
>> >>
>> >>
>> >> --
>> >> Arsen Arsenović
>> >>
>>
>>
>> --
>> Arsen Arsenović
>>


-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: building GNU gettext on AIX
  2023-11-16 22:18                         ` David Edelsohn
@ 2023-11-16 22:46                           ` Bruno Haible
  2023-11-16 23:10                             ` Arsen Arsenović
  2023-11-16 23:38                             ` David Edelsohn
  0 siblings, 2 replies; 60+ messages in thread
From: Bruno Haible @ 2023-11-16 22:46 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Arsen Arsenović, GCC Patches, bug-gettext

Hi David,

> the default, distributed libintl library will not allow GCC to be built
> with NLS enabled.

The problem is this configure test from gettext.m4

  checking for GNU gettext in libintl... no

It should say

  checking for GNU gettext in libintl... yes

I reproduce it with simple hello-world package, outside GCC.

It tests whether a program that uses gettext() can be linked with
  -lintl -liconv
But now, on AIX, it needs to test whether such a program can be linked with
  -lintl -liconv -lpthread

> Were you suggesting that --enable-threads=isoc would work now or that it
> would require further changes for a future release?

It requires a change, effectively to do as if HAVE_PTHREAD_API is undefined
if --enable-threads=isoc was provided.

I can prepare a new gettext release that has both issues fixed:
  - gettext.m4 that fixes the configure test and sets the variable LIBINTL
    to "-Lsome/libdir -lintl -liconv -lpthread",
  - mbrtowc.o and setlocale*.o that use mtx_* locks instead of pthread_*
    mutexes when requested.

But you then need to make up your mind w.r.t. what I wrote in the earlier
mail.

  * GCC can pass --enable-threads=isoc, to avoid the libpthread dependency
    on AIX ≥ 7.2.

  * Or GCC can (continue to?) use the variable LIBINTL. This will work on
    AIX 7.1 as well but the programs will then be linked against libpthread.
    One additional library.
    $ ldd gcc
    /opt/freeware/bin/gcc needs:
         /usr/lib/libc.a(shr.o)
         /opt/freeware/lib/libiconv.a(libiconv.so.2)
         /usr/lib/libc.a(_shr.o)
         /unix
         /usr/lib/libcrypt.a(shr.o)
         /opt/freeware/lib/libgcc_s.a(shr.o)
    libpthread.a will be added to this list.

    ibm-clang links against libpthread.a as well:
    $ ldd /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig
    /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig needs:
         /usr/lib/libpthreads.a(shr_xpg5_64.o)
         /usr/opt/zlibNX/lib/libz.a(libz.so.1)
         /usr/lib/libcurses.a(shr42_64.o)
         /usr/lib/libiconv.a(shr4_64.o)
         /usr/lib/libc++.a(shr_64.o)
         /usr/lib/libc++abi.a(libc++abi.so.1)
         /usr/lib/libc.a(shr_64.o)
         /usr/lib/libpthreads.a(_shr_xpg5_64.o)
         /usr/lib/libc++.a(libc++.so.1)
         /usr/lib/libunwind.a(libunwind.so.1)
         /usr/lib/libc.a(_shr_64.o)
         /unix
         /usr/lib/libcrypt.a(shr_64.o)

Bruno




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

* Re: building GNU gettext on AIX
  2023-11-16 22:46                           ` Bruno Haible
@ 2023-11-16 23:10                             ` Arsen Arsenović
  2023-11-17  8:33                               ` Richard Biener
  2023-11-16 23:38                             ` David Edelsohn
  1 sibling, 1 reply; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-16 23:10 UTC (permalink / raw)
  To: Bruno Haible; +Cc: David Edelsohn, GCC Patches, bug-gettext

[-- Attachment #1: Type: text/plain, Size: 3100 bytes --]


Bruno Haible <bruno@clisp.org> writes:

> Hi David,
>
>> the default, distributed libintl library will not allow GCC to be built
>> with NLS enabled.
>
> The problem is this configure test from gettext.m4
>
>   checking for GNU gettext in libintl... no
>
> It should say
>
>   checking for GNU gettext in libintl... yes
>
> I reproduce it with simple hello-world package, outside GCC.
>
> It tests whether a program that uses gettext() can be linked with
>   -lintl -liconv
> But now, on AIX, it needs to test whether such a program can be linked with
>   -lintl -liconv -lpthread
>
>> Were you suggesting that --enable-threads=isoc would work now or that it
>> would require further changes for a future release?
>
> It requires a change, effectively to do as if HAVE_PTHREAD_API is undefined
> if --enable-threads=isoc was provided.
>
> I can prepare a new gettext release that has both issues fixed:
>   - gettext.m4 that fixes the configure test and sets the variable LIBINTL
>     to "-Lsome/libdir -lintl -liconv -lpthread",
>   - mbrtowc.o and setlocale*.o that use mtx_* locks instead of pthread_*
>     mutexes when requested.
>
> But you then need to make up your mind w.r.t. what I wrote in the earlier
> mail.
>
>   * GCC can pass --enable-threads=isoc, to avoid the libpthread dependency
>     on AIX ≥ 7.2.

Hmm, would that option work everywhere, though?  Or would we have to
wire up configury to detect which flag to use?  If so, what would it
look like.

>   * Or GCC can (continue to?) use the variable LIBINTL. This will work on

If you mean the one generated by gettext.m4/uninstalled-config.sh, it is
utilized today:

LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) \
	$(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS)

(from gcc/Makefile.in)


>     AIX 7.1 as well but the programs will then be linked against libpthread.
>     One additional library.
>     $ ldd gcc
>     /opt/freeware/bin/gcc needs:
>          /usr/lib/libc.a(shr.o)
>          /opt/freeware/lib/libiconv.a(libiconv.so.2)
>          /usr/lib/libc.a(_shr.o)
>          /unix
>          /usr/lib/libcrypt.a(shr.o)
>          /opt/freeware/lib/libgcc_s.a(shr.o)
>     libpthread.a will be added to this list.
>
>     ibm-clang links against libpthread.a as well:
>     $ ldd /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig
>     /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig needs:
>          /usr/lib/libpthreads.a(shr_xpg5_64.o)
>          /usr/opt/zlibNX/lib/libz.a(libz.so.1)
>          /usr/lib/libcurses.a(shr42_64.o)
>          /usr/lib/libiconv.a(shr4_64.o)
>          /usr/lib/libc++.a(shr_64.o)
>          /usr/lib/libc++abi.a(libc++abi.so.1)
>          /usr/lib/libc.a(shr_64.o)
>          /usr/lib/libpthreads.a(_shr_xpg5_64.o)
>          /usr/lib/libc++.a(libc++.so.1)
>          /usr/lib/libunwind.a(libunwind.so.1)
>          /usr/lib/libc.a(_shr_64.o)
>          /unix
>          /usr/lib/libcrypt.a(shr_64.o)

David, I'll leave that decision up to you.

> Bruno


-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: building GNU gettext on AIX
  2023-11-16 22:46                           ` Bruno Haible
  2023-11-16 23:10                             ` Arsen Arsenović
@ 2023-11-16 23:38                             ` David Edelsohn
  2023-11-17  0:07                               ` Bruno Haible
  1 sibling, 1 reply; 60+ messages in thread
From: David Edelsohn @ 2023-11-16 23:38 UTC (permalink / raw)
  To: Bruno Haible; +Cc: Arsen Arsenović, GCC Patches, bug-gettext

[-- Attachment #1: Type: text/plain, Size: 3388 bytes --]

On Thu, Nov 16, 2023 at 5:47 PM Bruno Haible <bruno@clisp.org> wrote:

> Hi David,
>
> > the default, distributed libintl library will not allow GCC to be built
> > with NLS enabled.
>
> The problem is this configure test from gettext.m4
>
>   checking for GNU gettext in libintl... no
>
> It should say
>
>   checking for GNU gettext in libintl... yes
>
> I reproduce it with simple hello-world package, outside GCC.
>
> It tests whether a program that uses gettext() can be linked with
>   -lintl -liconv
> But now, on AIX, it needs to test whether such a program can be linked with
>   -lintl -liconv -lpthread
>
> > Were you suggesting that --enable-threads=isoc would work now or that it
> > would require further changes for a future release?
>
> It requires a change, effectively to do as if HAVE_PTHREAD_API is undefined
> if --enable-threads=isoc was provided.
>
> I can prepare a new gettext release that has both issues fixed:
>   - gettext.m4 that fixes the configure test and sets the variable LIBINTL
>     to "-Lsome/libdir -lintl -liconv -lpthread",
>   - mbrtowc.o and setlocale*.o that use mtx_* locks instead of pthread_*
>     mutexes when requested.
>
> But you then need to make up your mind w.r.t. what I wrote in the earlier
> mail.
>
>   * GCC can pass --enable-threads=isoc, to avoid the libpthread dependency
>     on AIX ≥ 7.2.
>

I have reached out to the AIX Open Source Tools team for their
perspective.  Normally GCC and other
FOSS packages have not based their support for OS versions on official
vendor support lifecycles,
within reason.  In fact, many users have appreciated longer duration
support.


>
>   * Or GCC can (continue to?) use the variable LIBINTL. This will work on
>     AIX 7.1 as well but the programs will then be linked against
> libpthread.
>     One additional library.
>     $ ldd gcc
>     /opt/freeware/bin/gcc needs:
>          /usr/lib/libc.a(shr.o)
>          /opt/freeware/lib/libiconv.a(libiconv.so.2)
>          /usr/lib/libc.a(_shr.o)
>          /unix
>          /usr/lib/libcrypt.a(shr.o)
>          /opt/freeware/lib/libgcc_s.a(shr.o)
>     libpthread.a will be added to this list.
>

My builds of GCC only rely on AIX libc.  All other libraries are statically
linked.


>
>     ibm-clang links against libpthread.a as well:
>     $ ldd /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig
>     /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig needs:
>          /usr/lib/libpthreads.a(shr_xpg5_64.o)
>          /usr/opt/zlibNX/lib/libz.a(libz.so.1)
>          /usr/lib/libcurses.a(shr42_64.o)
>          /usr/lib/libiconv.a(shr4_64.o)
>          /usr/lib/libc++.a(shr_64.o)
>          /usr/lib/libc++abi.a(libc++abi.so.1)
>          /usr/lib/libc.a(shr_64.o)
>          /usr/lib/libpthreads.a(_shr_xpg5_64.o)
>          /usr/lib/libc++.a(libc++.so.1)
>          /usr/lib/libunwind.a(libunwind.so.1)
>          /usr/lib/libc.a(_shr_64.o)
>          /unix
>          /usr/lib/libcrypt.a(shr_64.o)
>

I have asked the IBM Clang team why ibm-clang depends on libpthreads.

One option is to add -lpthreads to the link line, even if the tools are not
built
thread-safe.  Only the intl support would invoke the extraneous overhead.
The downside is that other pthreads dependencies could sneak in.

Thanks, David


>
> Bruno
>
>
>
>

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-16 22:32                   ` Arsen Arsenović
@ 2023-11-16 23:59                     ` David Edelsohn
  2023-11-17  8:34                       ` Arsen Arsenović
  0 siblings, 1 reply; 60+ messages in thread
From: David Edelsohn @ 2023-11-16 23:59 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: Richard Biener, Bruno Haible, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 10361 bytes --]

On Thu, Nov 16, 2023 at 5:52 PM Arsen Arsenović <arsen@aarsen.me> wrote:

>
> David Edelsohn <dje.gcc@gmail.com> writes:
>
> > On Thu, Nov 16, 2023 at 5:22 PM Arsen Arsenović <arsen@aarsen.me> wrote:
> >
> >>
> >> David Edelsohn <dje.gcc@gmail.com> writes:
> >>
> >> > Don't build with the dependent libraries in tree.  Don't build the
> >> > dependent libraries as shared libraries. The libraries are already
> built
> >> > and in /opt/cfarm, as mentioned in the Compile Farm wiki.
> >> >
> >> > AIX is not Solaris and not Linux.  It doesn't use ELF.  AIX shared
> >> > libraries *ARE* shared object files in archives.  Shared object
> >> versioning
> >> > is handled by multiple objects in the same archive.
> >>
> >> Hmm, I see.  I removed all the deps but gettext from the tree.
> >>
> >> This leaves gettext-runtime fulfilling the previous role of intl/.
> >>
> >> However, I'm confused about how this worked before, in that case, since,
> >> IIRC, intl also produced libraries and was also put into host exports.
> >>
> >> Leaving gettext in tree produces:
> >>
> >> Could not load program gawk:
> >>         Dependent module
> >> /home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8) could
> not be
> >> loaded.
> >>         Member libintl.so.8 is not found in archive
> >>
> >> I'll try to see why intl/ didn't cause the same issue soon.
> >>
> >> Thanks, have a lovely evening.
> >>
> >
> > The previous version of "intl" was built as a static library.  Configure
> in
> > the older package had the option --enable-host-shared,
> > which I did not use.  Based on the failure message, the in-tree gettext
> > seems to be built as a shared library.  If you explicitly
> > pass --disable-shared to the in-tree configure, you may get farther.  I'm
> > currently using --disable-shared --disable-threads.
> > As we have discussed, the current gettext will retain some references to
> > pthreads despite the configure option.
>
> Sure, but my patch does insert --disable-shared:
>
> --8<---------------cut here---------------start------------->8---
> host_modules= { module= gettext; bootstrap=true; no_install=true;
>                 module_srcdir= "gettext/gettext-runtime";
>                 // We always build gettext with pic, because some packages
> (e.g. gdbserver)
>                 // need it in some configuratons, which is determined via
> nontrivial tests.
>                 // Always enabling pic seems to make sense for something
> tied to
>                 // user-facing output.
>                 extra_configure_flags='--disable-shared --disable-java
> --disable-csharp --with-pic';
>                 lib_path=intl/.libs; };
> --8<---------------cut here---------------end--------------->8---
>
> ... and it is applied:
>
> --8<---------------cut here---------------start------------->8---
> -bash-5.1$ ./config.status --config
> --srcdir=../../gcc/gettext/gettext-runtime --cache-file=./config.cache
>   --disable-werror --with-gmp=/opt/cfarm
>   --with-libiconv-prefix=/opt/cfarm --disable-libstdcxx-pch
>   --with-included-gettext --program-transform-name=s,y,y,
>   --disable-option-checking --build=powerpc-ibm-aix7.3.1.0
>   --host=powerpc-ibm-aix7.3.1.0 --target=powerpc-ibm-aix7.3.1.0
>   --disable-intermodule --enable-checking=yes,types,extra
>   --disable-coverage --enable-languages=c,c++
>   --disable-build-format-warnings --disable-shared --disable-java
>   --disable-csharp --with-pic build_alias=powerpc-ibm-aix7.3.1.0
>   host_alias=powerpc-ibm-aix7.3.1.0 target_alias=powerpc-ibm-aix7.3.1.0
>   CC=gcc CFLAGS=-g 'LDFLAGS=-static-libstdc++ -static-libgcc
>   -Wl,-bbigtoc' 'CXX=g++ -std=c++11' CXXFLAGS=-g
> --8<---------------cut here---------------end--------------->8---
>
> I'm unsure how to tell what the produced binaries are w.r.t static or
> shared, but I only see .o files inside intl/.libs/libintl.a, while I see
> a .so.1 in (e.g.) /lib/libz.a, hinting at it not being shared (?)
>

An AIX shared library created by libtool will look like
libfoo.a[libfoo.so.N], where N is the package major version number.
Normally with one file.

An AIX static library will look like libfoo.a[a.o, b.o, c.o]
with multiple object files.

An AIX archive can contain a combination of shared objects and
normal object files.

AIX normally uses the convention shr.o or shr_64.o for the name
of the shared object file.  Hint, hint, an AIX archive can contain
both 32 bit and 64 bit object files or shared objects.

I don't know why the gettext build system would create
/home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8)
if --disable-shared was requested.  That clearly is using the
naming of a libtool AIX shared object and failing due to
the missing shared object.  Although in this case, the problem
seems to be the shared library load path.  AIX uses LIBPATH,
not LD_LIBRARY_PATH.

Also, for me, the out of tree path was

gettext/gettext-runtime/intl/.libs

Is your search path missing a level?

Thanks, David


>
> I do see that the build system adds intl to the LD_LIBRARY_PATH.
>
> I will be testing dropping lib_path from the module definition above.
> It might be superflous (I think it is only used for LD_LIBRARY_PATH, for
> when the libs built by the build system are shared - which they never
> are for in-tree gettext).  I'll take the shot to add --disable-threads,
> too, for this test.
>
>
> > Thanks, David
> >
> >
> >>
> >> > Thanks, David
> >> >
> >> >
> >> >
> >> > On Thu, Nov 16, 2023 at 4:15 PM Arsen Arsenović <arsen@aarsen.me>
> wrote:
> >> >
> >> >>
> >> >> Arsen Arsenović <arsen@aarsen.me> writes:
> >> >>
> >> >> > [[PGP Signed Part:Good signature from 52C294301EA2C493 Arsen
> Arsenović
> >> >> (Gentoo Developer UID) <arsen@gentoo.org> (trust ultimate) created
> at
> >> >> 2023-11-16T19:47:16+0100 using EDDSA]]
> >> >> >
> >> >> > David Edelsohn <dje.gcc@gmail.com> writes:
> >> >> >
> >> >> >> On Wed, Nov 15, 2023 at 9:22 AM Arsen Arsenović <arsen@aarsen.me>
> >> >> wrote:
> >> >> >>
> >> >> >>>
> >> >> >>> David Edelsohn <dje.gcc@gmail.com> writes:
> >> >> >>>
> >> >> >>> > GCC had been working on AIX with NLS, using
> >> >> "--with-included-gettext".
> >> >> >>> > --disable-nls gets past the breakage, but GCC does not build
> for
> >> me
> >> >> on
> >> >> >>> AIX
> >> >> >>> > with NLS enabled.
> >> >> >>>
> >> >> >>> That should still work with gettext 0.22+ extracted in-tree (it
> >> should
> >> >> >>> be fetched by download_prerequisites).
> >> >> >>>
> >> >> >>> > A change in dependencies for GCC should have been announced and
> >> more
> >> >> >>> widely
> >> >> >>> > socialized in the GCC development mailing list, not just GCC
> >> patches
> >> >> >>> > mailing list.
> >> >> >>> >
> >> >> >>> > I have tried both the AIX Open Source libiconv and libgettext
> >> >> package,
> >> >> >>> and
> >> >> >>> > the ones that I previously built.  Both fail because GCC
> configure
> >> >> >>> decides
> >> >> >>> > to disable NLS, despite being requested, while libcpp is
> >> satisfied,
> >> >> so
> >> >> >>> > tools in the gcc subdirectory don't link against libiconv and
> the
> >> >> build
> >> >> >>> > fails.  With the included gettext, I was able to rely on a
> >> >> >>> self-consistent
> >> >> >>> > solution.
> >> >> >>>
> >> >> >>> That is interesting.  They should be using the same checks.  I've
> >> >> >>> checked trunk and regenerated files on it, and saw no significant
> >> diff
> >> >> >>> (some whitespace changes only).  Could you post the config.log of
> >> both?
> >> >> >>>
> >> >> >>> I've never used AIX.  Can I reproduce this on one of the cfarm
> >> machines
> >> >> >>> to poke around?  I've tried cfarm119, but that one lacked git,
> and I
> >> >> >>> haven't poked around much further due to time constraints.
> >> >> >>>
> >> >> >>
> >> >> >> The AIX system in the Compile Farm has a complete complement of
> Open
> >> >> Source
> >> >> >> software installed.
> >> >> >>
> >> >> >> Please ensure that /opt/freeware/bin is in your path.  Also, the
> GCC
> >> >> Wiki
> >> >> >> Compile Farm page has build tips that include AIX
> >> >> >>
> >> >> >>
> >> >>
> >>
> https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
> >> >> >
> >> >> > Thanks, that got me further.
> >> >> >
> >> >> >> that recommended --with-included-gettext configuration option.
> >> >> >
> >> >> > This flag should still exist and operate the same if gettext is
> >> present
> >> >> > in tree.  I've cloned gcc and downloaded prerequisites (via
> >> >> > contrib/download_prerequisites) and I am trying to configure it
> now.
> >> >>
> >> >> The build failed.  After gettext/gmp/... (in-tree hostlibs) get built
> >> >> and added to library paths, further GCC processes fail to run:
> >> >>
> >> >> configure:3305: gcc -g  -static-libstdc++ -static-libgcc -Wl,-bbigtoc
> >> >> conftest.c  >&5
> >> >> Could not load program
> >> >> /opt/freeware/libexec/gcc/powerpc-ibm-aix7.3.0.0/10/cc1:
> >> >>         Dependent module
> >> >> /home/arsen/build/./gmp/.libs/libgmp.a(libgmp.so.10) could not be
> >> loaded.
> >> >>         Member libgmp.so.10 is not found in archive
> >> >>
> >> >> This seems odd.  I am not sure what compels the RTDL (?) to look up
> .sos
> >> >> in archives, or how it knows about these archives..  I suspect it's
> >> >> getting tripped by something in HOST_EXPORTS.
> >> >>
> >> >> >> Thanks, David
> >> >> >>
> >> >> >>
> >> >> >>>
> >> >> >>> TIA, sorry about the inconvenience.  Have a lovely day.
> >> >> >>>
> >> >> >>> > The current gettext-0.22.3 fails to build for me on AIX.
> >> >> >>> >
> >> >> >>> > libcpp configure believes that NLS functions on AIX, but gcc
> >> >> configure
> >> >> >>> > fails in its tests of gettext functionality, which leads to an
> >> >> >>> inconsistent
> >> >> >>> > configuration and build breakage.
> >> >> >>> >
> >> >> >>> > Thanks, David
> >> >> >>>
> >> >> >>>
> >> >> >>> --
> >> >> >>> Arsen Arsenović
> >> >> >>>
> >> >>
> >> >>
> >> >> --
> >> >> Arsen Arsenović
> >> >>
> >>
> >>
> >> --
> >> Arsen Arsenović
> >>
>
>
> --
> Arsen Arsenović
>

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

* Re: building GNU gettext on AIX
  2023-11-16 23:38                             ` David Edelsohn
@ 2023-11-17  0:07                               ` Bruno Haible
  2023-11-17  0:15                                 ` David Edelsohn
  0 siblings, 1 reply; 60+ messages in thread
From: Bruno Haible @ 2023-11-17  0:07 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Arsen Arsenović, GCC Patches, bug-gettext

David Edelsohn wrote:
> >     ibm-clang links against libpthread.a as well:
> >     $ ldd /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig
> >     /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig needs:
> >          /usr/lib/libpthreads.a(shr_xpg5_64.o)
> >          /usr/opt/zlibNX/lib/libz.a(libz.so.1)
> >          /usr/lib/libcurses.a(shr42_64.o)
> >          /usr/lib/libiconv.a(shr4_64.o)
> >          /usr/lib/libc++.a(shr_64.o)
> >          /usr/lib/libc++abi.a(libc++abi.so.1)
> >          /usr/lib/libc.a(shr_64.o)
> >          /usr/lib/libpthreads.a(_shr_xpg5_64.o)
> >          /usr/lib/libc++.a(libc++.so.1)
> >          /usr/lib/libunwind.a(libunwind.so.1)
> >          /usr/lib/libc.a(_shr_64.o)
> >          /unix
> >          /usr/lib/libcrypt.a(shr_64.o)
> >
> 
> I have asked the IBM Clang team why ibm-clang depends on libpthreads.

The reason is that
  - For a library, it is a normal expectation nowadays that it is
    multithread-safe.
  - Making a library multithread-safe (without major hacks) means to do
    locking or to call pthread_once / call_once in some places.
  - The ISO C 11 threading functions in libc have some drawbacks compared
    to the pthread functions. [1] So most developer prefer to rely on the
    POSIX threads API.
  - Since AIX does not have the POSIX mutex functions in libc and does not
    support weak symbols like in ELF, this means a dependency to
    pthread_mutex_lock or pthread_once.
  - Accordingly, in the list of libraries above, 3 libraries need pthread*
    symbols:

$ nm -X 64 /usr/lib/libc++abi.a | grep ' U ' | grep pthread_mutex
pthread_mutex_lock   U           -
pthread_mutex_unlock U           -
$ nm -X 64 /usr/lib/libc++.a | grep ' U ' | grep pthread_mutex
pthread_mutex_destroy U           -
pthread_mutex_init   U           -
pthread_mutex_lock   U           -
pthread_mutex_trylock U           -
pthread_mutex_unlock U           -
pthread_mutexattr_destroy U           -
pthread_mutexattr_init U           -
pthread_mutexattr_settype U           -
$ nm -X 64 /usr/opt/zlibNX/lib/libz.a | grep ' U ' | grep pthread_mutex
pthread_mutex_destroy U           -
pthread_mutex_init   U           -
pthread_mutex_lock   U           -
pthread_mutex_unlock U           -

Bruno

[1] Lock initialization is clumsy. The return value of a thread is only an
    'int', not a pointer. Etc.




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

* Re: building GNU gettext on AIX
  2023-11-17  0:07                               ` Bruno Haible
@ 2023-11-17  0:15                                 ` David Edelsohn
  0 siblings, 0 replies; 60+ messages in thread
From: David Edelsohn @ 2023-11-17  0:15 UTC (permalink / raw)
  To: Bruno Haible; +Cc: Arsen Arsenović, GCC Patches, bug-gettext

[-- Attachment #1: Type: text/plain, Size: 2748 bytes --]

On Thu, Nov 16, 2023 at 7:07 PM Bruno Haible <bruno@clisp.org> wrote:

> David Edelsohn wrote:
> > >     ibm-clang links against libpthread.a as well:
> > >     $ ldd /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig
> > >     /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig needs:
> > >          /usr/lib/libpthreads.a(shr_xpg5_64.o)
> > >          /usr/opt/zlibNX/lib/libz.a(libz.so.1)
> > >          /usr/lib/libcurses.a(shr42_64.o)
> > >          /usr/lib/libiconv.a(shr4_64.o)
> > >          /usr/lib/libc++.a(shr_64.o)
> > >          /usr/lib/libc++abi.a(libc++abi.so.1)
> > >          /usr/lib/libc.a(shr_64.o)
> > >          /usr/lib/libpthreads.a(_shr_xpg5_64.o)
> > >          /usr/lib/libc++.a(libc++.so.1)
> > >          /usr/lib/libunwind.a(libunwind.so.1)
> > >          /usr/lib/libc.a(_shr_64.o)
> > >          /unix
> > >          /usr/lib/libcrypt.a(shr_64.o)
> > >
> >
> > I have asked the IBM Clang team why ibm-clang depends on libpthreads.
>
> The reason is that
>   - For a library, it is a normal expectation nowadays that it is
>     multithread-safe.
>   - Making a library multithread-safe (without major hacks) means to do
>     locking or to call pthread_once / call_once in some places.
>   - The ISO C 11 threading functions in libc have some drawbacks compared
>     to the pthread functions. [1] So most developer prefer to rely on the
>     POSIX threads API.
>   - Since AIX does not have the POSIX mutex functions in libc and does not
>     support weak symbols like in ELF, this means a dependency to
>     pthread_mutex_lock or pthread_once.
>   - Accordingly, in the list of libraries above, 3 libraries need pthread*
>     symbols:
>
> $ nm -X 64 /usr/lib/libc++abi.a | grep ' U ' | grep pthread_mutex
> pthread_mutex_lock   U           -
> pthread_mutex_unlock U           -
> $ nm -X 64 /usr/lib/libc++.a | grep ' U ' | grep pthread_mutex
> pthread_mutex_destroy U           -
> pthread_mutex_init   U           -
> pthread_mutex_lock   U           -
> pthread_mutex_trylock U           -
> pthread_mutex_unlock U           -
> pthread_mutexattr_destroy U           -
> pthread_mutexattr_init U           -
> pthread_mutexattr_settype U           -
> $ nm -X 64 /usr/opt/zlibNX/lib/libz.a | grep ' U ' | grep pthread_mutex
> pthread_mutex_destroy U           -
> pthread_mutex_init   U           -
> pthread_mutex_lock   U           -
> pthread_mutex_unlock U           -
>

There are ibm_clang and ibm_clang_r (previous xlc and xlc_r) to compile
with and without thread safe.   If IBM Clang team
chose to only provide a thread safe version of libc++, okay, but that
doesn't seem like a fundamental requirement.
zlibNX is another can of worms.

David

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

* Re: building GNU gettext on AIX
  2023-11-16 23:10                             ` Arsen Arsenović
@ 2023-11-17  8:33                               ` Richard Biener
  2023-11-17  8:49                                 ` Arsen Arsenović
  2023-11-17 12:24                                 ` Bruno Haible
  0 siblings, 2 replies; 60+ messages in thread
From: Richard Biener @ 2023-11-17  8:33 UTC (permalink / raw)
  To: Arsen Arsenović
  Cc: Bruno Haible, David Edelsohn, GCC Patches, bug-gettext

On Fri, Nov 17, 2023 at 12:13 AM Arsen Arsenović <arsen@aarsen.me> wrote:
>
>
> Bruno Haible <bruno@clisp.org> writes:
>
> > Hi David,
> >
> >> the default, distributed libintl library will not allow GCC to be built
> >> with NLS enabled.
> >
> > The problem is this configure test from gettext.m4
> >
> >   checking for GNU gettext in libintl... no
> >
> > It should say
> >
> >   checking for GNU gettext in libintl... yes
> >
> > I reproduce it with simple hello-world package, outside GCC.
> >
> > It tests whether a program that uses gettext() can be linked with
> >   -lintl -liconv
> > But now, on AIX, it needs to test whether such a program can be linked with
> >   -lintl -liconv -lpthread
> >
> >> Were you suggesting that --enable-threads=isoc would work now or that it
> >> would require further changes for a future release?
> >
> > It requires a change, effectively to do as if HAVE_PTHREAD_API is undefined
> > if --enable-threads=isoc was provided.
> >
> > I can prepare a new gettext release that has both issues fixed:
> >   - gettext.m4 that fixes the configure test and sets the variable LIBINTL
> >     to "-Lsome/libdir -lintl -liconv -lpthread",
> >   - mbrtowc.o and setlocale*.o that use mtx_* locks instead of pthread_*
> >     mutexes when requested.
> >
> > But you then need to make up your mind w.r.t. what I wrote in the earlier
> > mail.
> >
> >   * GCC can pass --enable-threads=isoc, to avoid the libpthread dependency
> >     on AIX ≥ 7.2.
>
> Hmm, would that option work everywhere, though?  Or would we have to
> wire up configury to detect which flag to use?  If so, what would it
> look like.

I'd highly recommend the in-tree gettext to be built with thread
support _disabled_,
only a static library built and never installed (but linked statically
into the host
binaries).

So if --disable-threads (or how it is called) does not work you need
to fix _that_.
Likewise if --disable-shared doesn't work correctly on all platforms
you have to fix
that as well.

Richard.

>
> >   * Or GCC can (continue to?) use the variable LIBINTL. This will work on
>
> If you mean the one generated by gettext.m4/uninstalled-config.sh, it is
> utilized today:
>
> LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) \
>         $(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS)
>
> (from gcc/Makefile.in)
>
>
> >     AIX 7.1 as well but the programs will then be linked against libpthread.
> >     One additional library.
> >     $ ldd gcc
> >     /opt/freeware/bin/gcc needs:
> >          /usr/lib/libc.a(shr.o)
> >          /opt/freeware/lib/libiconv.a(libiconv.so.2)
> >          /usr/lib/libc.a(_shr.o)
> >          /unix
> >          /usr/lib/libcrypt.a(shr.o)
> >          /opt/freeware/lib/libgcc_s.a(shr.o)
> >     libpthread.a will be added to this list.
> >
> >     ibm-clang links against libpthread.a as well:
> >     $ ldd /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig
> >     /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig needs:
> >          /usr/lib/libpthreads.a(shr_xpg5_64.o)
> >          /usr/opt/zlibNX/lib/libz.a(libz.so.1)
> >          /usr/lib/libcurses.a(shr42_64.o)
> >          /usr/lib/libiconv.a(shr4_64.o)
> >          /usr/lib/libc++.a(shr_64.o)
> >          /usr/lib/libc++abi.a(libc++abi.so.1)
> >          /usr/lib/libc.a(shr_64.o)
> >          /usr/lib/libpthreads.a(_shr_xpg5_64.o)
> >          /usr/lib/libc++.a(libc++.so.1)
> >          /usr/lib/libunwind.a(libunwind.so.1)
> >          /usr/lib/libc.a(_shr_64.o)
> >          /unix
> >          /usr/lib/libcrypt.a(shr_64.o)
>
> David, I'll leave that decision up to you.
>
> > Bruno
>
>
> --
> Arsen Arsenović

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-16 23:59                     ` David Edelsohn
@ 2023-11-17  8:34                       ` Arsen Arsenović
  2023-11-17  8:50                         ` Richard Biener
  2023-11-17 14:41                         ` David Edelsohn
  0 siblings, 2 replies; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-17  8:34 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Richard Biener, Bruno Haible, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 4490 bytes --]


David Edelsohn <dje.gcc@gmail.com> writes:

> On Thu, Nov 16, 2023 at 5:52 PM Arsen Arsenović <arsen@aarsen.me> wrote:
>
> [snip]
>> Sure, but my patch does insert --disable-shared:
>>
>> --8<---------------cut here---------------start------------->8---
>> host_modules= { module= gettext; bootstrap=true; no_install=true;
>>                 module_srcdir= "gettext/gettext-runtime";
>>                 // We always build gettext with pic, because some packages
>> (e.g. gdbserver)
>>                 // need it in some configuratons, which is determined via
>> nontrivial tests.
>>                 // Always enabling pic seems to make sense for something
>> tied to
>>                 // user-facing output.
>>                 extra_configure_flags='--disable-shared --disable-java
>> --disable-csharp --with-pic';
>>                 lib_path=intl/.libs; };
>> --8<---------------cut here---------------end--------------->8---
>>
>> ... and it is applied:
>>
>> --8<---------------cut here---------------start------------->8---
>> -bash-5.1$ ./config.status --config
>> --srcdir=../../gcc/gettext/gettext-runtime --cache-file=./config.cache
>>   --disable-werror --with-gmp=/opt/cfarm
>>   --with-libiconv-prefix=/opt/cfarm --disable-libstdcxx-pch
>>   --with-included-gettext --program-transform-name=s,y,y,
>>   --disable-option-checking --build=powerpc-ibm-aix7.3.1.0
>>   --host=powerpc-ibm-aix7.3.1.0 --target=powerpc-ibm-aix7.3.1.0
>>   --disable-intermodule --enable-checking=yes,types,extra
>>   --disable-coverage --enable-languages=c,c++
>>   --disable-build-format-warnings --disable-shared --disable-java
>>   --disable-csharp --with-pic build_alias=powerpc-ibm-aix7.3.1.0
>>   host_alias=powerpc-ibm-aix7.3.1.0 target_alias=powerpc-ibm-aix7.3.1.0
>>   CC=gcc CFLAGS=-g 'LDFLAGS=-static-libstdc++ -static-libgcc
>>   -Wl,-bbigtoc' 'CXX=g++ -std=c++11' CXXFLAGS=-g
>> --8<---------------cut here---------------end--------------->8---
>>
>> I'm unsure how to tell what the produced binaries are w.r.t static or
>> shared, but I only see .o files inside intl/.libs/libintl.a, while I see
>> a .so.1 in (e.g.) /lib/libz.a, hinting at it not being shared (?)
>>
>
> An AIX shared library created by libtool will look like
> libfoo.a[libfoo.so.N], where N is the package major version number.
> Normally with one file.

> An AIX static library will look like libfoo.a[a.o, b.o, c.o]
> with multiple object files.
>
> An AIX archive can contain a combination of shared objects and
> normal object files.
>
> AIX normally uses the convention shr.o or shr_64.o for the name
> of the shared object file.  Hint, hint, an AIX archive can contain
> both 32 bit and 64 bit object files or shared objects.
>
> I don't know why the gettext build system would create
> /home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8)
> if --disable-shared was requested.  That clearly is using the
> naming of a libtool AIX shared object and failing due to
> the missing shared object.  Although in this case, the problem
> seems to be the shared library load path.  AIX uses LIBPATH,
> not LD_LIBRARY_PATH.

It doesn't create libintl.a with a libintl.so.8 inside of it.  The
libintl.a contains a bunch of objects, as I'd expect of a static
library:

--8<---------------cut here---------------start------------->8---
-bash-5.1$ ar -t gettext/intl/.libs/libintl.a  | grep libintl
-bash-5.1$ ar -t gettext/intl/.libs/libintl.a    
bindtextdom.o
dcgettext.o
...
--8<---------------cut here---------------end--------------->8---


> Also, for me, the out of tree path was
>
> gettext/gettext-runtime/intl/.libs
>
> Is your search path missing a level?

No, the above is generated by the GCC build system and builds
gettext-runtime directly (per Brunos recommendation a while ago) as it
is replacing intl/ of similar functionality.

I'm currently building GCC with libintl with the threads hack you
mentioned applied (as I got undefined references to the pthread
functions you discovered).  I suspect that, bar this issue (which, IIUC,
Bruno will fix in a new release?) the patch above will fix the issues
you've encountered on AIX (note that if you want to use gettext in-tree,
you'd still have to fetch gettext into the tree).

Maybe we should provide a download-prerequisite-y script that skips
everything but GNU gettext, to retain same behavior?

Have a lovely day.
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: building GNU gettext on AIX
  2023-11-17  8:33                               ` Richard Biener
@ 2023-11-17  8:49                                 ` Arsen Arsenović
  2023-11-17 12:24                                 ` Bruno Haible
  1 sibling, 0 replies; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-17  8:49 UTC (permalink / raw)
  To: Richard Biener; +Cc: Bruno Haible, David Edelsohn, GCC Patches, bug-gettext

[-- Attachment #1: Type: text/plain, Size: 4052 bytes --]


Richard Biener <richard.guenther@gmail.com> writes:

> On Fri, Nov 17, 2023 at 12:13 AM Arsen Arsenović <arsen@aarsen.me> wrote:
>>
>>
>> Bruno Haible <bruno@clisp.org> writes:
>>
>> > Hi David,
>> >
>> >> the default, distributed libintl library will not allow GCC to be built
>> >> with NLS enabled.
>> >
>> > The problem is this configure test from gettext.m4
>> >
>> >   checking for GNU gettext in libintl... no
>> >
>> > It should say
>> >
>> >   checking for GNU gettext in libintl... yes
>> >
>> > I reproduce it with simple hello-world package, outside GCC.
>> >
>> > It tests whether a program that uses gettext() can be linked with
>> >   -lintl -liconv
>> > But now, on AIX, it needs to test whether such a program can be linked with
>> >   -lintl -liconv -lpthread
>> >
>> >> Were you suggesting that --enable-threads=isoc would work now or that it
>> >> would require further changes for a future release?
>> >
>> > It requires a change, effectively to do as if HAVE_PTHREAD_API is undefined
>> > if --enable-threads=isoc was provided.
>> >
>> > I can prepare a new gettext release that has both issues fixed:
>> >   - gettext.m4 that fixes the configure test and sets the variable LIBINTL
>> >     to "-Lsome/libdir -lintl -liconv -lpthread",
>> >   - mbrtowc.o and setlocale*.o that use mtx_* locks instead of pthread_*
>> >     mutexes when requested.
>> >
>> > But you then need to make up your mind w.r.t. what I wrote in the earlier
>> > mail.
>> >
>> >   * GCC can pass --enable-threads=isoc, to avoid the libpthread dependency
>> >     on AIX ≥ 7.2.
>>
>> Hmm, would that option work everywhere, though?  Or would we have to
>> wire up configury to detect which flag to use?  If so, what would it
>> look like.
>
> I'd highly recommend the in-tree gettext to be built with thread
> support _disabled_,
> only a static library built and never installed (but linked statically
> into the host
> binaries).
>
> So if --disable-threads (or how it is called) does not work you need
> to fix _that_.
> Likewise if --disable-shared doesn't work correctly on all platforms
> you have to fix
> that as well.

That seems like the best choice to me too (and I'm testing a patch that
does that currently).

> Richard.
>
>>
>> >   * Or GCC can (continue to?) use the variable LIBINTL. This will work on
>>
>> If you mean the one generated by gettext.m4/uninstalled-config.sh, it is
>> utilized today:
>>
>> LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) \
>>         $(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS)
>>
>> (from gcc/Makefile.in)
>>
>>
>> >     AIX 7.1 as well but the programs will then be linked against libpthread.
>> >     One additional library.
>> >     $ ldd gcc
>> >     /opt/freeware/bin/gcc needs:
>> >          /usr/lib/libc.a(shr.o)
>> >          /opt/freeware/lib/libiconv.a(libiconv.so.2)
>> >          /usr/lib/libc.a(_shr.o)
>> >          /unix
>> >          /usr/lib/libcrypt.a(shr.o)
>> >          /opt/freeware/lib/libgcc_s.a(shr.o)
>> >     libpthread.a will be added to this list.
>> >
>> >     ibm-clang links against libpthread.a as well:
>> >     $ ldd /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig
>> >     /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig needs:
>> >          /usr/lib/libpthreads.a(shr_xpg5_64.o)
>> >          /usr/opt/zlibNX/lib/libz.a(libz.so.1)
>> >          /usr/lib/libcurses.a(shr42_64.o)
>> >          /usr/lib/libiconv.a(shr4_64.o)
>> >          /usr/lib/libc++.a(shr_64.o)
>> >          /usr/lib/libc++abi.a(libc++abi.so.1)
>> >          /usr/lib/libc.a(shr_64.o)
>> >          /usr/lib/libpthreads.a(_shr_xpg5_64.o)
>> >          /usr/lib/libc++.a(libc++.so.1)
>> >          /usr/lib/libunwind.a(libunwind.so.1)
>> >          /usr/lib/libc.a(_shr_64.o)
>> >          /unix
>> >          /usr/lib/libcrypt.a(shr_64.o)
>>
>> David, I'll leave that decision up to you.
>>
>> > Bruno
>>
>>
>> --
>> Arsen Arsenović


-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-17  8:34                       ` Arsen Arsenović
@ 2023-11-17  8:50                         ` Richard Biener
  2023-11-17  8:56                           ` Arsen Arsenović
  2023-11-17 14:41                         ` David Edelsohn
  1 sibling, 1 reply; 60+ messages in thread
From: Richard Biener @ 2023-11-17  8:50 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: David Edelsohn, Bruno Haible, gcc-patches

On Fri, Nov 17, 2023 at 9:46 AM Arsen Arsenović <arsen@aarsen.me> wrote:
>
>
> David Edelsohn <dje.gcc@gmail.com> writes:
>
> > On Thu, Nov 16, 2023 at 5:52 PM Arsen Arsenović <arsen@aarsen.me> wrote:
> >
> > [snip]
> >> Sure, but my patch does insert --disable-shared:
> >>
> >> --8<---------------cut here---------------start------------->8---
> >> host_modules= { module= gettext; bootstrap=true; no_install=true;
> >>                 module_srcdir= "gettext/gettext-runtime";
> >>                 // We always build gettext with pic, because some packages
> >> (e.g. gdbserver)
> >>                 // need it in some configuratons, which is determined via
> >> nontrivial tests.
> >>                 // Always enabling pic seems to make sense for something
> >> tied to
> >>                 // user-facing output.
> >>                 extra_configure_flags='--disable-shared --disable-java
> >> --disable-csharp --with-pic';
> >>                 lib_path=intl/.libs; };
> >> --8<---------------cut here---------------end--------------->8---
> >>
> >> ... and it is applied:
> >>
> >> --8<---------------cut here---------------start------------->8---
> >> -bash-5.1$ ./config.status --config
> >> --srcdir=../../gcc/gettext/gettext-runtime --cache-file=./config.cache
> >>   --disable-werror --with-gmp=/opt/cfarm
> >>   --with-libiconv-prefix=/opt/cfarm --disable-libstdcxx-pch
> >>   --with-included-gettext --program-transform-name=s,y,y,
> >>   --disable-option-checking --build=powerpc-ibm-aix7.3.1.0
> >>   --host=powerpc-ibm-aix7.3.1.0 --target=powerpc-ibm-aix7.3.1.0
> >>   --disable-intermodule --enable-checking=yes,types,extra
> >>   --disable-coverage --enable-languages=c,c++
> >>   --disable-build-format-warnings --disable-shared --disable-java
> >>   --disable-csharp --with-pic build_alias=powerpc-ibm-aix7.3.1.0
> >>   host_alias=powerpc-ibm-aix7.3.1.0 target_alias=powerpc-ibm-aix7.3.1.0
> >>   CC=gcc CFLAGS=-g 'LDFLAGS=-static-libstdc++ -static-libgcc
> >>   -Wl,-bbigtoc' 'CXX=g++ -std=c++11' CXXFLAGS=-g
> >> --8<---------------cut here---------------end--------------->8---
> >>
> >> I'm unsure how to tell what the produced binaries are w.r.t static or
> >> shared, but I only see .o files inside intl/.libs/libintl.a, while I see
> >> a .so.1 in (e.g.) /lib/libz.a, hinting at it not being shared (?)
> >>
> >
> > An AIX shared library created by libtool will look like
> > libfoo.a[libfoo.so.N], where N is the package major version number.
> > Normally with one file.
>
> > An AIX static library will look like libfoo.a[a.o, b.o, c.o]
> > with multiple object files.
> >
> > An AIX archive can contain a combination of shared objects and
> > normal object files.
> >
> > AIX normally uses the convention shr.o or shr_64.o for the name
> > of the shared object file.  Hint, hint, an AIX archive can contain
> > both 32 bit and 64 bit object files or shared objects.
> >
> > I don't know why the gettext build system would create
> > /home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8)
> > if --disable-shared was requested.  That clearly is using the
> > naming of a libtool AIX shared object and failing due to
> > the missing shared object.  Although in this case, the problem
> > seems to be the shared library load path.  AIX uses LIBPATH,
> > not LD_LIBRARY_PATH.
>
> It doesn't create libintl.a with a libintl.so.8 inside of it.  The
> libintl.a contains a bunch of objects, as I'd expect of a static
> library:
>
> --8<---------------cut here---------------start------------->8---
> -bash-5.1$ ar -t gettext/intl/.libs/libintl.a  | grep libintl
> -bash-5.1$ ar -t gettext/intl/.libs/libintl.a
> bindtextdom.o
> dcgettext.o
> ...
> --8<---------------cut here---------------end--------------->8---
>
>
> > Also, for me, the out of tree path was
> >
> > gettext/gettext-runtime/intl/.libs
> >
> > Is your search path missing a level?
>
> No, the above is generated by the GCC build system and builds
> gettext-runtime directly (per Brunos recommendation a while ago) as it
> is replacing intl/ of similar functionality.
>
> I'm currently building GCC with libintl with the threads hack you
> mentioned applied (as I got undefined references to the pthread
> functions you discovered).  I suspect that, bar this issue (which, IIUC,
> Bruno will fix in a new release?) the patch above will fix the issues
> you've encountered on AIX (note that if you want to use gettext in-tree,
> you'd still have to fetch gettext into the tree).
>
> Maybe we should provide a download-prerequisite-y script that skips
> everything but GNU gettext, to retain same behavior?

You could add --only-gettext as option to it?

>
> Have a lovely day.
> --
> Arsen Arsenović

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-17  8:50                         ` Richard Biener
@ 2023-11-17  8:56                           ` Arsen Arsenović
  0 siblings, 0 replies; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-17  8:56 UTC (permalink / raw)
  To: Richard Biener; +Cc: David Edelsohn, Bruno Haible, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 5043 bytes --]


Richard Biener <richard.guenther@gmail.com> writes:

> On Fri, Nov 17, 2023 at 9:46 AM Arsen Arsenović <arsen@aarsen.me> wrote:
>>
>>
>> David Edelsohn <dje.gcc@gmail.com> writes:
>>
>> > On Thu, Nov 16, 2023 at 5:52 PM Arsen Arsenović <arsen@aarsen.me> wrote:
>> >
>> > [snip]
>> >> Sure, but my patch does insert --disable-shared:
>> >>
>> >> --8<---------------cut here---------------start------------->8---
>> >> host_modules= { module= gettext; bootstrap=true; no_install=true;
>> >>                 module_srcdir= "gettext/gettext-runtime";
>> >>                 // We always build gettext with pic, because some packages
>> >> (e.g. gdbserver)
>> >>                 // need it in some configuratons, which is determined via
>> >> nontrivial tests.
>> >>                 // Always enabling pic seems to make sense for something
>> >> tied to
>> >>                 // user-facing output.
>> >>                 extra_configure_flags='--disable-shared --disable-java
>> >> --disable-csharp --with-pic';
>> >>                 lib_path=intl/.libs; };
>> >> --8<---------------cut here---------------end--------------->8---
>> >>
>> >> ... and it is applied:
>> >>
>> >> --8<---------------cut here---------------start------------->8---
>> >> -bash-5.1$ ./config.status --config
>> >> --srcdir=../../gcc/gettext/gettext-runtime --cache-file=./config.cache
>> >>   --disable-werror --with-gmp=/opt/cfarm
>> >>   --with-libiconv-prefix=/opt/cfarm --disable-libstdcxx-pch
>> >>   --with-included-gettext --program-transform-name=s,y,y,
>> >>   --disable-option-checking --build=powerpc-ibm-aix7.3.1.0
>> >>   --host=powerpc-ibm-aix7.3.1.0 --target=powerpc-ibm-aix7.3.1.0
>> >>   --disable-intermodule --enable-checking=yes,types,extra
>> >>   --disable-coverage --enable-languages=c,c++
>> >>   --disable-build-format-warnings --disable-shared --disable-java
>> >>   --disable-csharp --with-pic build_alias=powerpc-ibm-aix7.3.1.0
>> >>   host_alias=powerpc-ibm-aix7.3.1.0 target_alias=powerpc-ibm-aix7.3.1.0
>> >>   CC=gcc CFLAGS=-g 'LDFLAGS=-static-libstdc++ -static-libgcc
>> >>   -Wl,-bbigtoc' 'CXX=g++ -std=c++11' CXXFLAGS=-g
>> >> --8<---------------cut here---------------end--------------->8---
>> >>
>> >> I'm unsure how to tell what the produced binaries are w.r.t static or
>> >> shared, but I only see .o files inside intl/.libs/libintl.a, while I see
>> >> a .so.1 in (e.g.) /lib/libz.a, hinting at it not being shared (?)
>> >>
>> >
>> > An AIX shared library created by libtool will look like
>> > libfoo.a[libfoo.so.N], where N is the package major version number.
>> > Normally with one file.
>>
>> > An AIX static library will look like libfoo.a[a.o, b.o, c.o]
>> > with multiple object files.
>> >
>> > An AIX archive can contain a combination of shared objects and
>> > normal object files.
>> >
>> > AIX normally uses the convention shr.o or shr_64.o for the name
>> > of the shared object file.  Hint, hint, an AIX archive can contain
>> > both 32 bit and 64 bit object files or shared objects.
>> >
>> > I don't know why the gettext build system would create
>> > /home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8)
>> > if --disable-shared was requested.  That clearly is using the
>> > naming of a libtool AIX shared object and failing due to
>> > the missing shared object.  Although in this case, the problem
>> > seems to be the shared library load path.  AIX uses LIBPATH,
>> > not LD_LIBRARY_PATH.
>>
>> It doesn't create libintl.a with a libintl.so.8 inside of it.  The
>> libintl.a contains a bunch of objects, as I'd expect of a static
>> library:
>>
>> --8<---------------cut here---------------start------------->8---
>> -bash-5.1$ ar -t gettext/intl/.libs/libintl.a  | grep libintl
>> -bash-5.1$ ar -t gettext/intl/.libs/libintl.a
>> bindtextdom.o
>> dcgettext.o
>> ...
>> --8<---------------cut here---------------end--------------->8---
>>
>>
>> > Also, for me, the out of tree path was
>> >
>> > gettext/gettext-runtime/intl/.libs
>> >
>> > Is your search path missing a level?
>>
>> No, the above is generated by the GCC build system and builds
>> gettext-runtime directly (per Brunos recommendation a while ago) as it
>> is replacing intl/ of similar functionality.
>>
>> I'm currently building GCC with libintl with the threads hack you
>> mentioned applied (as I got undefined references to the pthread
>> functions you discovered).  I suspect that, bar this issue (which, IIUC,
>> Bruno will fix in a new release?) the patch above will fix the issues
>> you've encountered on AIX (note that if you want to use gettext in-tree,
>> you'd still have to fetch gettext into the tree).
>>
>> Maybe we should provide a download-prerequisite-y script that skips
>> everything but GNU gettext, to retain same behavior?
>
> You could add --only-gettext as option to it?

Sure, that sounds good to me.

>>
>> Have a lovely day.
>> --
>> Arsen Arsenović


-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: building GNU gettext on AIX
  2023-11-17  8:33                               ` Richard Biener
  2023-11-17  8:49                                 ` Arsen Arsenović
@ 2023-11-17 12:24                                 ` Bruno Haible
  2023-11-17 13:06                                   ` Arsen Arsenović
  1 sibling, 1 reply; 60+ messages in thread
From: Bruno Haible @ 2023-11-17 12:24 UTC (permalink / raw)
  To: Arsen Arsenović, Richard Biener
  Cc: David Edelsohn, GCC Patches, bug-gettext

David Edelsohn and Richard Biener wrote:
> > >   * GCC can pass --enable-threads=isoc, to avoid the libpthread dependency
> > >     on AIX ≥ 7.2.
> >
> > Hmm, would that option work everywhere, though?  Or would we have to
> > wire up configury to detect which flag to use?  If so, what would it
> > look like.

--enable-threads=isoc should only be used where needed, i.e. on AIX 7.2
or higher. Yes, this needs a configure test.

> I'd highly recommend the in-tree gettext to be built with thread
> support _disabled_,
> only a static library built and never installed (but linked statically
> into the host binaries).

As long as this static libintl.a gets never installed (but linked statically
into the host binaries), that's perfectly fine.

It only needs a fixed gettext.m4, to deal with the bug that David Edelsohn
noticed on AIX (but that exists on macOS as well). [1]

Bruno

[1] https://lists.gnu.org/archive/html/bug-gnulib/2023-11/msg00164.html




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

* Re: building GNU gettext on AIX
  2023-11-17 12:24                                 ` Bruno Haible
@ 2023-11-17 13:06                                   ` Arsen Arsenović
  0 siblings, 0 replies; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-17 13:06 UTC (permalink / raw)
  To: Bruno Haible; +Cc: Richard Biener, David Edelsohn, GCC Patches, bug-gettext

[-- Attachment #1: Type: text/plain, Size: 1450 bytes --]


Bruno Haible <bruno@clisp.org> writes:

> David Edelsohn and Richard Biener wrote:
>> > >   * GCC can pass --enable-threads=isoc, to avoid the libpthread dependency
>> > >     on AIX ≥ 7.2.
>> >
>> > Hmm, would that option work everywhere, though?  Or would we have to
>> > wire up configury to detect which flag to use?  If so, what would it
>> > look like.
>
> --enable-threads=isoc should only be used where needed, i.e. on AIX 7.2
> or higher. Yes, this needs a configure test.
>
>> I'd highly recommend the in-tree gettext to be built with thread
>> support _disabled_,
>> only a static library built and never installed (but linked statically
>> into the host binaries).
>
> As long as this static libintl.a gets never installed (but linked statically
> into the host binaries), that's perfectly fine.
>
> It only needs a fixed gettext.m4, to deal with the bug that David Edelsohn
> noticed on AIX (but that exists on macOS as well). [1]

That should always work for us, then (the only case in which the GCC
build system sets up flags for gettext is when building it in-tree, in
which case we already want a --disable-shared build).

If that library gets installed, then, so far, it is unintentional.  I'll
check that (as well as the docs targets that Eric Gallager mentioned on
IRC) tonight.

> Bruno
>
> [1] https://lists.gnu.org/archive/html/bug-gnulib/2023-11/msg00164.html


-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-17  8:34                       ` Arsen Arsenović
  2023-11-17  8:50                         ` Richard Biener
@ 2023-11-17 14:41                         ` David Edelsohn
  2023-11-17 15:16                           ` Arsen Arsenović
  1 sibling, 1 reply; 60+ messages in thread
From: David Edelsohn @ 2023-11-17 14:41 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: Richard Biener, Bruno Haible, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 5018 bytes --]

On Fri, Nov 17, 2023 at 3:46 AM Arsen Arsenović <arsen@aarsen.me> wrote:

>
> David Edelsohn <dje.gcc@gmail.com> writes:
>
> > On Thu, Nov 16, 2023 at 5:52 PM Arsen Arsenović <arsen@aarsen.me> wrote:
> >
> > [snip]
> >> Sure, but my patch does insert --disable-shared:
> >>
> >> --8<---------------cut here---------------start------------->8---
> >> host_modules= { module= gettext; bootstrap=true; no_install=true;
> >>                 module_srcdir= "gettext/gettext-runtime";
> >>                 // We always build gettext with pic, because some
> packages
> >> (e.g. gdbserver)
> >>                 // need it in some configuratons, which is determined
> via
> >> nontrivial tests.
> >>                 // Always enabling pic seems to make sense for something
> >> tied to
> >>                 // user-facing output.
> >>                 extra_configure_flags='--disable-shared --disable-java
> >> --disable-csharp --with-pic';
> >>                 lib_path=intl/.libs; };
> >> --8<---------------cut here---------------end--------------->8---
> >>
> >> ... and it is applied:
> >>
> >> --8<---------------cut here---------------start------------->8---
> >> -bash-5.1$ ./config.status --config
> >> --srcdir=../../gcc/gettext/gettext-runtime --cache-file=./config.cache
> >>   --disable-werror --with-gmp=/opt/cfarm
> >>   --with-libiconv-prefix=/opt/cfarm --disable-libstdcxx-pch
> >>   --with-included-gettext --program-transform-name=s,y,y,
> >>   --disable-option-checking --build=powerpc-ibm-aix7.3.1.0
> >>   --host=powerpc-ibm-aix7.3.1.0 --target=powerpc-ibm-aix7.3.1.0
> >>   --disable-intermodule --enable-checking=yes,types,extra
> >>   --disable-coverage --enable-languages=c,c++
> >>   --disable-build-format-warnings --disable-shared --disable-java
> >>   --disable-csharp --with-pic build_alias=powerpc-ibm-aix7.3.1.0
> >>   host_alias=powerpc-ibm-aix7.3.1.0 target_alias=powerpc-ibm-aix7.3.1.0
> >>   CC=gcc CFLAGS=-g 'LDFLAGS=-static-libstdc++ -static-libgcc
> >>   -Wl,-bbigtoc' 'CXX=g++ -std=c++11' CXXFLAGS=-g
> >> --8<---------------cut here---------------end--------------->8---
> >>
> >> I'm unsure how to tell what the produced binaries are w.r.t static or
> >> shared, but I only see .o files inside intl/.libs/libintl.a, while I see
> >> a .so.1 in (e.g.) /lib/libz.a, hinting at it not being shared (?)
> >>
> >
> > An AIX shared library created by libtool will look like
> > libfoo.a[libfoo.so.N], where N is the package major version number.
> > Normally with one file.
>
> > An AIX static library will look like libfoo.a[a.o, b.o, c.o]
> > with multiple object files.
> >
> > An AIX archive can contain a combination of shared objects and
> > normal object files.
> >
> > AIX normally uses the convention shr.o or shr_64.o for the name
> > of the shared object file.  Hint, hint, an AIX archive can contain
> > both 32 bit and 64 bit object files or shared objects.
> >
> > I don't know why the gettext build system would create
> > /home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8)
> > if --disable-shared was requested.  That clearly is using the
> > naming of a libtool AIX shared object and failing due to
> > the missing shared object.  Although in this case, the problem
> > seems to be the shared library load path.  AIX uses LIBPATH,
> > not LD_LIBRARY_PATH.
>
> It doesn't create libintl.a with a libintl.so.8 inside of it.  The
> libintl.a contains a bunch of objects, as I'd expect of a static
> library:
>
> --8<---------------cut here---------------start------------->8---
> -bash-5.1$ ar -t gettext/intl/.libs/libintl.a  | grep libintl
> -bash-5.1$ ar -t gettext/intl/.libs/libintl.a
> bindtextdom.o
> dcgettext.o
> ...
> --8<---------------cut here---------------end--------------->8---
>
>
> > Also, for me, the out of tree path was
> >
> > gettext/gettext-runtime/intl/.libs
> >
> > Is your search path missing a level?
>
> No, the above is generated by the GCC build system and builds
> gettext-runtime directly (per Brunos recommendation a while ago) as it
> is replacing intl/ of similar functionality.
>
> I'm currently building GCC with libintl with the threads hack you
> mentioned applied (as I got undefined references to the pthread
> functions you discovered).  I suspect that, bar this issue (which, IIUC,
> Bruno will fix in a new release?) the patch above will fix the issues
> you've encountered on AIX (note that if you want to use gettext in-tree,
> you'd still have to fetch gettext into the tree).
>
> Maybe we should provide a download-prerequisite-y script that skips
> everything but GNU gettext, to retain same behavior?
>
> Have a lovely day.
>

I'm concerned that the gettext fixes are working around AIX support for
libpthread.a as opposed to making --disable-threads function.

--enabled-threads=isoc use of mtx_* is a workaround, but it's still not
allowing users to truly disable threads.

Thanks, David

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-17 14:41                         ` David Edelsohn
@ 2023-11-17 15:16                           ` Arsen Arsenović
  2023-11-17 16:07                             ` David Edelsohn
  0 siblings, 1 reply; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-17 15:16 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Richard Biener, Bruno Haible, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 5329 bytes --]


David Edelsohn <dje.gcc@gmail.com> writes:

> On Fri, Nov 17, 2023 at 3:46 AM Arsen Arsenović <arsen@aarsen.me> wrote:
>
>>
>> David Edelsohn <dje.gcc@gmail.com> writes:
>>
>> > On Thu, Nov 16, 2023 at 5:52 PM Arsen Arsenović <arsen@aarsen.me> wrote:
>> >
>> > [snip]
>> >> Sure, but my patch does insert --disable-shared:
>> >>
>> >> --8<---------------cut here---------------start------------->8---
>> >> host_modules= { module= gettext; bootstrap=true; no_install=true;
>> >>                 module_srcdir= "gettext/gettext-runtime";
>> >>                 // We always build gettext with pic, because some
>> packages
>> >> (e.g. gdbserver)
>> >>                 // need it in some configuratons, which is determined
>> via
>> >> nontrivial tests.
>> >>                 // Always enabling pic seems to make sense for something
>> >> tied to
>> >>                 // user-facing output.
>> >>                 extra_configure_flags='--disable-shared --disable-java
>> >> --disable-csharp --with-pic';
>> >>                 lib_path=intl/.libs; };
>> >> --8<---------------cut here---------------end--------------->8---
>> >>
>> >> ... and it is applied:
>> >>
>> >> --8<---------------cut here---------------start------------->8---
>> >> -bash-5.1$ ./config.status --config
>> >> --srcdir=../../gcc/gettext/gettext-runtime --cache-file=./config.cache
>> >>   --disable-werror --with-gmp=/opt/cfarm
>> >>   --with-libiconv-prefix=/opt/cfarm --disable-libstdcxx-pch
>> >>   --with-included-gettext --program-transform-name=s,y,y,
>> >>   --disable-option-checking --build=powerpc-ibm-aix7.3.1.0
>> >>   --host=powerpc-ibm-aix7.3.1.0 --target=powerpc-ibm-aix7.3.1.0
>> >>   --disable-intermodule --enable-checking=yes,types,extra
>> >>   --disable-coverage --enable-languages=c,c++
>> >>   --disable-build-format-warnings --disable-shared --disable-java
>> >>   --disable-csharp --with-pic build_alias=powerpc-ibm-aix7.3.1.0
>> >>   host_alias=powerpc-ibm-aix7.3.1.0 target_alias=powerpc-ibm-aix7.3.1.0
>> >>   CC=gcc CFLAGS=-g 'LDFLAGS=-static-libstdc++ -static-libgcc
>> >>   -Wl,-bbigtoc' 'CXX=g++ -std=c++11' CXXFLAGS=-g
>> >> --8<---------------cut here---------------end--------------->8---
>> >>
>> >> I'm unsure how to tell what the produced binaries are w.r.t static or
>> >> shared, but I only see .o files inside intl/.libs/libintl.a, while I see
>> >> a .so.1 in (e.g.) /lib/libz.a, hinting at it not being shared (?)
>> >>
>> >
>> > An AIX shared library created by libtool will look like
>> > libfoo.a[libfoo.so.N], where N is the package major version number.
>> > Normally with one file.
>>
>> > An AIX static library will look like libfoo.a[a.o, b.o, c.o]
>> > with multiple object files.
>> >
>> > An AIX archive can contain a combination of shared objects and
>> > normal object files.
>> >
>> > AIX normally uses the convention shr.o or shr_64.o for the name
>> > of the shared object file.  Hint, hint, an AIX archive can contain
>> > both 32 bit and 64 bit object files or shared objects.
>> >
>> > I don't know why the gettext build system would create
>> > /home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8)
>> > if --disable-shared was requested.  That clearly is using the
>> > naming of a libtool AIX shared object and failing due to
>> > the missing shared object.  Although in this case, the problem
>> > seems to be the shared library load path.  AIX uses LIBPATH,
>> > not LD_LIBRARY_PATH.
>>
>> It doesn't create libintl.a with a libintl.so.8 inside of it.  The
>> libintl.a contains a bunch of objects, as I'd expect of a static
>> library:
>>
>> --8<---------------cut here---------------start------------->8---
>> -bash-5.1$ ar -t gettext/intl/.libs/libintl.a  | grep libintl
>> -bash-5.1$ ar -t gettext/intl/.libs/libintl.a
>> bindtextdom.o
>> dcgettext.o
>> ...
>> --8<---------------cut here---------------end--------------->8---
>>
>>
>> > Also, for me, the out of tree path was
>> >
>> > gettext/gettext-runtime/intl/.libs
>> >
>> > Is your search path missing a level?
>>
>> No, the above is generated by the GCC build system and builds
>> gettext-runtime directly (per Brunos recommendation a while ago) as it
>> is replacing intl/ of similar functionality.
>>
>> I'm currently building GCC with libintl with the threads hack you
>> mentioned applied (as I got undefined references to the pthread
>> functions you discovered).  I suspect that, bar this issue (which, IIUC,
>> Bruno will fix in a new release?) the patch above will fix the issues
>> you've encountered on AIX (note that if you want to use gettext in-tree,
>> you'd still have to fetch gettext into the tree).
>>
>> Maybe we should provide a download-prerequisite-y script that skips
>> everything but GNU gettext, to retain same behavior?
>>
>> Have a lovely day.
>>
>
> I'm concerned that the gettext fixes are working around AIX support for
> libpthread.a as opposed to making --disable-threads function.

Indeed, my intention is to --disable-threads.  The goal of the
workaround is simply to test the patch I wrote.

> --enabled-threads=isoc use of mtx_* is a workaround, but it's still not
> allowing users to truly disable threads.
>
> Thanks, David


-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-17 15:16                           ` Arsen Arsenović
@ 2023-11-17 16:07                             ` David Edelsohn
  2023-11-18 18:10                               ` Arsen Arsenović
  2023-11-19 21:55                               ` Bruno Haible
  0 siblings, 2 replies; 60+ messages in thread
From: David Edelsohn @ 2023-11-17 16:07 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: Richard Biener, Bruno Haible, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 6012 bytes --]

On Fri, Nov 17, 2023 at 10:17 AM Arsen Arsenović <arsen@aarsen.me> wrote:

>
> David Edelsohn <dje.gcc@gmail.com> writes:
>
> > On Fri, Nov 17, 2023 at 3:46 AM Arsen Arsenović <arsen@aarsen.me> wrote:
> >
> >>
> >> David Edelsohn <dje.gcc@gmail.com> writes:
> >>
> >> > On Thu, Nov 16, 2023 at 5:52 PM Arsen Arsenović <arsen@aarsen.me>
> wrote:
> >> >
> >> > [snip]
> >> >> Sure, but my patch does insert --disable-shared:
> >> >>
> >> >> --8<---------------cut here---------------start------------->8---
> >> >> host_modules= { module= gettext; bootstrap=true; no_install=true;
> >> >>                 module_srcdir= "gettext/gettext-runtime";
> >> >>                 // We always build gettext with pic, because some
> >> packages
> >> >> (e.g. gdbserver)
> >> >>                 // need it in some configuratons, which is determined
> >> via
> >> >> nontrivial tests.
> >> >>                 // Always enabling pic seems to make sense for
> something
> >> >> tied to
> >> >>                 // user-facing output.
> >> >>                 extra_configure_flags='--disable-shared
> --disable-java
> >> >> --disable-csharp --with-pic';
> >> >>                 lib_path=intl/.libs; };
> >> >> --8<---------------cut here---------------end--------------->8---
> >> >>
> >> >> ... and it is applied:
> >> >>
> >> >> --8<---------------cut here---------------start------------->8---
> >> >> -bash-5.1$ ./config.status --config
> >> >> --srcdir=../../gcc/gettext/gettext-runtime
> --cache-file=./config.cache
> >> >>   --disable-werror --with-gmp=/opt/cfarm
> >> >>   --with-libiconv-prefix=/opt/cfarm --disable-libstdcxx-pch
> >> >>   --with-included-gettext --program-transform-name=s,y,y,
> >> >>   --disable-option-checking --build=powerpc-ibm-aix7.3.1.0
> >> >>   --host=powerpc-ibm-aix7.3.1.0 --target=powerpc-ibm-aix7.3.1.0
> >> >>   --disable-intermodule --enable-checking=yes,types,extra
> >> >>   --disable-coverage --enable-languages=c,c++
> >> >>   --disable-build-format-warnings --disable-shared --disable-java
> >> >>   --disable-csharp --with-pic build_alias=powerpc-ibm-aix7.3.1.0
> >> >>   host_alias=powerpc-ibm-aix7.3.1.0
> target_alias=powerpc-ibm-aix7.3.1.0
> >> >>   CC=gcc CFLAGS=-g 'LDFLAGS=-static-libstdc++ -static-libgcc
> >> >>   -Wl,-bbigtoc' 'CXX=g++ -std=c++11' CXXFLAGS=-g
> >> >> --8<---------------cut here---------------end--------------->8---
> >> >>
> >> >> I'm unsure how to tell what the produced binaries are w.r.t static or
> >> >> shared, but I only see .o files inside intl/.libs/libintl.a, while I
> see
> >> >> a .so.1 in (e.g.) /lib/libz.a, hinting at it not being shared (?)
> >> >>
> >> >
> >> > An AIX shared library created by libtool will look like
> >> > libfoo.a[libfoo.so.N], where N is the package major version number.
> >> > Normally with one file.
> >>
> >> > An AIX static library will look like libfoo.a[a.o, b.o, c.o]
> >> > with multiple object files.
> >> >
> >> > An AIX archive can contain a combination of shared objects and
> >> > normal object files.
> >> >
> >> > AIX normally uses the convention shr.o or shr_64.o for the name
> >> > of the shared object file.  Hint, hint, an AIX archive can contain
> >> > both 32 bit and 64 bit object files or shared objects.
> >> >
> >> > I don't know why the gettext build system would create
> >> > /home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8)
> >> > if --disable-shared was requested.  That clearly is using the
> >> > naming of a libtool AIX shared object and failing due to
> >> > the missing shared object.  Although in this case, the problem
> >> > seems to be the shared library load path.  AIX uses LIBPATH,
> >> > not LD_LIBRARY_PATH.
> >>
> >> It doesn't create libintl.a with a libintl.so.8 inside of it.  The
> >> libintl.a contains a bunch of objects, as I'd expect of a static
> >> library:
> >>
> >> --8<---------------cut here---------------start------------->8---
> >> -bash-5.1$ ar -t gettext/intl/.libs/libintl.a  | grep libintl
> >> -bash-5.1$ ar -t gettext/intl/.libs/libintl.a
> >> bindtextdom.o
> >> dcgettext.o
> >> ...
> >> --8<---------------cut here---------------end--------------->8---
> >>
> >>
> >> > Also, for me, the out of tree path was
> >> >
> >> > gettext/gettext-runtime/intl/.libs
> >> >
> >> > Is your search path missing a level?
> >>
> >> No, the above is generated by the GCC build system and builds
> >> gettext-runtime directly (per Brunos recommendation a while ago) as it
> >> is replacing intl/ of similar functionality.
> >>
> >> I'm currently building GCC with libintl with the threads hack you
> >> mentioned applied (as I got undefined references to the pthread
> >> functions you discovered).  I suspect that, bar this issue (which, IIUC,
> >> Bruno will fix in a new release?) the patch above will fix the issues
> >> you've encountered on AIX (note that if you want to use gettext in-tree,
> >> you'd still have to fetch gettext into the tree).
> >>
> >> Maybe we should provide a download-prerequisite-y script that skips
> >> everything but GNU gettext, to retain same behavior?
> >>
> >> Have a lovely day.
> >>
> >
> > I'm concerned that the gettext fixes are working around AIX support for
> > libpthread.a as opposed to making --disable-threads function.
>
> Indeed, my intention is to --disable-threads.  The goal of the
> workaround is simply to test the patch I wrote.
>

--disable-threads currently does not completely disable threads.  Bruno is
suggesting --enable-threads=isoc that relies on mtx mutex functions in libc.

Yes, GCC should configure the in tree gettext with --disable-threads, but
that configure option is not completely effective and does not produce a
build without threads references.

Thanks, David


>
> > --enabled-threads=isoc use of mtx_* is a workaround, but it's still not
> > allowing users to truly disable threads.
> >
> > Thanks, David
>
>

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-17 16:07                             ` David Edelsohn
@ 2023-11-18 18:10                               ` Arsen Arsenović
  2023-11-19 21:55                               ` Bruno Haible
  1 sibling, 0 replies; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-18 18:10 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Richard Biener, Bruno Haible, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 8231 bytes --]


David Edelsohn <dje.gcc@gmail.com> writes:

> On Fri, Nov 17, 2023 at 10:17 AM Arsen Arsenović <arsen@aarsen.me> wrote:
>
>>
>> David Edelsohn <dje.gcc@gmail.com> writes:
>>
>> > On Fri, Nov 17, 2023 at 3:46 AM Arsen Arsenović <arsen@aarsen.me> wrote:
>> >
>> >>
>> >> David Edelsohn <dje.gcc@gmail.com> writes:
>> >>
>> >> > On Thu, Nov 16, 2023 at 5:52 PM Arsen Arsenović <arsen@aarsen.me>
>> wrote:
>> >> >
>> >> > [snip]
>> >> >> Sure, but my patch does insert --disable-shared:
>> >> >>
>> >> >> --8<---------------cut here---------------start------------->8---
>> >> >> host_modules= { module= gettext; bootstrap=true; no_install=true;
>> >> >>                 module_srcdir= "gettext/gettext-runtime";
>> >> >>                 // We always build gettext with pic, because some
>> >> packages
>> >> >> (e.g. gdbserver)
>> >> >>                 // need it in some configuratons, which is determined
>> >> via
>> >> >> nontrivial tests.
>> >> >>                 // Always enabling pic seems to make sense for
>> something
>> >> >> tied to
>> >> >>                 // user-facing output.
>> >> >>                 extra_configure_flags='--disable-shared
>> --disable-java
>> >> >> --disable-csharp --with-pic';
>> >> >>                 lib_path=intl/.libs; };
>> >> >> --8<---------------cut here---------------end--------------->8---
>> >> >>
>> >> >> ... and it is applied:
>> >> >>
>> >> >> --8<---------------cut here---------------start------------->8---
>> >> >> -bash-5.1$ ./config.status --config
>> >> >> --srcdir=../../gcc/gettext/gettext-runtime
>> --cache-file=./config.cache
>> >> >>   --disable-werror --with-gmp=/opt/cfarm
>> >> >>   --with-libiconv-prefix=/opt/cfarm --disable-libstdcxx-pch
>> >> >>   --with-included-gettext --program-transform-name=s,y,y,
>> >> >>   --disable-option-checking --build=powerpc-ibm-aix7.3.1.0
>> >> >>   --host=powerpc-ibm-aix7.3.1.0 --target=powerpc-ibm-aix7.3.1.0
>> >> >>   --disable-intermodule --enable-checking=yes,types,extra
>> >> >>   --disable-coverage --enable-languages=c,c++
>> >> >>   --disable-build-format-warnings --disable-shared --disable-java
>> >> >>   --disable-csharp --with-pic build_alias=powerpc-ibm-aix7.3.1.0
>> >> >>   host_alias=powerpc-ibm-aix7.3.1.0
>> target_alias=powerpc-ibm-aix7.3.1.0
>> >> >>   CC=gcc CFLAGS=-g 'LDFLAGS=-static-libstdc++ -static-libgcc
>> >> >>   -Wl,-bbigtoc' 'CXX=g++ -std=c++11' CXXFLAGS=-g
>> >> >> --8<---------------cut here---------------end--------------->8---
>> >> >>
>> >> >> I'm unsure how to tell what the produced binaries are w.r.t static or
>> >> >> shared, but I only see .o files inside intl/.libs/libintl.a, while I
>> see
>> >> >> a .so.1 in (e.g.) /lib/libz.a, hinting at it not being shared (?)
>> >> >>
>> >> >
>> >> > An AIX shared library created by libtool will look like
>> >> > libfoo.a[libfoo.so.N], where N is the package major version number.
>> >> > Normally with one file.
>> >>
>> >> > An AIX static library will look like libfoo.a[a.o, b.o, c.o]
>> >> > with multiple object files.
>> >> >
>> >> > An AIX archive can contain a combination of shared objects and
>> >> > normal object files.
>> >> >
>> >> > AIX normally uses the convention shr.o or shr_64.o for the name
>> >> > of the shared object file.  Hint, hint, an AIX archive can contain
>> >> > both 32 bit and 64 bit object files or shared objects.
>> >> >
>> >> > I don't know why the gettext build system would create
>> >> > /home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8)
>> >> > if --disable-shared was requested.  That clearly is using the
>> >> > naming of a libtool AIX shared object and failing due to
>> >> > the missing shared object.  Although in this case, the problem
>> >> > seems to be the shared library load path.  AIX uses LIBPATH,
>> >> > not LD_LIBRARY_PATH.
>> >>
>> >> It doesn't create libintl.a with a libintl.so.8 inside of it.  The
>> >> libintl.a contains a bunch of objects, as I'd expect of a static
>> >> library:
>> >>
>> >> --8<---------------cut here---------------start------------->8---
>> >> -bash-5.1$ ar -t gettext/intl/.libs/libintl.a  | grep libintl
>> >> -bash-5.1$ ar -t gettext/intl/.libs/libintl.a
>> >> bindtextdom.o
>> >> dcgettext.o
>> >> ...
>> >> --8<---------------cut here---------------end--------------->8---
>> >>
>> >>
>> >> > Also, for me, the out of tree path was
>> >> >
>> >> > gettext/gettext-runtime/intl/.libs
>> >> >
>> >> > Is your search path missing a level?
>> >>
>> >> No, the above is generated by the GCC build system and builds
>> >> gettext-runtime directly (per Brunos recommendation a while ago) as it
>> >> is replacing intl/ of similar functionality.
>> >>
>> >> I'm currently building GCC with libintl with the threads hack you
>> >> mentioned applied (as I got undefined references to the pthread
>> >> functions you discovered).  I suspect that, bar this issue (which, IIUC,
>> >> Bruno will fix in a new release?) the patch above will fix the issues
>> >> you've encountered on AIX (note that if you want to use gettext in-tree,
>> >> you'd still have to fetch gettext into the tree).
>> >>
>> >> Maybe we should provide a download-prerequisite-y script that skips
>> >> everything but GNU gettext, to retain same behavior?
>> >>
>> >> Have a lovely day.
>> >>
>> >
>> > I'm concerned that the gettext fixes are working around AIX support for
>> > libpthread.a as opposed to making --disable-threads function.
>>
>> Indeed, my intention is to --disable-threads.  The goal of the
>> workaround is simply to test the patch I wrote.
>>
>
> --disable-threads currently does not completely disable threads.  Bruno is
> suggesting --enable-threads=isoc that relies on mtx mutex functions in libc.

Even with --enable-threads=isoc in place of --disable-threads, I get a
link error:

(ld): er full
ld: 0711-318 ERROR: Undefined symbols were found.
        The following symbols are in error:
 Symbol                    Inpndx  TY CL Source-File(Object-File) OR Import-File{Shared-object}
                              RLD: Address  Section  Rld-type Referencing Symbol
 ----------------------------------------------------------------------------------------------
 .pthread_mutex_lock       [26]    ER PR ../../../../gcc/gettext/gettext-runtime/intl/gnulib-lib/setlocale_null.c(./../gettext/intl/.libs/libintl.a[libgnu_la-setlocale_null.o])
                                   00000388 .text    R_RBR    [99]    <.setlocale_null_with_lock>
 .pthread_mutex_unlock     [30]    ER PR ../../../../gcc/gettext/gettext-runtime/intl/gnulib-lib/setlocale_null.c(./../gettext/intl/.libs/libintl.a[libgnu_la-setlocale_null.o])
                                   000003bc .text    R_RBR    [99]    <.setlocale_null_with_lock>
ER: The return code is 8.
collect2: error: ld returned 8 exit status

Bruno, am I missing something?

-bash-5.1$ ./config.status --config
--srcdir=../../gcc/gettext/gettext-runtime --cache-file=./config.cache --disable-werror --with-gmp=/opt/cfarm --with-libiconv-prefix=/opt/cfarm --disable-libstdcxx-pch --with-included-gettext --program-transform-name=s,y,y, --disable-option-checking --build=powerpc-ibm-aix7.3.1.0 --host=powerpc-ibm-aix7.3.1.0 --target=powerpc-ibm-aix7.3.1.0 --disable-intermodule --enable-checking=yes,types,extra --disable-coverage --enable-languages=c,c++ --disable-build-format-warnings --disable-shared --enable-threads=isoc --disable-java --disable-csharp --with-pic build_alias=powerpc-ibm-aix7.3.1.0 host_alias=powerpc-ibm-aix7.3.1.0 target_alias=powerpc-ibm-aix7.3.1.0 CC=gcc CFLAGS=-g 'LDFLAGS=-static-libstdc++ -static-libgcc -Wl,-bbigtoc' 'CXX=g++ -std=c++11' CXXFLAGS=-g

This is on gcc119.

TIA, have a lovely night.

> Yes, GCC should configure the in tree gettext with --disable-threads, but
> that configure option is not completely effective and does not produce a
> build without threads references.
>
> Thanks, David
>
>
>>
>> > --enabled-threads=isoc use of mtx_* is a workaround, but it's still not
>> > allowing users to truly disable threads.
>> >
>> > Thanks, David
>>
>>


-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: building GNU gettext on AIX
  2023-11-16 18:47                     ` Bruno Haible
  2023-11-16 18:50                       ` Arsen Arsenović
@ 2023-11-19 19:49                       ` Bruno Haible
  1 sibling, 0 replies; 60+ messages in thread
From: Bruno Haible @ 2023-11-19 19:49 UTC (permalink / raw)
  To: Richard Biener, David Edelsohn
  Cc: Arsen Arsenović, GCC Patches, bug-gettext

I wrote in
<https://gcc.gnu.org/pipermail/gcc-patches/2023-November/636861.html>:
> > The latest issue is that a few files in gettext ignore --disable-pthreads
> > and creates a dependency on pthread_mutex.
> ...
>   * If no, then the simple solution would be to pass the configure option
>       --enable-threads=isoc
>     This should not introduce a link dependency, because the mtx_lock,
>     mtx_unlock, and mtx_init functions are in libc in AIX ≥ 7.2. Currently it
>     does not work (it still uses pthread_mutex_lock and pthread_mutex_unlock
>     despite --enable-threads=isoc). But I could make this work and release
>     a gettext 0.22.4 with the fix.

Alas, this approach does not help reducing the dependency towards libpthreads.
On AIX, pthread_mutex_t and mtx_t are the same type. Thus code like this
===================================================
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <threads.h>

pthread_mutex_t lock1 = PTHREAD_MUTEX_INITIALIZER;

int main ()
{
  if (mtx_lock (&lock1) != thrd_success)
    abort ();

  if (mtx_unlock (&lock1) != thrd_success)
    abort ();
}
===================================================
compiles and runs fine. But the library dependencies still contain libpthreads.
This is in 32-bit mode:

$ ldd a.out
a.out needs:
         /usr/lib/libc.a(shr.o)
         /usr/lib/libc.a(cthread.o)
         /usr/lib/libc.a(_shr.o)
         /unix
         /usr/lib/libcrypt.a(shr.o)
         /usr/lib/libpthreads.a(shr_xpg5.o)
         /usr/lib/libpthreads.a(_shr_xpg5.o)
         /usr/lib/libpthreads.a(shr_comm.o)

and this in 64-bit mode:

$ ldd a.out 
a.out needs:
         /usr/lib/libc.a(shr_64.o)
         /usr/lib/libc.a(cthread_64.o)
         /usr/lib/libc.a(_shr_64.o)
         /unix
         /usr/lib/libcrypt.a(shr_64.o)
         /usr/lib/libpthreads.a(shr_xpg5_64.o)
         /usr/lib/libpthreads.a(_shr_xpg5_64.o)

Apparently the mtx_* functions are provided by
  /usr/lib/libc.a(cthread_64.o)
and this one depends on
  /usr/lib/libpthreads.a(shr_xpg5_64.o)
  /usr/lib/libpthreads.a(_shr_xpg5_64.o)

So, there can be only three ways to build GCC on AIX:

  - With --disable-nls. No i18n, no libpthreads dependency.
  - With --enable-nls, linked against a libintl created in the build
    tree with --disable-shared --disable-threads (requires gettext ≥ 0.22.4).
    Has i18n, but no libpthreads dependency.
  - With --enable-nls, linked against a public libintl. Depends on libpthreads.

Bruno




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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-17 16:07                             ` David Edelsohn
  2023-11-18 18:10                               ` Arsen Arsenović
@ 2023-11-19 21:55                               ` Bruno Haible
  2023-11-19 23:00                                 ` Bruno Haible
  2023-11-20  1:17                                 ` David Edelsohn
  1 sibling, 2 replies; 60+ messages in thread
From: Bruno Haible @ 2023-11-19 21:55 UTC (permalink / raw)
  To: Arsen Arsenović, David Edelsohn; +Cc: Richard Biener, gcc-patches

David Edelsohn wrote:
> --disable-threads currently does not completely disable threads.  Bruno is
> suggesting --enable-threads=isoc that relies on mtx mutex functions in libc.

Unfortunately, as said in the other mail today, relying only on mtx_* functions
did not drop the dependency towards libpthreads.

So, I've made a new release gettext-0.22.4, that includes only these changes:

  - AM_GNU_GETTEXT now recognizes a statically built libintl on macOS and AIX.

  - Passing --disable-threads now builds a libintl that, on AIX, does not
    need -lpthread.

  - Other build fixes on AIX.

> Yes, GCC should configure the in tree gettext with --disable-threads, but
> that configure option is not completely effective and does not produce a
> build without threads references.

Now it is effective. But you (Arsen) should state in the documentation
(gcc/doc/install.texi) that for --disable-threads to have this effect,
one needs gettext version 0.22.4 or newer.

Bruno




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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-19 21:55                               ` Bruno Haible
@ 2023-11-19 23:00                                 ` Bruno Haible
  2023-11-19 23:06                                   ` Andrew Pinski
  2023-11-20  1:17                                 ` David Edelsohn
  1 sibling, 1 reply; 60+ messages in thread
From: Bruno Haible @ 2023-11-19 23:00 UTC (permalink / raw)
  To: Arsen Arsenović, David Edelsohn; +Cc: Richard Biener, gcc-patches

I wrote:
> you (Arsen) should state in the documentation
> (gcc/doc/install.texi) that for --disable-threads to have this effect,
> one needs gettext version 0.22.4 or newer.

Not in gcc/doc/install.texi, but elsewhere. This topic is not relevant to
the average user who installs GCC from a tarball or from a git checkout.
Only to GCC hackers who have peculiar needs.

Bruno




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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-19 23:00                                 ` Bruno Haible
@ 2023-11-19 23:06                                   ` Andrew Pinski
  0 siblings, 0 replies; 60+ messages in thread
From: Andrew Pinski @ 2023-11-19 23:06 UTC (permalink / raw)
  To: Bruno Haible
  Cc: Arsen Arsenović, David Edelsohn, Richard Biener, gcc-patches

On Sun, Nov 19, 2023 at 3:01 PM Bruno Haible <bruno@clisp.org> wrote:
>
> I wrote:
> > you (Arsen) should state in the documentation
> > (gcc/doc/install.texi) that for --disable-threads to have this effect,
> > one needs gettext version 0.22.4 or newer.
>
> Not in gcc/doc/install.texi, but elsewhere. This topic is not relevant to
> the average user who installs GCC from a tarball or from a git checkout.
> Only to GCC hackers who have peculiar needs.

That still is documented in install.texi really.
https://gcc.gnu.org/install/specific.html#x-ibm-aix is generated from
that and it talks about other options dealing with NLS there.
Which seems like that part might need to be updated too.

Thanks,
Andrew


>
> Bruno
>
>
>

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-19 21:55                               ` Bruno Haible
  2023-11-19 23:00                                 ` Bruno Haible
@ 2023-11-20  1:17                                 ` David Edelsohn
  2023-11-20 21:18                                   ` Arsen Arsenović
  1 sibling, 1 reply; 60+ messages in thread
From: David Edelsohn @ 2023-11-20  1:17 UTC (permalink / raw)
  To: Bruno Haible; +Cc: Arsen Arsenović, Richard Biener, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1393 bytes --]

On Sun, Nov 19, 2023 at 5:15 PM Bruno Haible <bruno@clisp.org> wrote:

> David Edelsohn wrote:
> > --disable-threads currently does not completely disable threads.  Bruno
> is
> > suggesting --enable-threads=isoc that relies on mtx mutex functions in
> libc.
>
> Unfortunately, as said in the other mail today, relying only on mtx_*
> functions
> did not drop the dependency towards libpthreads.
>
> So, I've made a new release gettext-0.22.4, that includes only these
> changes:
>
>   - AM_GNU_GETTEXT now recognizes a statically built libintl on macOS and
> AIX.
>
>   - Passing --disable-threads now builds a libintl that, on AIX, does not
>     need -lpthread.
>
>   - Other build fixes on AIX.
>
> > Yes, GCC should configure the in tree gettext with --disable-threads, but
> > that configure option is not completely effective and does not produce a
> > build without threads references.
>
> Now it is effective. But you (Arsen) should state in the documentation
> (gcc/doc/install.texi) that for --disable-threads to have this effect,
> one needs gettext version 0.22.4 or newer.
>

So the question is do we want to change GCC on AIX to always link against
pthreads so that GCC can build with default, external builds of gettext
libintl.  I don't see a path for i18n support to work for GCC on AIX
without that unfortunate change.

Thanks, David

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-20  1:17                                 ` David Edelsohn
@ 2023-11-20 21:18                                   ` Arsen Arsenović
  2023-11-20 21:38                                     ` David Edelsohn
  2023-11-20 23:00                                     ` Bruno Haible
  0 siblings, 2 replies; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-20 21:18 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Bruno Haible, Richard Biener, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 3177 bytes --]


David Edelsohn <dje.gcc@gmail.com> writes:

> On Sun, Nov 19, 2023 at 5:15 PM Bruno Haible <bruno@clisp.org> wrote:
>
>> David Edelsohn wrote:
>> > --disable-threads currently does not completely disable threads.  Bruno
>> is
>> > suggesting --enable-threads=isoc that relies on mtx mutex functions in
>> libc.
>>
>> Unfortunately, as said in the other mail today, relying only on mtx_*
>> functions
>> did not drop the dependency towards libpthreads.
>>
>> So, I've made a new release gettext-0.22.4, that includes only these
>> changes:
>>
>>   - AM_GNU_GETTEXT now recognizes a statically built libintl on macOS and
>> AIX.
>>
>>   - Passing --disable-threads now builds a libintl that, on AIX, does not
>>     need -lpthread.
>>
>>   - Other build fixes on AIX.
>>
>> > Yes, GCC should configure the in tree gettext with --disable-threads, but
>> > that configure option is not completely effective and does not produce a
>> > build without threads references.
>>
>> Now it is effective. But you (Arsen) should state in the documentation
>> (gcc/doc/install.texi) that for --disable-threads to have this effect,
>> one needs gettext version 0.22.4 or newer.
>>
>
> So the question is do we want to change GCC on AIX to always link against
> pthreads so that GCC can build with default, external builds of gettext
> libintl.  I don't see a path for i18n support to work for GCC on AIX
> without that unfortunate change.

Well, if detectable by the build system for, I imagine we could avoid
pthread if gettext is built without them.  With the 'private' gettext
build, we should never need threads anyway.

P.S: Building on AIX is nearly successful.  gettext-0.22.4 builds, twice
or even thrice, but ends up producing a bootstrap comparison fail:

  make[3]: Leaving directory '/home/arsen/build'
  Comparing stages 2 and 3
  Bootstrap comparison failure!
  gettext/libasprintf/autosprintf.o differs
  make[2]: *** [Makefile:23435: compare] Error 1

Upon inspecting these files, I see the following diff:

~ 1 $ git diff <(objdump --all-headers autosprintf.o2) <(objdump --all-headers autosprintf.o3)
diff --git a/dev/fd/63 b/dev/fd/62
--- a/dev/fd/63
+++ b/dev/fd/62
...
@@ -92,7 +92,7 @@ AUX indx   30 prmhsh 0 snhsh 0 typ 2 algn 0 clss 0 stb 0 snstb 0
 AUX val    23 prmhsh 0 snhsh 0 typ 1 algn 4 clss 1 stb 0 snstb 0
 [ 58](sec  1)(fl 0x00)(ty    0)(scl 107) (nx 1) 0x00000460 _autosprintf.ro_
 AUX val   312 prmhsh 0 snhsh 0 typ 1 algn 4 clss 1 stb 0 snstb 0
-[ 60](sec  1)(fl 0x00)(ty    0)(scl   2) (nx 1) 0x00000460 _GLOBAL__F_.._.._.._gcc_gettext_gettext_runtime_libasprintf_autosprintf.cc_DFF67DD7_0xa20d51b1d7a1772f
+[ 60](sec  1)(fl 0x00)(ty    0)(scl   2) (nx 1) 0x00000460 _GLOBAL__F_.._.._.._gcc_gettext_gettext_runtime_libasprintf_autosprintf.cc_DFF67DD7_0x9c04058e89d7a7a4
 AUX indx   58 prmhsh 0 snhsh 0 typ 2 algn 0 clss 1 stb 0 snstb 0
 [ 62](sec  2)(fl 0x00)(ty    0)(scl 107) (nx 1) 0x000005a0 _autosprintf.rw_
 AUX val     0 prmhsh 0 snhsh 0 typ 1 algn 4 clss 5 stb 0 snstb 0

I am unsure what this symbol is.  It does not appear in the stripped
binary.
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-20 21:18                                   ` Arsen Arsenović
@ 2023-11-20 21:38                                     ` David Edelsohn
  2023-11-21  0:44                                       ` Arsen Arsenović
  2023-11-20 23:00                                     ` Bruno Haible
  1 sibling, 1 reply; 60+ messages in thread
From: David Edelsohn @ 2023-11-20 21:38 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: Bruno Haible, Richard Biener, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 3842 bytes --]

_GLOBAL__F_xxx is the EH frame data.

It's using the filename with full path for the unique name, which is why it
includes .._.._.. .  Apparently it is adding a random number as well for
uniqueness.  I guess that this is the downside of building in tree, and
apparently it is rebuilding gettext itself with the different stages of the
compiler, so the appended random number changes.

Thanks, David


On Mon, Nov 20, 2023 at 4:23 PM Arsen Arsenović <arsen@aarsen.me> wrote:

>
> David Edelsohn <dje.gcc@gmail.com> writes:
>
> > On Sun, Nov 19, 2023 at 5:15 PM Bruno Haible <bruno@clisp.org> wrote:
> >
> >> David Edelsohn wrote:
> >> > --disable-threads currently does not completely disable threads.
> Bruno
> >> is
> >> > suggesting --enable-threads=isoc that relies on mtx mutex functions in
> >> libc.
> >>
> >> Unfortunately, as said in the other mail today, relying only on mtx_*
> >> functions
> >> did not drop the dependency towards libpthreads.
> >>
> >> So, I've made a new release gettext-0.22.4, that includes only these
> >> changes:
> >>
> >>   - AM_GNU_GETTEXT now recognizes a statically built libintl on macOS
> and
> >> AIX.
> >>
> >>   - Passing --disable-threads now builds a libintl that, on AIX, does
> not
> >>     need -lpthread.
> >>
> >>   - Other build fixes on AIX.
> >>
> >> > Yes, GCC should configure the in tree gettext with --disable-threads,
> but
> >> > that configure option is not completely effective and does not
> produce a
> >> > build without threads references.
> >>
> >> Now it is effective. But you (Arsen) should state in the documentation
> >> (gcc/doc/install.texi) that for --disable-threads to have this effect,
> >> one needs gettext version 0.22.4 or newer.
> >>
> >
> > So the question is do we want to change GCC on AIX to always link against
> > pthreads so that GCC can build with default, external builds of gettext
> > libintl.  I don't see a path for i18n support to work for GCC on AIX
> > without that unfortunate change.
>
> Well, if detectable by the build system for, I imagine we could avoid
> pthread if gettext is built without them.  With the 'private' gettext
> build, we should never need threads anyway.
>
> P.S: Building on AIX is nearly successful.  gettext-0.22.4 builds, twice
> or even thrice, but ends up producing a bootstrap comparison fail:
>
>   make[3]: Leaving directory '/home/arsen/build'
>   Comparing stages 2 and 3
>   Bootstrap comparison failure!
>   gettext/libasprintf/autosprintf.o differs
>   make[2]: *** [Makefile:23435: compare] Error 1
>
> Upon inspecting these files, I see the following diff:
>
> ~ 1 $ git diff <(objdump --all-headers autosprintf.o2) <(objdump
> --all-headers autosprintf.o3)
> diff --git a/dev/fd/63 b/dev/fd/62
> --- a/dev/fd/63
> +++ b/dev/fd/62
> ...
> @@ -92,7 +92,7 @@ AUX indx   30 prmhsh 0 snhsh 0 typ 2 algn 0 clss 0 stb 0
> snstb 0
>  AUX val    23 prmhsh 0 snhsh 0 typ 1 algn 4 clss 1 stb 0 snstb 0
>  [ 58](sec  1)(fl 0x00)(ty    0)(scl 107) (nx 1) 0x00000460
> _autosprintf.ro_
>  AUX val   312 prmhsh 0 snhsh 0 typ 1 algn 4 clss 1 stb 0 snstb 0
> -[ 60](sec  1)(fl 0x00)(ty    0)(scl   2) (nx 1) 0x00000460
> _GLOBAL__F_.._.._.._gcc_gettext_gettext_runtime_libasprintf_autosprintf.cc_DFF67DD7_0xa20d51b1d7a1772f
> +[ 60](sec  1)(fl 0x00)(ty    0)(scl   2) (nx 1) 0x00000460
> _GLOBAL__F_.._.._.._gcc_gettext_gettext_runtime_libasprintf_autosprintf.cc_DFF67DD7_0x9c04058e89d7a7a4
>  AUX indx   58 prmhsh 0 snhsh 0 typ 2 algn 0 clss 1 stb 0 snstb 0
>  [ 62](sec  2)(fl 0x00)(ty    0)(scl 107) (nx 1) 0x000005a0
> _autosprintf.rw_
>  AUX val     0 prmhsh 0 snhsh 0 typ 1 algn 4 clss 5 stb 0 snstb 0
>
> I am unsure what this symbol is.  It does not appear in the stripped
> binary.
> --
> Arsen Arsenović
>

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-20 21:18                                   ` Arsen Arsenović
  2023-11-20 21:38                                     ` David Edelsohn
@ 2023-11-20 23:00                                     ` Bruno Haible
  2023-11-21  0:45                                       ` Arsen Arsenović
  1 sibling, 1 reply; 60+ messages in thread
From: Bruno Haible @ 2023-11-20 23:00 UTC (permalink / raw)
  To: David Edelsohn, Arsen Arsenović; +Cc: Richard Biener, gcc-patches

Arsen Arsenović wrote:
>   Comparing stages 2 and 3
>   Bootstrap comparison failure!
>   gettext/libasprintf/autosprintf.o differs
>   make[2]: *** [Makefile:23435: compare] Error 1

You should be able to work around this by passing the additional option
--disable-libasprintf to gettext-runtime/configure. Nothing in GCC needs
libasprintf; therefore there is no need to build it.

And while at it, I would also pass --disable-java and --disable-csharp.

Bruno




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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-20 21:38                                     ` David Edelsohn
@ 2023-11-21  0:44                                       ` Arsen Arsenović
  0 siblings, 0 replies; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-21  0:44 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Bruno Haible, Richard Biener, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 4182 bytes --]


David Edelsohn <dje.gcc@gmail.com> writes:

> _GLOBAL__F_xxx is the EH frame data.
>
> It's using the filename with full path for the unique name, which is why it
> includes .._.._.. .  Apparently it is adding a random number as well for
> uniqueness.  I guess that this is the downside of building in tree, and
> apparently it is rebuilding gettext itself with the different stages of the
> compiler, so the appended random number changes.

Jakub pointed me to -frandom-seed=, which stabilized this, it'd seem.
Running a clean build to test (hacking an existing one worked).

Will report back.

> Thanks, David
>
>
> On Mon, Nov 20, 2023 at 4:23 PM Arsen Arsenović <arsen@aarsen.me> wrote:
>
>>
>> David Edelsohn <dje.gcc@gmail.com> writes:
>>
>> > On Sun, Nov 19, 2023 at 5:15 PM Bruno Haible <bruno@clisp.org> wrote:
>> >
>> >> David Edelsohn wrote:
>> >> > --disable-threads currently does not completely disable threads.
>> Bruno
>> >> is
>> >> > suggesting --enable-threads=isoc that relies on mtx mutex functions in
>> >> libc.
>> >>
>> >> Unfortunately, as said in the other mail today, relying only on mtx_*
>> >> functions
>> >> did not drop the dependency towards libpthreads.
>> >>
>> >> So, I've made a new release gettext-0.22.4, that includes only these
>> >> changes:
>> >>
>> >>   - AM_GNU_GETTEXT now recognizes a statically built libintl on macOS
>> and
>> >> AIX.
>> >>
>> >>   - Passing --disable-threads now builds a libintl that, on AIX, does
>> not
>> >>     need -lpthread.
>> >>
>> >>   - Other build fixes on AIX.
>> >>
>> >> > Yes, GCC should configure the in tree gettext with --disable-threads,
>> but
>> >> > that configure option is not completely effective and does not
>> produce a
>> >> > build without threads references.
>> >>
>> >> Now it is effective. But you (Arsen) should state in the documentation
>> >> (gcc/doc/install.texi) that for --disable-threads to have this effect,
>> >> one needs gettext version 0.22.4 or newer.
>> >>
>> >
>> > So the question is do we want to change GCC on AIX to always link against
>> > pthreads so that GCC can build with default, external builds of gettext
>> > libintl.  I don't see a path for i18n support to work for GCC on AIX
>> > without that unfortunate change.
>>
>> Well, if detectable by the build system for, I imagine we could avoid
>> pthread if gettext is built without them.  With the 'private' gettext
>> build, we should never need threads anyway.
>>
>> P.S: Building on AIX is nearly successful.  gettext-0.22.4 builds, twice
>> or even thrice, but ends up producing a bootstrap comparison fail:
>>
>>   make[3]: Leaving directory '/home/arsen/build'
>>   Comparing stages 2 and 3
>>   Bootstrap comparison failure!
>>   gettext/libasprintf/autosprintf.o differs
>>   make[2]: *** [Makefile:23435: compare] Error 1
>>
>> Upon inspecting these files, I see the following diff:
>>
>> ~ 1 $ git diff <(objdump --all-headers autosprintf.o2) <(objdump
>> --all-headers autosprintf.o3)
>> diff --git a/dev/fd/63 b/dev/fd/62
>> --- a/dev/fd/63
>> +++ b/dev/fd/62
>> ...
>> @@ -92,7 +92,7 @@ AUX indx   30 prmhsh 0 snhsh 0 typ 2 algn 0 clss 0 stb 0
>> snstb 0
>>  AUX val    23 prmhsh 0 snhsh 0 typ 1 algn 4 clss 1 stb 0 snstb 0
>>  [ 58](sec  1)(fl 0x00)(ty    0)(scl 107) (nx 1) 0x00000460
>> _autosprintf.ro_
>>  AUX val   312 prmhsh 0 snhsh 0 typ 1 algn 4 clss 1 stb 0 snstb 0
>> -[ 60](sec  1)(fl 0x00)(ty    0)(scl   2) (nx 1) 0x00000460
>> _GLOBAL__F_.._.._.._gcc_gettext_gettext_runtime_libasprintf_autosprintf.cc_DFF67DD7_0xa20d51b1d7a1772f
>> +[ 60](sec  1)(fl 0x00)(ty    0)(scl   2) (nx 1) 0x00000460
>> _GLOBAL__F_.._.._.._gcc_gettext_gettext_runtime_libasprintf_autosprintf.cc_DFF67DD7_0x9c04058e89d7a7a4
>>  AUX indx   58 prmhsh 0 snhsh 0 typ 2 algn 0 clss 1 stb 0 snstb 0
>>  [ 62](sec  2)(fl 0x00)(ty    0)(scl 107) (nx 1) 0x000005a0
>> _autosprintf.rw_
>>  AUX val     0 prmhsh 0 snhsh 0 typ 1 algn 4 clss 5 stb 0 snstb 0
>>
>> I am unsure what this symbol is.  It does not appear in the stripped
>> binary.
>> --
>> Arsen Arsenović
>>


-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-20 23:00                                     ` Bruno Haible
@ 2023-11-21  0:45                                       ` Arsen Arsenović
  2023-11-21 13:13                                         ` Arsen Arsenović
  0 siblings, 1 reply; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-21  0:45 UTC (permalink / raw)
  To: Bruno Haible; +Cc: David Edelsohn, Richard Biener, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]


Bruno Haible <bruno@clisp.org> writes:

> Arsen Arsenović wrote:
>>   Comparing stages 2 and 3
>>   Bootstrap comparison failure!
>>   gettext/libasprintf/autosprintf.o differs
>>   make[2]: *** [Makefile:23435: compare] Error 1
>
> You should be able to work around this by passing the additional option
> --disable-libasprintf to gettext-runtime/configure. Nothing in GCC needs
> libasprintf; therefore there is no need to build it.

Ah, sure, that works for me too (note that the fix is to pass
-frandom-seed=, according to Jakub, should this show up again).

> And while at it, I would also pass --disable-java and --disable-csharp.

Yes, I noticed those and disabled them already.

> Bruno


-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-21  0:45                                       ` Arsen Arsenović
@ 2023-11-21 13:13                                         ` Arsen Arsenović
  2023-11-21 16:28                                           ` David Edelsohn
  2023-11-21 20:58                                           ` Eric Gallager
  0 siblings, 2 replies; 60+ messages in thread
From: Arsen Arsenović @ 2023-11-21 13:13 UTC (permalink / raw)
  To: Arsen Arsenović
  Cc: Bruno Haible, David Edelsohn, Richard Biener, gcc-patches, Eric Gallager


[-- Attachment #1.1: Type: text/plain, Size: 1021 bytes --]


Arsen Arsenović <arsen@aarsen.me> writes:

> Bruno Haible <bruno@clisp.org> writes:
>
>> Arsen Arsenović wrote:
>>>   Comparing stages 2 and 3
>>>   Bootstrap comparison failure!
>>>   gettext/libasprintf/autosprintf.o differs
>>>   make[2]: *** [Makefile:23435: compare] Error 1
>>
>> You should be able to work around this by passing the additional option
>> --disable-libasprintf to gettext-runtime/configure. Nothing in GCC needs
>> libasprintf; therefore there is no need to build it.
>
> Ah, sure, that works for me too (note that the fix is to pass
> -frandom-seed=, according to Jakub, should this show up again).

Indeed, that got a bootstrap to pass.  I've also taken the opportunity
to check the problems Eric Gallager reported.  The install tree seems
clean now, and the info et al targets appear to work again.  David,
Eric, could you check whether the attached patch works for you in the
scenarios you ran into problems with?  Make sure to fetch gettext-0.22.4
into your trees.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: [PATCH] gettext: disable install, docs targets, libasprintf, threads --]
[-- Type: text/x-patch, Size: 14982 bytes --]

From d0f8b623f9720947b805d71c05a5d6a638daefb8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= <arsen@aarsen.me>
Date: Thu, 16 Nov 2023 23:50:30 +0100
Subject: [PATCH] gettext: disable install, docs targets, libasprintf, threads

This fixes issues reported by David Edelsohn <dje.gcc@gmail.com>, and by
Eric Gallager <egallager@gcc.gnu.org>.

ChangeLog:

	* Makefile.def (gettext): Disable (via missing)
	{install-,}{pdf,html,info,dvi} and TAGS targets.  Set no_install
	to true.  Add --disable-threads --disable-libasprintf.
	* Makefile.in: Regenerate.
---
 Makefile.def |  13 +++-
 Makefile.in  | 202 ++++++++-------------------------------------------
 2 files changed, 40 insertions(+), 175 deletions(-)

diff --git a/Makefile.def b/Makefile.def
index 792f81447e1b..6b03deb49506 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -80,8 +80,17 @@ host_modules= { module= gettext; bootstrap=true; no_install=true;
 		// need it in some configuratons, which is determined via nontrivial tests.
 		// Always enabling pic seems to make sense for something tied to
 		// user-facing output.
-                extra_configure_flags='--disable-shared --disable-java --disable-csharp --with-pic';
-                lib_path=intl/.libs; };
+                extra_configure_flags='--disable-shared --disable-threads --disable-java --disable-csharp --with-pic --disable-libasprintf';
+		missing= pdf;
+		missing= html;
+		missing= info;
+		missing= dvi;
+		missing= install-pdf;
+		missing= install-html;
+		missing= install-info;
+		missing= install-dvi;
+		missing= TAGS;
+		no_install= true;};
 host_modules= { module= tcl;
                 missing=mostlyclean; };
 host_modules= { module= itcl; };
diff --git a/Makefile.in b/Makefile.in
index da2344b3f3dc..3bd7d37e9605 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -768,7 +768,7 @@ TARGET_LIB_PATH_libatomic = $$r/$(TARGET_SUBDIR)/libatomic/.libs:
 
 # This is the list of directories that may be needed in RPATH_ENVVAR
 # so that programs built for the host machine work.
-HOST_LIB_PATH = $(HOST_LIB_PATH_gmp)$(HOST_LIB_PATH_mpfr)$(HOST_LIB_PATH_mpc)$(HOST_LIB_PATH_isl)$(HOST_LIB_PATH_gettext)
+HOST_LIB_PATH = $(HOST_LIB_PATH_gmp)$(HOST_LIB_PATH_mpfr)$(HOST_LIB_PATH_mpc)$(HOST_LIB_PATH_isl)
 
 # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
 @if gcc
@@ -796,11 +796,6 @@ HOST_LIB_PATH_isl = \
   $$r/$(HOST_SUBDIR)/isl/.libs:$$r/$(HOST_SUBDIR)/prev-isl/.libs:
 @endif isl
 
-@if gettext
-HOST_LIB_PATH_gettext = \
-  $$r/$(HOST_SUBDIR)/gettext/intl/.libs:$$r/$(HOST_SUBDIR)/prev-gettext/intl/.libs:
-@endif gettext
-
 
 CXX_FOR_TARGET_FLAG_TO_PASS = \
 	"CXX_FOR_TARGET=$(CXX_FOR_TARGET)"
@@ -19827,7 +19822,7 @@ configure-gettext:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=${target_alias} --disable-shared --disable-java --disable-csharp --with-pic \
+	  --target=${target_alias} --disable-shared --disable-threads --disable-java --disable-csharp --with-pic --disable-libasprintf \
 	  || exit 1
 @endif gettext
 
@@ -19863,7 +19858,7 @@ configure-stage1-gettext:
 	  --target=${target_alias} \
 	   \
 	  $(STAGE1_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic --disable-libasprintf
 @endif gettext-bootstrap
 
 .PHONY: configure-stage2-gettext maybe-configure-stage2-gettext
@@ -19897,7 +19892,7 @@ configure-stage2-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGE2_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic --disable-libasprintf
 @endif gettext-bootstrap
 
 .PHONY: configure-stage3-gettext maybe-configure-stage3-gettext
@@ -19931,7 +19926,7 @@ configure-stage3-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGE3_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic --disable-libasprintf
 @endif gettext-bootstrap
 
 .PHONY: configure-stage4-gettext maybe-configure-stage4-gettext
@@ -19965,7 +19960,7 @@ configure-stage4-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGE4_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic --disable-libasprintf
 @endif gettext-bootstrap
 
 .PHONY: configure-stageprofile-gettext maybe-configure-stageprofile-gettext
@@ -19999,7 +19994,7 @@ configure-stageprofile-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGEprofile_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic --disable-libasprintf
 @endif gettext-bootstrap
 
 .PHONY: configure-stagetrain-gettext maybe-configure-stagetrain-gettext
@@ -20033,7 +20028,7 @@ configure-stagetrain-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGEtrain_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic --disable-libasprintf
 @endif gettext-bootstrap
 
 .PHONY: configure-stagefeedback-gettext maybe-configure-stagefeedback-gettext
@@ -20067,7 +20062,7 @@ configure-stagefeedback-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGEfeedback_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic --disable-libasprintf
 @endif gettext-bootstrap
 
 .PHONY: configure-stageautoprofile-gettext maybe-configure-stageautoprofile-gettext
@@ -20101,7 +20096,7 @@ configure-stageautoprofile-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGEautoprofile_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic --disable-libasprintf
 @endif gettext-bootstrap
 
 .PHONY: configure-stageautofeedback-gettext maybe-configure-stageautofeedback-gettext
@@ -20135,7 +20130,7 @@ configure-stageautofeedback-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGEautofeedback_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic --disable-libasprintf
 @endif gettext-bootstrap
 
 
@@ -20592,23 +20587,8 @@ maybe-info-gettext:
 @if gettext
 maybe-info-gettext: info-gettext
 
-info-gettext: \
-    configure-gettext 
-	@[ -f ./gettext/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing info in gettext"; \
-	(cd $(HOST_SUBDIR)/gettext && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          info) \
-	  || exit 1
+# gettext doesn't support info.
+info-gettext:
 
 @endif gettext
 
@@ -20617,23 +20597,8 @@ maybe-dvi-gettext:
 @if gettext
 maybe-dvi-gettext: dvi-gettext
 
-dvi-gettext: \
-    configure-gettext 
-	@[ -f ./gettext/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing dvi in gettext"; \
-	(cd $(HOST_SUBDIR)/gettext && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          dvi) \
-	  || exit 1
+# gettext doesn't support dvi.
+dvi-gettext:
 
 @endif gettext
 
@@ -20642,23 +20607,8 @@ maybe-pdf-gettext:
 @if gettext
 maybe-pdf-gettext: pdf-gettext
 
-pdf-gettext: \
-    configure-gettext 
-	@[ -f ./gettext/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing pdf in gettext"; \
-	(cd $(HOST_SUBDIR)/gettext && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          pdf) \
-	  || exit 1
+# gettext doesn't support pdf.
+pdf-gettext:
 
 @endif gettext
 
@@ -20667,23 +20617,8 @@ maybe-html-gettext:
 @if gettext
 maybe-html-gettext: html-gettext
 
-html-gettext: \
-    configure-gettext 
-	@[ -f ./gettext/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing html in gettext"; \
-	(cd $(HOST_SUBDIR)/gettext && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          html) \
-	  || exit 1
+# gettext doesn't support html.
+html-gettext:
 
 @endif gettext
 
@@ -20692,23 +20627,8 @@ maybe-TAGS-gettext:
 @if gettext
 maybe-TAGS-gettext: TAGS-gettext
 
-TAGS-gettext: \
-    configure-gettext 
-	@[ -f ./gettext/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing TAGS in gettext"; \
-	(cd $(HOST_SUBDIR)/gettext && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          TAGS) \
-	  || exit 1
+# gettext doesn't support TAGS.
+TAGS-gettext:
 
 @endif gettext
 
@@ -20717,24 +20637,8 @@ maybe-install-info-gettext:
 @if gettext
 maybe-install-info-gettext: install-info-gettext
 
-install-info-gettext: \
-    configure-gettext \
-    info-gettext 
-	@[ -f ./gettext/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing install-info in gettext"; \
-	(cd $(HOST_SUBDIR)/gettext && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          install-info) \
-	  || exit 1
+# gettext doesn't support install-info.
+install-info-gettext:
 
 @endif gettext
 
@@ -20743,24 +20647,8 @@ maybe-install-dvi-gettext:
 @if gettext
 maybe-install-dvi-gettext: install-dvi-gettext
 
-install-dvi-gettext: \
-    configure-gettext \
-    dvi-gettext 
-	@[ -f ./gettext/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing install-dvi in gettext"; \
-	(cd $(HOST_SUBDIR)/gettext && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          install-dvi) \
-	  || exit 1
+# gettext doesn't support install-dvi.
+install-dvi-gettext:
 
 @endif gettext
 
@@ -20769,24 +20657,8 @@ maybe-install-pdf-gettext:
 @if gettext
 maybe-install-pdf-gettext: install-pdf-gettext
 
-install-pdf-gettext: \
-    configure-gettext \
-    pdf-gettext 
-	@[ -f ./gettext/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing install-pdf in gettext"; \
-	(cd $(HOST_SUBDIR)/gettext && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          install-pdf) \
-	  || exit 1
+# gettext doesn't support install-pdf.
+install-pdf-gettext:
 
 @endif gettext
 
@@ -20795,24 +20667,8 @@ maybe-install-html-gettext:
 @if gettext
 maybe-install-html-gettext: install-html-gettext
 
-install-html-gettext: \
-    configure-gettext \
-    html-gettext 
-	@[ -f ./gettext/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing install-html in gettext"; \
-	(cd $(HOST_SUBDIR)/gettext && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          install-html) \
-	  || exit 1
+# gettext doesn't support install-html.
+install-html-gettext:
 
 @endif gettext
 
-- 
2.42.1


[-- Attachment #1.3: Type: text/plain, Size: 300 bytes --]


If these work, I'll update download_prerequisites and see about posting
the patch for review.

Thanks, have a lovely day.

>> And while at it, I would also pass --disable-java and --disable-csharp.
>
> Yes, I noticed those and disabled them already.
>
>> Bruno


-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-21 13:13                                         ` Arsen Arsenović
@ 2023-11-21 16:28                                           ` David Edelsohn
  2023-11-21 20:58                                           ` Eric Gallager
  1 sibling, 0 replies; 60+ messages in thread
From: David Edelsohn @ 2023-11-21 16:28 UTC (permalink / raw)
  To: Arsen Arsenović
  Cc: Bruno Haible, Richard Biener, gcc-patches, Eric Gallager

[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]

On Tue, Nov 21, 2023 at 8:51 AM Arsen Arsenović <arsen@aarsen.me> wrote:

>
> Arsen Arsenović <arsen@aarsen.me> writes:
>
> > Bruno Haible <bruno@clisp.org> writes:
> >
> >> Arsen Arsenović wrote:
> >>>   Comparing stages 2 and 3
> >>>   Bootstrap comparison failure!
> >>>   gettext/libasprintf/autosprintf.o differs
> >>>   make[2]: *** [Makefile:23435: compare] Error 1
> >>
> >> You should be able to work around this by passing the additional option
> >> --disable-libasprintf to gettext-runtime/configure. Nothing in GCC needs
> >> libasprintf; therefore there is no need to build it.
> >
> > Ah, sure, that works for me too (note that the fix is to pass
> > -frandom-seed=, according to Jakub, should this show up again).
>
> Indeed, that got a bootstrap to pass.  I've also taken the opportunity
> to check the problems Eric Gallager reported.  The install tree seems
> clean now, and the info et al targets appear to work again.  David,
> Eric, could you check whether the attached patch works for you in the
> scenarios you ran into problems with?  Make sure to fetch gettext-0.22.4
> into your trees.
>
>
> If these work, I'll update download_prerequisites and see about posting
> the patch for review.
>
> Thanks, have a lovely day.
>

I don't build in tree, but the patch seems to address the previous issues.

Thanks, David

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

* Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext
  2023-11-21 13:13                                         ` Arsen Arsenović
  2023-11-21 16:28                                           ` David Edelsohn
@ 2023-11-21 20:58                                           ` Eric Gallager
  1 sibling, 0 replies; 60+ messages in thread
From: Eric Gallager @ 2023-11-21 20:58 UTC (permalink / raw)
  To: Arsen Arsenović
  Cc: Bruno Haible, David Edelsohn, Richard Biener, gcc-patches

On Tue, Nov 21, 2023 at 8:51 AM Arsen Arsenović <arsen@aarsen.me> wrote:
>
>
> Arsen Arsenović <arsen@aarsen.me> writes:
>
> > Bruno Haible <bruno@clisp.org> writes:
> >
> >> Arsen Arsenović wrote:
> >>>   Comparing stages 2 and 3
> >>>   Bootstrap comparison failure!
> >>>   gettext/libasprintf/autosprintf.o differs
> >>>   make[2]: *** [Makefile:23435: compare] Error 1
> >>
> >> You should be able to work around this by passing the additional option
> >> --disable-libasprintf to gettext-runtime/configure. Nothing in GCC needs
> >> libasprintf; therefore there is no need to build it.
> >
> > Ah, sure, that works for me too (note that the fix is to pass
> > -frandom-seed=, according to Jakub, should this show up again).
>
> Indeed, that got a bootstrap to pass.  I've also taken the opportunity
> to check the problems Eric Gallager reported.  The install tree seems
> clean now, and the info et al targets appear to work again.  David,
> Eric, could you check whether the attached patch works for you in the
> scenarios you ran into problems with?  Make sure to fetch gettext-0.22.4
> into your trees.
>

OK, I can confirm that with this patch, my GitHub Actions CI workflow
that had previously been failing is now passing again; you can see the
results here:
https://github.com/cooljeanius/gcc/actions/runs/6948834515/job/18905670645
...and here's a link to a zip of the logfiles generated from the build:
https://github.com/cooljeanius/gcc/suites/18389727422/artifacts/1065350046

>
> If these work, I'll update download_prerequisites and see about posting
> the patch for review.
>
> Thanks, have a lovely day.
>
> >> And while at it, I would also pass --disable-java and --disable-csharp.
> >
> > Yes, I noticed those and disabled them already.
> >
> >> Bruno
>
>
> --
> Arsen Arsenović

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

end of thread, other threads:[~2023-11-21 20:58 UTC | newest]

Thread overview: 60+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-14 20:37 [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext David Edelsohn
2023-11-14 23:06 ` Arsen Arsenović
2023-11-15  1:49   ` David Edelsohn
2023-11-15 12:29     ` building GNU gettext on AIX Bruno Haible
2023-11-15 19:26       ` David Edelsohn
2023-11-15 21:22         ` Bruno Haible
2023-11-15 21:31           ` David Edelsohn
2023-11-15 22:39             ` Bruno Haible
2023-11-16 16:00               ` David Edelsohn
2023-11-16 16:35                 ` David Edelsohn
2023-11-16 18:01                   ` David Edelsohn
2023-11-16 18:17                     ` David Edelsohn
2023-11-16 18:52                       ` Bruno Haible
2023-11-16 22:18                         ` David Edelsohn
2023-11-16 22:46                           ` Bruno Haible
2023-11-16 23:10                             ` Arsen Arsenović
2023-11-17  8:33                               ` Richard Biener
2023-11-17  8:49                                 ` Arsen Arsenović
2023-11-17 12:24                                 ` Bruno Haible
2023-11-17 13:06                                   ` Arsen Arsenović
2023-11-16 23:38                             ` David Edelsohn
2023-11-17  0:07                               ` Bruno Haible
2023-11-17  0:15                                 ` David Edelsohn
     [not found]                 ` <84B39BF1-33D5-488E-8CF5-D08B09417568@gmail.com>
2023-11-16 17:44                   ` David Edelsohn
2023-11-16 18:47                     ` Bruno Haible
2023-11-16 18:50                       ` Arsen Arsenović
2023-11-16 18:59                         ` Bruno Haible
2023-11-16 19:14                           ` Arsen Arsenović
2023-11-19 19:49                       ` Bruno Haible
2023-11-15 14:14     ` [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext Arsen Arsenović
2023-11-15 15:51       ` Xi Ruoyao
2023-11-16 18:48         ` Arsen Arsenović
2023-11-15 17:19       ` David Edelsohn
2023-11-16 18:33         ` Arsen Arsenović
2023-11-16 21:11           ` Arsen Arsenović
2023-11-16 21:40             ` David Edelsohn
2023-11-16 22:19               ` Arsen Arsenović
2023-11-16 22:30                 ` David Edelsohn
2023-11-16 22:32                   ` Arsen Arsenović
2023-11-16 23:59                     ` David Edelsohn
2023-11-17  8:34                       ` Arsen Arsenović
2023-11-17  8:50                         ` Richard Biener
2023-11-17  8:56                           ` Arsen Arsenović
2023-11-17 14:41                         ` David Edelsohn
2023-11-17 15:16                           ` Arsen Arsenović
2023-11-17 16:07                             ` David Edelsohn
2023-11-18 18:10                               ` Arsen Arsenović
2023-11-19 21:55                               ` Bruno Haible
2023-11-19 23:00                                 ` Bruno Haible
2023-11-19 23:06                                   ` Andrew Pinski
2023-11-20  1:17                                 ` David Edelsohn
2023-11-20 21:18                                   ` Arsen Arsenović
2023-11-20 21:38                                     ` David Edelsohn
2023-11-21  0:44                                       ` Arsen Arsenović
2023-11-20 23:00                                     ` Bruno Haible
2023-11-21  0:45                                       ` Arsen Arsenović
2023-11-21 13:13                                         ` Arsen Arsenović
2023-11-21 16:28                                           ` David Edelsohn
2023-11-21 20:58                                           ` Eric Gallager
2023-11-15 19:58       ` David Edelsohn

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).