Exports_files and using them within the linkopts

263 views
Skip to first unread message

Amir Bishara

unread,
Apr 14, 2022, 4:51:24 AM4/14/22
to bazel-discuss
Hey all,
in my local workspace I'm trying to use the file  "elf64ltsmip.xc" which is located in an external workspace which is defined as :

new_local_repository(
    name = "external_rep",
    path =  STAGING_DIR + 'external_rep',
    build_file_content = """
package(
    default_visibility = [
        "//visibility:public",
    ],
)

########## FIRST_TRY#############
filegroup(
    name = "elf64ltsmip",
    srcs = select({
            "@platforms//cpu:mips64":["libs/elf64ltsmip.xc"],
            "@platforms//cpu:x86_64":[],
        }),
)
######### #SECOND_TRY##############
exports_files(["libs/elf64ltsmip.xc"],visibility = ["//visibility:public"])

""",
)

and using the file in one of my cc_libraries in a BUILD.bazel which is located in my local WORKSPACE:
linkopts =  ["-Wl,-Texternal/ external_rep /elf64ltsmip.xc"],

I've tried so many different ways like defining filegroup and using it or exports_files and mentioning the file in the data field but nothing has succeeded and each time I'm getting an error that bazel didn't find the file. (I've also tried to use the $(location) in the linkopts still not working well)

any suggestions how to deal with this issue?

Thanks,
Amir

Reply all
Reply to author
Forward
0 new messages