Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bazel should improve consistency behavior when as a external repo #22885

Open
xiedeacc opened this issue Jun 25, 2024 · 0 comments
Open

bazel should improve consistency behavior when as a external repo #22885

xiedeacc opened this issue Jun 25, 2024 · 0 comments
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: feature request untriaged

Comments

@xiedeacc
Copy link

xiedeacc commented Jun 25, 2024

Description of the feature request:

I wrote a BUILD script for libsodium work well under libsodium source tree, build failed for search path in copts seems relative to workspace when it as an external repo, but cc_library's hdrs and srcs is ralative to libsodium source directory, these inconsistent behaviors really made me confused , in fact I think this is a bug, if made copt behavior same bettween external and it self, it can avoid many silly things, really hope guys can change this behavior, really realy thanks!!!!

demo:
https://github.com/xiedeacc/libsodium.git
https://github.com/xiedeacc/bazel_problem.git (libsodium imported in bazel_problem )

workspace(name = "bazel_problem")
...
new_git_repository(
    name = "libsodium",
    build_file = "//bazel_script:libsodium.BUILD",
    remote = "[email protected]:jedisct1/libsodium.git",
    tag = "1.0.20-RELEASE",
)
...

libsodium.BUILD

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


COMMON_COTPS = [
    "-g3",
    "-pthread",
    "-fvisibility=hidden",
    "-fPIC",
    "-fno-strict-aliasing",
    "-fno-strict-overflow",
    "-fstack-protector",
    "-Wno-deprecated-declarations",
    "-Wno-unknown-pragmas",
    "-ftls-model=local-dynamic",
    "-Isrc/libsodium/include/sodium",
    "-Isrc/libsodium/crypto_aead/aegis128l",
    "-Isrc/libsodium/crypto_aead/aegis256",
    "-Isrc/libsodium/crypto_core/ed25519/ref10/fe_25_5",
    "-Isrc/libsodium/crypto_core/ed25519/ref10/fe_51",
    "-Isrc/libsodium/crypto_generichash/blake2b/ref",
    "-Isrc/libsodium/crypto_onetimeauth/poly1305",
    "-Isrc/libsodium/crypto_onetimeauth/poly1305/donna",
    "-Isrc/libsodium/crypto_onetimeauth/poly1305/sse2",
    "-Isrc/libsodium/crypto_pwhash/argon2",
    "-Isrc/libsodium/crypto_pwhash/scryptsalsa208sha256",
    "-Isrc/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse",
    "-Isrc/libsodium/crypto_scalarmult/curve25519",
    "-Isrc/libsodium/crypto_scalarmult/curve25519/ref10",
    "-Isrc/libsodium/crypto_scalarmult/curve25519/sandy2x",
    "-Isrc/libsodium/crypto_shorthash/siphash24/ref",
    "-Isrc/libsodium/crypto_sign/ed25519/ref10",
    "-Isrc/libsodium/crypto_stream/chacha20",
    "-Isrc/libsodium/crypto_stream/chacha20/dolbeau",
    "-Isrc/libsodium/crypto_stream/chacha20/ref",
    "-Isrc/libsodium/crypto_stream/salsa20",
    "-Isrc/libsodium/crypto_stream/salsa20/ref",
    "-Isrc/libsodium/crypto_stream/salsa20/xmm6",
    "-Isrc/libsodium/crypto_stream/salsa20/xmm6int",
]
...
cc_library(
    name = "sodium",
    srcs = [
        "src/libsodium/sodium/codecs.c",
        "src/libsodium/sodium/core.c",
        "src/libsodium/sodium/runtime.c",
    ],
    hdrs = glob([
        "src/libsodium/include/sodium/*.h",
        "src/libsodium/include/sodium/private/*.h",
    ]),
    copts = select({
        ":windows": [],
        "//conditions:default": [
            "-msse2",
            "-mssse3",
        ] + COMMON_COTPS,
    }),
    includes = [
    ],
    linkopts = select({
        ":windows": [],
        "//conditions:default": [
            "-Wl,-z,relro",
            "-Wl,-z,now",
            "-Wl,-z,noexecstack",
            "-export-dynamic",
        ],
    }),
    local_defines = COMMON_DEFINES,
    visibility = ["//visibility:public"],
    deps = [
        ":aesni",
        ":armcrypto",
        ":avx2",
        ":avx512f",
        ":common",
        ":rdrand",
        ":sse2",
        ":sse41",
        ":ssse3",
    ],
)

@sgowroji sgowroji added the team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: feature request untriaged
Projects
None yet
Development

No branches or pull requests

4 participants