Re: libgnu.a inside libgroff.a

"G. Branden Robinson" <[email protected]>
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.comp.printing.groff.general
Message-ID <20260121091341.ifrtxkcxvz3zaqxr@illithid>
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
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAmlwmLwACgkQ0Z6cfXEm
bc51QA/+MoRcxCuJuWObv4VvVWlxk7iyjRr7Sqy90HofbLU4v2F5bMX9vGijsNMM
zD2xHT0m4Fl24LzkG92CTzxMYjP9924fv5FOGFxtaMBitsBTTm4who1q6MaTIfTR
qDPzr9zXIBRZV4o1Io5lgXeeXp1DuY0tTdr56PZSA+kUmizFFRReIAAXmtBfjSMT
tNDLqD4O3g9+ymleDgyAbQUTvQXdFlyN77O0ppUCctscBVySafXHPC7OQK9bb1bP
8byE6GyDIxpM+dd1/lDNQr9PJ0fasymr790KtYg3B6IzkfNVTZPJsvNLXILTsONe
TKhiMLkMnHDlQWafNxgeCTZr/FRxUB19fWKRxheuRc24QJRMLeSXZhkRS0p4pJfw
FWskCbujQiOc3ptU6EliKTANFVzv3K+3Hq6vf8ooYoyIGJiLtc+xsCI3O1qS8YED
AUECpcGhmt7JIB1oIFxsQBmYiehjGFu7fWOOubPPQ3ddpkJuXT0EbtqMjblAOtcg
5ksQWBSwVZUOY/KBvCGdr0wV9EpMV++nEX18voIoIwaAsbWM9YN8RBgrW0WQuiem
UnHz/i/Yc8WRbC6AhJxAXRODGSaeJ0UgX+h+UFGQE8aO/43dWBQOaFo7VVwomH2F
801o7AFsbuzKvmlVGYul3VRrFmGkRsG9WwV6mIXCSdcWm6zFfS8=
=bA7z
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.