Skip to content

Linking error with libxml2 #657

@dreisicht

Description

@dreisicht

I tried setting up toolchains_llvm in a minimal repo on a current CachyOS. On an MacOS it works flawlessly.

This is the MODULE.bazel

module(
    name = "terrain_displacer",
    version = "0.1.0",
)

bazel_dep(name = "rules_cc", version = "0.2.16")

bazel_dep(name = "toolchains_llvm", version = "1.6.0")
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
llvm.toolchain(
   llvm_version = "21.1.6",
)
use_repo(llvm, "llvm_toolchain")
register_toolchains("@llvm_toolchain//:all")

A simple BUILD.bazel

load("@rules_cc//cc:defs.bzl", "cc_binary")

package(default_visibility = ["//visibility:public"])

cc_binary(
    name = "main",
    srcs = ["main.cc"],
)

A C++ test file

#include <iostream>

int main(int argc, char *argv[]) {
  std::cout << "hi";
  return 0;
}

Where I'm getting the error

ERROR: /home/peterbaintner/repos/terrain_displacer/src/BUILD.bazel:16:10: Linking src/scratchpad failed: (Exit 1): cc_wrapper.sh failed: error executing CppLink command (from cc_binary rule target //src:scratchpad) external/toolchains_llvm++llvm+llvm_toolchain/bin/cc_wrapper.sh @bazel-out/k8-fastbuild/bin/src/scratchpad-0.params

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/toolchains_llvm++llvm+llvm_toolchain_llvm/bin/ld.lld: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory
clang: error: unable to execute command: No such file or directory

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions