Skip to content

How I can build cgo project with linkmode to multiple architectures? #17

@farcop

Description

@farcop

Try to build shared lib to multiple architectures, but I cant

go_binary(
    name = "fluent-bit-rabbitmq-output",
    embed = [":fluent-bit-rabbitmq-output_lib"],
    linkmode = "c-shared",
    visibility = ["//visibility:public"],
)

[
    platform_binary(
        name = "fluent-bit-rabbitmq-output_{}".format(name),
        src = "fluent-bit-rabbitmq-output",
        platform = platform,
    )
    for name, platform in [
        ("linux_amd64", "//platform:linux_amd64"),
        ("linux_arm64", "//platform:linux_arm64"),
    ]
]
% bazel build //fluent-bit-rabbitmq-output:fluent-bit-rabbitmq-output_linux_arm64
ERROR: /Users/farcop/Sources/kublr/kublr-feature-logging/elk/fluent-bit-rabbitmq-output/BUILD.bazel:39:20: in platform_binary rule //kublr-feature-logging/elk/fluent-bit-rabbitmq-output:fluent-bit-rabbitmq-output_linux_arm64: 
/private/var/tmp/_bazel_farcop/e66529431dbede3bc951f821053136ab/external/bazel-zig-cc/rules/platform.bzl:38:24: The rule 'platform_binary' is executable. It needs to create an executable File and pass it as the 'executable' parameter to the DefaultInfo it returns.
ERROR: /Users/farcop/Sources/kublr/kublr-feature-logging/elk/fluent-bit-rabbitmq-output/BUILD.bazel:39:20: Analysis of target '//kublr-feature-logging/elk/fluent-bit-rabbitmq-output:fluent-bit-rabbitmq-output_linux_arm64' failed
ERROR: Analysis of target '//kublr-feature-logging/elk/fluent-bit-rabbitmq-output:fluent-bit-rabbitmq-output_linux_arm64' failed; build aborted: 
INFO: Elapsed time: 0.103s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded, 6 targets configured)

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