Skip to content

when bazel running a cc_binary in Windows, the C++ app can't find its data dependencies  #4215

Closed

Description

@thinlizzy

Please provide the following information. The more we know about your system and use case, the more easily and likely we can help.

Description of the problem / feature request / question:

I have a cc_binary rule with a single .cpp file and one data dependency. I have no means to tell the application where to find the data.

If possible, provide a minimal example to reproduce the problem:

BUILD file in engine_test/demos directory relative to the WORKSPACE directory

cc_binary(
	name = "test",
	srcs = [
		"Test.cpp",
	],
	data = ["//engine_test/images"],
)

BUILD file in engine_test/images directory. same deal

filegroup(
    name = "images",
    srcs = glob([
        "*.png",
    ]),
)

Test.cpp

#include <fstream>

int main()
{
  std::fstream fs("engine_test/images/test.png");  // can't find the file
  // fs.fail() == true   :(
}

Environment info

  • Operating System: Windows
  • Bazel version (output of bazel info release): release 0.5.4

Have you found anything relevant by searching the web?

#3881 seems to be related, but I also tried to use ($location //engine_test/images) without success.

Anything else, information or logs or outputs that would be helpful?

my current workaround to open the files is:
std::fstream fs("../../../../../../engine_test/images/test.png");

Activity

  1. iirina commented on Dec 4, 2017

    @iirina
    Contributor

    CC: @laszlocsomor Do you know why this doesn't work on Windows?

  2. added
    P2
    on Dec 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2platform: windowstype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions