Sunday, September 03, 2023

Re: check-lib-depends and modules' *_WANTLIB

On 2023/09/03 12:07:27 +0200, Sebastien Marie <semarie@online.fr> wrote:
> On Sun, Sep 03, 2023 at 10:44:51AM +0200, Omar Polo wrote:
> > On 2023/09/03 10:32:00 +0200, Omar Polo <op@omarpolo.com> wrote:
> > > I considered making the variable more like SUBST_VARS (i.e. just a
> > > list of variable names) but then we loose the ability to express -F
> > > which can be handy. Or maybe I'm overthinking it.
> >
> > just as I sent the email I noticed that my cargo.port.mk diff wasn't
> > right. Turns out, -F is really needed :-)
> >
> > with the fixed carg.port.mk diff:
> >
> > % pwd
> > /usr/ports/devel/difftastic
> > % make port-lib-depends-check
> > [...]
> > WANTLIB += ${COMPILER_LIBCXX} ${MODCARGO_WANTLIB} m
> > *** Error 1 in target 'port-lib-depends-check' (ignored)
> >
> >
> > Index: cargo.port.mk
> > ===================================================================
> > RCS file: /home/cvs/ports/devel/cargo/cargo.port.mk,v
> > retrieving revision 1.37
> > diff -u -p -r1.37 cargo.port.mk
> > --- cargo.port.mk 26 Jul 2023 07:56:18 -0000 1.37
> > +++ cargo.port.mk 3 Sep 2023 08:41:42 -0000
> > @@ -36,6 +36,9 @@ MODCARGO_WANTLIB += c++abi
> > MODCARGO_WANTLIB +=
> > .endif
> >
> > +CHECK_LIB_DEPENDS_ARGS += -S MODCARGO_WANTLIB="${MODCARGO_WANTLIB}"
> > +CHECK_LIB_DEPENDS_ARGS += -F pthread -F c++abi
> > +
> > # Define MASTER_SITES_CRATESIO for crates.io
> > MASTER_SITES_CRATESIO = https://crates.io/api/v1/crates/
> >
>
> cargo.port.mk isn't up to date on your side (1.38 was commited ~16h ago).

oops, luckily it should apply nevertheless. (but i've updated my tree.)

> Regarding the diff, I am not sure to be fluent enough with check-lib-depends to
> properly undertand all implications.
>
> About MODCARGO_WANTLIB, it should be noted that the variable exists because the
> content is different accross machine architecture.
>
> The global picture is:
> - sparc64 : MODCARGO_WANTLIB = c pthread
> - others : MODCARGO_WANTLIB = c pthread c++abi
>
> sparc64 is using unwinding code from libgcc.a (versus c++abi for others).
>
> so if I properly understood check-lib-depends(1) man page:
> - -S MODCARGO_WANTLIB="${MODCARGO_WANTLIB}" : is fine
> - -F pthread : shouldn't be needed (as pthread will be always part of the actual WANTLIB for a rust binary)
> - -F c++abi : is fine, as on sparc64 it could be missing

I actually had to had the two -F due to an overlap of MODCARGO_WANTLIB
and COMPILER_LIBCXX:

% make show=COMPILER_LIBCXX
c++ c++abi pthread
% make show=MODCARGO_WANTLIB
c pthread c++abi

so I added -F twice to 'leave' pthread and c++abi out of
MODCARGO_WANTLIB and have them handled in COMPILER_LIBCXX. Without
the two -F check-lib-depends would wrongly suggest:

WANTLIB += ${MODCARGO_WANTLIB} c++ m

However, only -F c++abi seems to be actually needed to get a 'correct'
WANTLIBs:

WANTLIB += ${COMPILER_LIBCXX} ${MODCARGO_WANTLIB} m

I'm not particularly familiar with check-lib-depends either, but sicne
-Fpthread is not useful (nor in theory nor in practice), here's a
simplified diff for cargo.port.mk.


Index: cargo.port.mk
===================================================================
RCS file: /home/cvs/ports/devel/cargo/cargo.port.mk,v
retrieving revision 1.38
diff -u -p -r1.38 cargo.port.mk
--- cargo.port.mk 2 Sep 2023 17:26:36 -0000 1.38
+++ cargo.port.mk 3 Sep 2023 13:19:46 -0000
@@ -36,6 +36,9 @@ MODCARGO_WANTLIB += c++abi
MODCARGO_WANTLIB +=
.endif

+CHECK_LIB_DEPENDS_ARGS += -S MODCARGO_WANTLIB="${MODCARGO_WANTLIB}"
+CHECK_LIB_DEPENDS_ARGS += -F c++abi
+
# Define MASTER_SITES_CRATESIO for crates.io
MASTER_SITES.cargo = https://crates.io/api/v1/crates/

No comments:

Post a Comment