pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: difficulties combining ccache with cwrappers



On Sun, Mar 20, 2016 at 08:50:44PM -0400, Greg Troxel wrote:
> 
> Matthias Ferdinand <mf+ml.pkgsrc-users%netzwerkagentursaarland.de@localhost>
> writes:
> 
> > If I use
> >
> >   GCC_REQD=4.7
> >   USE_CWRAPPERS=yes
> >   PKGSRC_COMPILER=        ccache gcc
> >
> > I end up with the system compiler being used (gcc 4.0.3), although
> > $WRKDIR/.gcc/bin/gcc symlinks to /opt/pkgsrc/gcc47/bin/gcc. clamav does
> > not build with 4.0.3.
> >
> > no ccache, no cwrappers:    gcc 4.7.4
> > just ccache, no cwrappers:  gcc 4.7.4
> > no ccache, just cwrappers:  gcc 4.7.4
> > ccache + cwrappers:         gcc 4.0.3
> 
> That looks like a bug in either cwrappers or a latent bug in ccache
> code that triggered by cwrappers.  I would set PKG_DEBUG_LEVEL=1 (or
> maybe 2) and capture the output, and try to find where the links are
> created and trace it down.
> 
> I suspect most peopel are building with their native compiler and don't
> notice, because at first glance this bug seems to be only when system
> gcc and chosen gcc differ.


Looks like cwrapper is stripping away too much from $PATH.

bmake starts with this:
PATH=/opt/pkgsrc/work/pkgsrc/security/clamav/default/.cwrapper/bin:/opt/pkgsrc/work/pkgsrc/security/clamav/default/.buildlink/bin:/opt/pkgsrc/work/pkgsrc/security/clamav/default/.ccache/bin:/opt/pkgsrc/work/pkgsrc/security/clamav/default/.gcc/bin:/opt/pkgsrc/work/pkgsrc/security/clamav/default/.tools/bin:/opt/pkgsrc/bin:/opt/pkgsrc/bin:/opt/pkgsrc/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11

Invoking gcc proceeds like this:

    (1)       gcc
    (2)   => .cwrapper/bin/cc
    (3)   => .ccache/bin/gcc
    (4)   => /usr/bin/gcc  (instead of /opt/pkgsrc/gcc47/bin/gcc)

at (2), cwrapper sets a new and very much reduced $PATH from .cwrapper/config/cc:
    path=/opt/pkgsrc/bin:/opt/pkgsrc/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11

This is done in target "generate-cwrappers" in
/opt/pkgsrc/usr/pkgsrc/mk/cwrappers.mk, line 70:
        ${RUN}case ${wrappee} in *libtool) ;; *) echo path=${_PATH_ORIG:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}};; esac


The new $PATH skips the compiler symlinks in .gcc/bin/, whereas the
shell-based default wrappers don't seem to do that.

If I manually re-insert
    /opt/pkgsrc/work/pkgsrc/security/clamav/default/.gcc/bin
in .cwrapper/config/cc after doing "bmake wrapper", "bmake" succeeds. 

Guessing $PATH is being reduced in order to avoid loops, I think it
would be sufficient to just strip away the ".cwrapper/bin" part. Don't
know how to achieve this, though.


Regards
Matthias


Home | Main Index | Thread Index | Old Index