tech-pkg archive

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

Re: cwrapper trouble with bup on macOS



On Mon, 16 Jun 2025 08:06:37 -0400
Greg Troxel <gdt%lexort.com@localhost> wrote:

> For a long time I've had trouble building sysutils/bup on macOS with
> cwrappers, and worked around it by USE_CWRAPPERS=no for that package.
> Now, it's failing (differently) under oldwrappers.  Rather than address
> that, it seems better to figure out what is wrong with cwrappers.
> 
> The symptom is bup's configure saying it can't run cpp as a pipeline:
> 
>   Looking for cpp (/opt/pkgsrc/sysutils/bup/work/.cwrapper/bin/cpp) (can't run cpp as a pipeline)
> 
> 
> I then tried to run the wrappers by hand.  cc is fine.  cpp fails.
> /usr/bin/cpp seems fine.
> 
>   $ CWRAPPERS_CONFIG_DIR=work/.cwrapper/config /opt/pkg/libexec/cwrappers/cc-wrapper 
>   clang: error: no input files
> 
>   $ CWRAPPERS_CONFIG_DIR=work/.cwrapper/config /opt/pkg/libexec/cwrappers/cpp-wrapper
>   exec failed
> 
>   $ echo foo | /usr/bin/cpp
>   # 1 "<stdin>"
>   # 1 "<built-in>" 1
>   # 1 "<built-in>" 3
>   # 383 "<built-in>" 3
>   # 1 "<command line>" 1
>   # 1 "<built-in>" 2
>   # 1 "<stdin>" 2
>   foo
> 
> This is an intel mac with macOS 13 and Command Line Tools.   Pretty much
> everything else builds ok, that can be expected to build on mac.

Not all versions of Darwin have /usr/bin/cpp and it can depend on
command line tools, so pkgsrc is usually configured to use the C
compiler in preprocessor mode.

In pkgsrc infra, CPP on Darwin is defined to "clang -E -" if unset.
But the bootstrap installs an override in mk.conf which sets CPP to
"$ {CC} -E" (without the trailing -) when using clang.
I'm sure there is a good reason for doing it this way.

Anyway; this is what is causing the problem. The C compiler expects an
expicit input file. If you change bup's build to call it's discovered
preprocessor with "-" as input when pipeline mode is requested it will
probably work on all systems.

-Tobias




Home | Main Index | Thread Index | Old Index