Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 645 by victo...@
gmail.com: Undefined symbols for architecture arm64: _SharpYuvConvert
https://bugs.chromium.org/p/webp/issues/detail?id=645Trying to compile the [`go-webp`](
https://pkg.go.dev/github.com/kolesa-team/go-webp) package using Bazel. This involves compiling [`libwebp`](
https://github.com/webmproject/libwebp) from sources.
Here's how I'm retrieving `libwebp`'s sources:
```Starlark
# WORKSPACE
git_repository(
name = "libwebp",
remote = "
https://chromium.googlesource.com/webm/libwebp",
commit = "9ce982fdf21764ef7b273f91d6d72721656c3e03",
build_file = "//:bazel/libwebp/BUILD.bazel",
)
# //:bazel/libwebp/BUILD.bazel
filegroup(
name = "srcs",
srcs = glob(
["**/*"],
#
https://github.com/bazelbuild/rules_foreign_cc/issues/1034#issuecomment-2009876928 exclude = ["bazel*/**"],
),
visibility = ["//visibility:public"],
)
```
Then, here's how I'm (apparently successfully) compiling it:
```Starlark
# //:external/libwebp/BUILD.bazel
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
configure_make(
name = "libwebp",
autogen = True,
configure_in_place = True,
configure_options = [],
env = select({
"@platforms//os:macos": {
"AR": "/usr/bin/ar",
},
"//conditions:default": {},
}),
lib_source = "@libwebp//:srcs",
visibility = ["//visibility:public"],
)
```
Finally, the `go-webp` Go repository:
```
go_repository(
name = "com_github_kolesa_team_go_webp",
importpath = "
github.com/kolesa-team/go-webp",
patches = ["//:bazel/com_github_kolesa_team_go_webp/build.patch"], # keep
sum = "h1:wQvU4PLG/X7RS0vAeyhiivhLRoxfLVRlDq4I3frdxIQ=",
version = "v1.0.4",
)
```
Where the patch contains:
```
--- encoder/BUILD.bazel
+++ encoder/BUILD.bazel
@@ -7,7 +7,7 @@
"options.go",
],
cgo = True,
- clinkopts = ["-lwebp"],
+ cdeps = ["@asset-tracker//external/libwebp"],
importpath = "
github.com/kolesa-team/go-webp/encoder",
visibility = ["//visibility:public"],
)
```
Trying to build a service that depends on `go-webp` results in linker not finding some symbols from the `webp` library:
```
ld: warning: ignoring duplicate libraries: '-lc++', '-lm'
Undefined symbols for architecture arm64:
"_SharpYuvConvert", referenced from:
_PreprocessARGB in libwebp.a[87](libwebpencode_la-picture_csp_enc.o)
"_SharpYuvGetConversionMatrix", referenced from:
_PreprocessARGB in libwebp.a[87](libwebpencode_la-picture_csp_enc.o)
"_SharpYuvInit", referenced from:
_ImportYUVAFromRGBA in libwebp.a[87](libwebpencode_la-picture_csp_enc.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
link: error running subcommand external/go_sdk/pkg/tool/darwin_arm64/link: exit status 2
```
Some info about my system:
```
Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020 arm64
bazel 7.2.1
```
--
You received this message because:
1. The project was configured to send all issue notifications to this address
You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings