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

new_local_repository does not respect 'includes' attribute #66

Closed
pmbethe09 opened this issue Mar 26, 2015 · 3 comments
Closed

new_local_repository does not respect 'includes' attribute #66

pmbethe09 opened this issue Mar 26, 2015 · 3 comments
Assignees

Comments

@pmbethe09
Copy link
Member

suppose you want to link against the system jni headers on a Mac that might be a WORKSPACE entry of:

new_local_repository(
    name = "jni-local",
    build_file = "BUILD.extjni",
    path = "/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/include",
)
bind(
    name = "jni",
    actual = "@jni-local//:headers",
)

---
BUILD.extjni of:

genrule(
    name = "empty",
    outs = ["empty.cc"],
    cmd = "echo -n 'void external_jdk_empty(){}' > $@",
)
cc_library(
    name = "headers",
    srcs = [":empty"],
    hdrs = glob(["**/*.h"]),
    includes = [
        ".",
        "darwin",
    ],
    visibility = ["//visibility:public"],
)

When you try and compile a file which has #include <jni.h>:

ERROR: jni/BUILD:10:1: undeclared inclusion(s) in rule '//jni:libreverse.so':
this rule is missing dependency declarations for the following files included by 'jni/Reverse.cpp':
  '/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/include/jni.h'
  '/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/include/darwin/jni_md.h'.
@pmbethe09
Copy link
Member Author

that was supposed to be include jni.h with angle brackets.

@pmbethe09
Copy link
Member Author

Not sure I agree using the example above: bazel build //external:jni

ERROR: /private/var/tmp/bazel_pbethe/d03eb8f816153c36c4229eeab3f690b4/.external-repository/jni-local/BUILD:12:12: error globbing [*/_.h]: /private/var/tmp/_bazel_pbethe/d03eb8f816153c36c4229eeab3f690b4/.external-repository/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/external/jni-local/darwin (Too many levels of symbolic links).
ERROR: /Users/pbethe/School/Bridge/WORKSPACE:7:1: Target '@jni-local//:headers' contains an error and its package is in error and referenced by '//external:jni'.

@kchodorow
Copy link
Contributor

I think this can be worked around with more judicious globbing until #87 is fixed.

laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Jul 30, 2018
Running with --nobatch then --batch ensures the
second run kills the first one (because of changed
startup flags) and the second one too (because of
--batch).

The `kill` assertions in lines bazelbuild#66 and bazelbuild#67 now
succeed.

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

No branches or pull requests

2 participants