Hi Bruno,

At 2026-01-20T08:27:29+0100, Bruno Haible wrote:
> G. Branden Robinson wrote:
> > I don't have any idea what to do about this.  This part of a groff
> > build is thoroughly dedicated to gnulib.
> > 
> > gnulib mavens, can you help?  groff is largely a C++ project.
> 
> This has nothing to do with C++.

I mentioned that only because groff seems to be rare as a project in
using both C++ and gnulib, gnulib developers besides yourself have more
than once remarked on the fact, and the choice of C++ as an
implementation language can have an impact on linking.

> Simply, a .a file that is passed to the linker is supposed to hold .o
> files only. On FreeBSD 15, I see a warning:
> 
>   CXXLD    grodvi
> ld: warning: libgroff.a: archive member 'libgnu.a' is neither ET_REL nor LLVM 
> bitcode
> 
> With the GNU linker, the member libgnu.a of libgroff.a is simply ignored.

So LLVM's linker was validly complaining.  I think GNU ld should too.

I guess I know the way to the bug-binutils mailing list.  Unless someone
happens to know if I have to register on Sourceware's Bugzilla and
report issues there?

> And on macOS, as reported by Nelson, the linker produces an error.

Yes.  I see the same diagnostic using Termux on my Android tablet.  I
had assumed (wrongly) that it was spurious.

> The problem is this line in src/libs/libgroff/libgroff.am:
>   libgroff_a_LIBADD = lib/libgnu.a

This is my fault.  I added this to surmount a Solaris 10 build problem.

https://cgit.git.savannah.gnu.org/cgit/groff.git/commit/?id=0d0dd80a786da13d33d19757441638efd36a427d

> Therefore you have three options:
> 
> (a) Remove said line, and use lib/libgnu.a everywhere where linking
>     with libgroff.a occurs. groff's *.am files already do this. So,
>     only the patch below needs to be applied.
> 
> (b) Unpack the contents of libgnu.a when creating libgroff.a. A
> Makefile rule for combining two archives roughly goes like this:
> 
>                  objects=`$(AR) t lib1.a`" "`$(AR) t lib2.a` && \
>                  $(AR) x lib1.a && $(AR) x lib2.a && \
>                  $(AR) q libboth.a $$objects && \
>                  rm -f $$objects
> 
> (c) Start to use libtool. Use libgroff.la instead of libgroff.a. Use
> lib/libgnu.la instead of lib/libgnu.a. Then you can have
> 
>       libgroff_la_LIBADD = lib/libgnu.la
> 
>     And configure libtool to create static libraries only.
> 
> The simplest solution is (a), which is what I would recommend.

I concur.  It sounds easiest (though (b) isn't all that terrible).

What lies behind door #3 scares me to death.

Thanks for the patch!  Expect it in my next push.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature

Reply via email to