conan: [bug] Error while compiling with bazel: Error in glob: pattern cannot be absolute

I reported a bug yesterday: https://github.com/conan-io/conan/issues/10471#issuecomment-1026297628

I’ve installed master with the fix and it seems to solve that issue.

I’m running into a different issue when using bazel now, It may not be related to that specific commit but its something that breaks in the commits in master planned for version 1.45, as it works just fine in version 1.44.1

Environment Details (include every applicable attribute)

  • Operating System+version: Fedora release 34 (Thirty Four)
  • Compiler+version: gcc (GCC) 11.0.1 20210324 (Red Hat 11.0.1-0)
  • Conan version: Conan version 1.44.1
  • Python version: Python 3.9.2

Steps to reproduce (Include if Applicable)

from conans import ConanFile
from conan.tools.google import BazelToolchain, BazelDeps


class ExampleConanIntegration(ConanFile):
    name = "example"
    version = "0.0.1"
    generators = ['BazelDeps', 'BazelToolchain']
    requires = [
        'glew/2.2.0'
    ]

    def configure(self):
          pass

    def imports(self):
          pass

Then run:

conan install . --build=missing -s compiler=gcc -s compiler.version=11 -s compiler.libcxx=libstdc++11 -s build_type=Debug

Try to use the dependencies on any bazel project:

bazel build //...

It wont compile anymore

Logs (Executed commands with output) (Include/Attach if Applicable)

ERROR: /home/mboujema/Developer/tijara/conandeps/glew/BUILD.bazel:5:10: //conandeps/glew:GLEWd_precompiled: invalid label '/home/mboujema/.conan/data/glew/2.2.0/_/_/package/44741af961cbe3bae7bd261b66459e5b6dc65693/lib/libGLEWd.a' in attribute 'static_library' in 'cc_import' rule: invalid target name '/home/mboujema/.conan/data/glew/2.2.0/_/_/package/44741af961cbe3bae7bd261b66459e5b6dc65693/lib/libGLEWd.a': target names may not start with '/'
ERROR: Traceback (most recent call last):
        File "/home/mboujema/Developer/tijara/conandeps/glew/BUILD.bazel", line 14, column 16, in <toplevel>
                hdrs = glob(["/home/mboujema/.conan/data/glew/2.2.0/_/_/package/44741af961cbe3bae7bd261b66459e5b6dc65693/include/**"]),
Error in glob: pattern cannot be absolute

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

Another thing, it use to generate the packages in conandeps folder, and you could easily link all of them to bazel as explained here: https://docs.conan.io/en/latest/integrations/build_system/bazel.html

Yes, that was something incorrectly hardcoded. The integration shouldn’t hardcode the conandeps folder. Instead, the projects can define in layout() method something like self.folders.generators = "conandeps" if they want. This has been fixed and the layout() applied to failing tests.

I am creating a new ticket to track this (as the original “glob” issue + some improvements on the testing and BazelDeps closed this one, better narrow the scope of the fix).

I don’t think we will manage to make it for 1.45, as it is about to be branched (today), but lets try to stabilize and improve the integration for 1.46