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

Windows: Include checking failed when external repository name contains upper case #5485

Closed
monamimani opened this issue Jun 27, 2018 · 3 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) type: bug

Comments

@monamimani
Copy link

Description of the problem / feature request:

I am trying to add the lib glm as an external repository but Bazel gives me undeclared inclusion error but if I build it separetly ( in an other workspace) with the same build script it works.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

My folder structure

glmExtBuild
---- WORKSPACE
---- externals
-------- glm.BUILD

This is my WORKSPACE file

new_http_archive(
  name = "glmExt",
  url = "https://github.com/g-truc/glm/archive/0.9.9.0.tar.gz",
  sha256 = "514dea9ac0099dc389cf293cf1ab3d97aff080abad55bf79d4ab7ff6895ee69c",
  strip_prefix = "glm-0.9.9.0",
  build_file = "externals/glm.BUILD",
)

This is my glm.BUILD file

package(default_visibility = ["//visibility:public"])
cc_library(
  name= "glm",
  defines= ["GLM_ENABLE_EXPERIMENTAL", "GLM_FORCE_RADIANS", 
  "GLM_FORCE_DEPTH_ZERO_TO_ONE"],
  srcs=glob(["glm/**/*.cpp"]) + ["glm/detail/_fixes.hpp"],
  hdrs=glob(["glm/**/*.hpp"])+glob(["glm/**/*.h"]),
  includes = [".", "glm"],
  textual_hdrs = glob(["glm/**/*.inl"]),
  visibility = ["//visibility:public"],
)

And this is the errors that I get when I run

bazel build @glmExt//:glm --verbose_failures --sandbox_debug
ERROR: C:/users/...../external/glmExt/BUILD.bazel:121:1: undeclared inclusion(s) in rule '@glmExt//:glm':
this rule is missing dependency declarations for the following files included by 'external/glmExt/glm/detail/glm.cpp':
'external/glmext/glm/detail/_fixes.hpp'
'external/glmext/glm/detail/setup.hpp'
'external/glmext/glm/simd/platform.h'
'external/glmext/glm/fwd.hpp'
'external/glmext/glm/detail/setup.hpp'
'external/glmext/glm/detail/type_int.hpp'
'external/glmext/glm/detail/setup.hpp'
'external/glmext/glm/detail/type_float.hpp'
...

The working case:

My folder structure

glmBuild2
---- WORKSPACE
---- BUILD
---- glmSrc
-------- https://github.com/g-truc/glm/archive/0.9.9.0.tar.gz extracted here

My WORKSPACE file is empty

And this is my BUILD file

package(default_visibility = ["//visibility:public"])
cc_library(
  name= "glm",
  defines= ["GLM_ENABLE_EXPERIMENTAL", "GLM_FORCE_RADIANS", "GLM_FORCE_DEPTH_ZERO_TO_ONE"],
  srcs=glob(["glmSrc/glm/**/*.cpp"]) + ["glmSrc/glm/detail/_fixes.hpp"],
  hdrs=glob(["glmSrc/glm/**/*.hpp"])+glob(["glmSrc/glm/**/*.h"]),
  includes = ["glmSrc"],
  textual_hdrs = glob(["glmSrc/glm/**/*.inl"]),
  visibility = ["//visibility:public"],
)

What operating system are you running Bazel on?

windows

What's the output of bazel info release?

release 0.15.0

I just updated bazel to 0.15.0 and it still doesn't work ( aka, it was not working in 0.14.0)

Have you found anything relevant by searching the web?

Nothing really, I would like to know more about the check of the include algorithm but i couldn't find anything. I can only print the result of the glob but I couldn't find a way to ask bazel what it actually has for its hdrs, srcs,...

Any other information, logs, or outputs that you want to share?

I asked the question on stackoverflow too but I have no solution for now.
https://stackoverflow.com/questions/51053215/why-do-i-get-undeclared-inclusion-error-when-using-the-lib-as-external-library

@hlopko hlopko added type: bug P2 We'll consider working on this in future. (Assignee optional) category: rules > C++ labels Jun 28, 2018
@meteorcloudy
Copy link
Member

I found the culprit is case-sensitivity. On Windows file path is case insensitive, so Bazel converts file path to lower case to make path comparison simpler.
But when doing include checking for external repository, we calculate repository name from file path. It doesn't match when the actual repository name contains upper case.

RepositoryName repository =
PackageIdentifier.discoverFromExecPath(execPathFragment, false).getRepository();

Thanks for reporting this. It's definitely a bug on Windows. You can work around it by renaming glmExt to glmext. We'll try to fix it.

@meteorcloudy meteorcloudy changed the title Bazel give me undeclared inclusion error when the header is specified but only if building the lib as an external. Windows: Include checking failed when external repository name contains upper case Jun 29, 2018
@hlopko
Copy link
Member

hlopko commented Jun 29, 2018

ouch

@monamimani
Copy link
Author

Thanks I renamed the new_http_archive name to glmext and it works.
Thanks alot!

werkt pushed a commit to werkt/bazel that referenced this issue Aug 2, 2018
Fixed bazelbuild#5485

RELNOTES: None
PiperOrigin-RevId: 202903823
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) type: bug
Projects
None yet
Development

No branches or pull requests

3 participants