question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
memshardedcommented, Feb 1, 2022

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.

1reaction
memshardedcommented, Feb 1, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Glob not found in bazel - Stack Overflow
It seems like you're importing c++ dependencies into your project: check out the new_local_repository rule here. This allows you to point to a ......
Read more >
bazel include and absolute paths - Google Groups
I tried to use an absolute path in an includes attribute to handle a prefix to a 3rd party library and it appears...
Read more >
General Rules | Bazel
The list of targets that are members of the file group. It is common to use the result of a glob expression for...
Read more >
262216 – devel/bazel 5.0.0 does not work after successful ...
Hi , i installed bazel 5.0.0 version with out problem by compiling from Freebsd port tree. when i test to bazel , i...
Read more >
Changelog — conan 1.56.0 documentation
Docs here; Fix: Raise a clear error if settings.compiler is not defined for ... Feature: Added tool rm at conan.tools.files to remove files...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found