Yet another "this rule is missing dependency declarations for the following files included by" queston

435 views
Skip to first unread message

Francis Hitchens

unread,
Feb 24, 2021, 1:51:52 PM2/24/21
to bazel-discuss
Hi,

Must be doing something stupid, but I just can't see it. These BUILD files were working fine before I switched the CC compiler from the Intel icc to the gcc compiler, I'm doing 32 bit compilation on a 64 OS but that is all working. Has anyone experienced something similar?

Using ancient version of Bazel 0.11 but that's my fault.

I had an external dependency setup for Postgres. ".pc" files are preprocessed to .c files. The .c to .o compilation is working but I am now getting this error after the C compile.

ERROR: /ens/workspace/bb/nxt_bch/BUILD:176:1: undeclared inclusion(s) in rule '//bb/nxt_bch:pgutilslib':
this rule is missing dependency declarations for the following files included by 'bb/nxt_bch/dummylib.c':
  '/usr/pgsql-11/include/ecpglib.h'
  '/usr/pgsql-11/include/libpq-fe.h'
  '/usr/pgsql-11/include/postgres_ext.h'
  '/usr/pgsql-11/include/pg_config_ext.h'
  '/usr/pgsql-11/include/ecpgtype.h'
  '/usr/pgsql-11/include/sqlca.h'
  '/usr/pgsql-11/include/ecpgerrno.h'
  '/usr/pgsql-11/include/sqlca.h'

The compilation from what I understand is working find and all the header files are present in the sandbox, but I guess for some reason Bazel is looking at the .d dependencies and thinking I have not specified the Postgres header files. The rules are as follows.

The pc skylark rule executes the pre-processor to create the .c files.

pc(
  name = "dummylib",
  srcs = ["dummylib.pc",
          "c/src/xyz_Retreive.pc",
          "c/src/abc.pc",],
  deps = ["@postgres_client//:fheader_files",],
  visibility = ["//visibility:public"],
)

No issues here, but building the library always fails with the missing dependencies error on the last .c file to be compiled.

cc_library(
    name = "pgutilslib",
    srcs = [":dummylib",
            ],
    #includes = [ ],
    deps = [":pub",
            "@postgres_client//:header_files",
            ],
    visibility = ["//main:__pkg__"],
)

My  WORKSPACE has 

new_local_repository(
    name = "postgres_client",
    path = "/usr/pgsql-11",
    build_file = "postgres.BUILD",
)

and the postgres.BUILD has 

cc_library(
    name = "ecpglib",
    srcs = ["lib/libecpg.so"],
    visibility = ["//visibility:public"],
)

sh_binary(
    name = "ecpg",
    srcs = ["bin/ecpg"],
    visibility = ["//visibility:public"],
)

filegroup(
    name = "fheader_files",
    srcs = glob(["include/*.h",]),
    visibility = ["//visibility:public"],
)

cc_library(
    name = "header_files",
    srcs = glob(["include/*.h",]),
    includes = [ "include" ],
    visibility = ["//visibility:public"],
)

I see this in the Bazel log file...

210224 18:38:41.248:W 2213 [com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run] Aborting evaluation due to com.google.devtools.build.lib.skyframe.ActionExecutionFunction$ActionExecutionFunctionException: com.google.devtools.build.lib.actions.AlreadyReportedActionExecutionException: undeclared inclusion(s) in rule '//bb/nxt_bch:pgutilslib':
this rule is missing dependency declarations for the following files included by 'bb/nxt_bch/dummylib.c':
  '/usr/pgsql-11/include/ecpglib.h'
  '/usr/pgsql-11/include/libpq-fe.h'
  '/usr/pgsql-11/include/postgres_ext.h'
  '/usr/pgsql-11/include/pg_config_ext.h'
  '/usr/pgsql-11/include/ecpgtype.h'
  '/usr/pgsql-11/include/sqlca.h'
  '/usr/pgsql-11/include/ecpgerrno.h'
  '/usr/pgsql-11/include/sqlca.h' while evaluating ACTION_EXECUTION:ActionLookupData{actionLookupNode=//bb/nxt_bch:pgutilslib com.google.devtools.build.lib.skyframe.BuildConfigurationValue$Key@6ad7236f false (187360060), actionIndex=1}
Reply all
Reply to author
Forward
0 new messages