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

> On Fri, Nov 17, 2023 at 10:17 AM Arsen Arsenović <ar...@aarsen.me> wrote:
>
>>
>> David Edelsohn <dje....@gmail.com> writes:
>>
>> > On Fri, Nov 17, 2023 at 3:46 AM Arsen Arsenović <ar...@aarsen.me> wrote:
>> >
>> >>
>> >> David Edelsohn <dje....@gmail.com> writes:
>> >>
>> >> > On Thu, Nov 16, 2023 at 5:52 PM Arsen Arsenović <ar...@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: signature.asc
Description: PGP signature

Reply via email to