bazel-contrib / rules_foreign_cc

Build rules for interfacing with "foreign" (non-Bazel) build systems (CMake, configure-make, GNU Make, boost, ninja, Meson)
https://bazel-contrib.github.io/rules_foreign_cc
Apache License 2.0
679 stars 249 forks source link

configure_make set linkopts with "$$EXT_BUILD_DEPS$$"" will let linker cannot find coresponding directory #1245

Closed xiedeacc closed 3 months ago

xiedeacc commented 3 months ago

I import gperftools use configure_make, for some reason, for gperftools has link problem if link to libunwind dynamically, so I have to specify "$$EXT_BUILD_DEPS$$/lib/libunwind.a", in linkopts, so gperftools it self can compile and link success(bazel build @gperftools//... success), but linker will meet cannot find "$$EXT_BUILD_DEPS$$/lib/libunwind.a" when link my own target, how to fix this? cannnot use EXT_BUILD_DEPS in linkopts, anyother solution?

configure_make(
    name = "gperftools_build",
    args = ["-j"],
    autogen = True,
    configure_in_place = True,
    configure_options = [
        "--enable-shared=yes",
        "--enable-static=no",
        #"--disable-static",
        "--enable-frame-pointers",
        "--enable-libunwind",
    ],
    lib_source = ":all",
    linkopts = [
        "$$EXT_BUILD_DEPS$$/lib/libunwind.a",
    ],
    out_shared_libs = [
        "libtcmalloc_and_profiler.so",
        "libtcmalloc_and_profiler.so.4",
        "libtcmalloc_and_profiler.so.4.6.11",
    ],
    tags = ["skip_on_windows"],
    targets = [
        "install",
    ],
    deps = [
        "@libunwind//:unwind",
        "@xz",
        "@zstd",
    ],
)