public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: Richard Biener <richard.guenther@gmail.com>,
	David Edelsohn <dje.gcc@gmail.com>
Cc: "Arsen Arsenović" <arsen@aarsen.me>,
	"GCC Patches" <gcc-patches@gcc.gnu.org>,
	bug-gettext@gnu.org
Subject: Re: building GNU gettext on AIX
Date: Sun, 19 Nov 2023 20:49:38 +0100	[thread overview]
Message-ID: <5568430.PTxrJRyG3s@nimes> (raw)
In-Reply-To: <6664645.lMtyQzBqa6@nimes>

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




  parent reply	other threads:[~2023-11-19 19:49 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5568430.PTxrJRyG3s@nimes \
    --to=bruno@clisp.org \
    --cc=arsen@aarsen.me \
    --cc=bug-gettext@gnu.org \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).