please icon indicating copy to clipboard operation
please copied to clipboard

cpp compiler can't find pb header file

Open magengbin opened this issue 4 years ago • 2 comments

Compile the please-examples project

$ plz build //cc:server Build stopped after 16.12s. 2 targets failed: //cc:_kitten_lib#kitten_cc Error building target //cc:_kitten_lib#kitten_cc: exit status 1 In file included from cc/kitten.cc:1: ./cc/kitten.h, line 5, column 10: fatal error: proto/kitten.pb.h: No such file or directory #include "proto/kitten.pb.h" ^~~~~~~~~~~~~~~~~~~ compilation terminated.

//cc:_server#lib_cc

Error building target //cc:_server#lib_cc: exit status 1 In file included from cc/server.cc:5: ./cc/kitten.h, line 5, column 10: fatal error: proto/kitten.pb.h: No such file or directory #include "proto/kitten.pb.h" ^~~~~~~~~~~~~~~~~~~ compilation terminated.

I found this problem starting with v15.0.0-beta2, previous versions were compiling fine

magengbin avatar Dec 08 '21 15:12 magengbin

https://github.com/thought-machine/please/blob/0230a43dcd0af5f78616491388f2bfaa9f12ea9a/rules/proto_rules.build_defs#L223

Change it to the following

def filter_srcs(name, srcs, extension):
    """Filters re-exports its srcs filtering on the provided extension"""
    return build_rule(
        name = name,
        srcs = srcs,
        cmd = '\n'.join([
            'mkdir _out && for i in $SRCS; do ',
            f'   if [[ "$i" == *.{extension} ]]; then ',
            '        mv $i _out/ ',
            '     fi ',
            'done ']),
        output_dirs = ["_out/**"],

magengbin avatar Dec 09 '21 10:12 magengbin

This issue has been automatically marked as stale because it has not had any recent activity in the past 90 days. It will be closed if no further activity occurs. If you require additional support, please reply to this message. Thank you for your contributions.

stale[bot] avatar Mar 12 '22 11:03 stale[bot]