Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bazel] config.h: No such file or directory #279

Closed
calder opened this issue Dec 24, 2017 · 4 comments
Closed

[Bazel] config.h: No such file or directory #279

calder opened this issue Dec 24, 2017 · 4 comments
Assignees
Labels

Comments

@calder
Copy link

calder commented Dec 24, 2017

When building a Bazel project that imports glog, I get the following error:

ERROR: .../external/com_google_glog/BUILD:5:1: C++ compilation of rule '@com_google_glog//:glog' failed (Exit 1)
In file included from external/com_google_glog/src/utilities.h:75:0,
                 from external/com_google_glog/src/demangle.cc:38:
external/com_google_glog/src/base/mutex.h:105:64: fatal error: config.h: No such file or directory
compilation terminated.

This could be a regression in e6e2e13 bazel/glog.bzl:

-            '/'.join([PACKAGE_NAME, 'config.h']) if PACKAGE_NAME else 'config.h',
+            'glog_internal/src/config.h',

Replacing glog_internal/src/config.h with config.h fixes the issue.

@sergiud sergiud added the bug label Jan 3, 2018
@drigz
Copy link
Member

drigz commented Jan 5, 2018

This should be fixed by #277, could you try using the latest glog?

@drigz drigz self-assigned this Jan 5, 2018
@drigz
Copy link
Member

drigz commented Jan 16, 2018

Closing - please reopen if you're still seeing this with the latest glog.

@drigz drigz closed this as completed Jan 16, 2018
@jondo2010
Copy link

It looks like this is still a problem when building without gflags:

# Override the upstream BUILD file to disable gflags dependency
new_git_repository(
    name = "com_google_glog",
    remote = "https://github.com/google/glog.git",
    commit = "e0341da07bf7cdc00eafdc00744a807a7e5ba427", # Current head
    build_file_content = """
load(':bazel/glog.bzl', 'glog_library')
glog_library(with_gflags=False)
"""
)
INFO: Found 1 target...
ERROR: /home/john/.cache/bazel/_bazel_john/b74fab4f1d4785d9b546125b63063446/external/com_google_glog/BUILD.bazel:3:1: C++ compilation of rule '@com_google_glog//:glog' failed (Exit 1)
In file included from external/com_google_glog/src/utilities.h:75:0,
                 from external/com_google_glog/src/raw_logging.cc:34:
external/com_google_glog/src/base/mutex.h:105:64: fatal error: config.h: No such file or directory
compilation terminated.

drigz added a commit to drigz/glog that referenced this issue Apr 26, 2018
as reported by @jondo2010:
google#279 (comment)

Unfortunately, it is not easy to test this in CI with the current
structure. The glog_library() macro can only be used once, as it
creates various rules with fixed names (eg :gen_sh), and must be used at
@com_google_glog//. The only way to use with_gflags=False is to
overwrite the root BUILD file.
drigz added a commit to drigz/glog that referenced this issue Apr 26, 2018
as reported by @jondo2010:
google#279 (comment)

This was caused by an operator precendence issue: with_gflags=False
would result in copts=[] and the build would not work. This has
presumably never been tested.

Unfortunately, it is not easy to test this in CI with the current
structure. The glog_library() macro can only be used once, as it
creates various rules with fixed names (eg :gen_sh), and must be used at
@com_google_glog//. The only way to use with_gflags=False is to
overwrite the root BUILD file.
@drigz
Copy link
Member

drigz commented Apr 26, 2018

@jondo2010 Thanks for the report! Looks like this was never tested, and sadly I can't see an easy way to test this automatically.

Let me know if #314 works for you.

Also, I could fix this in such a way that it would be tested in CI, but then you'd have to switch from using new_git_repository() to using git_repository() and depending on @com_google_glog//:glog_without_gflags. From a user standpoint, would you prefer that or would it just be a frustrating change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants