bazel-xcode / bazel-xcode/PodToBUILD
OTHER_LDFLAGS wrongly split
- Dominant language
- Swift
- Stars
- 330
- Forks
- 68
- PR merge metrics
- No merged PRs in 30d
Description
```python
http_archive(
name = "rules_pods",
sha256 = "db4256e80fda350bff752f70385f3a332ac8b93d63c3ef677b11dca075dbe1ff",
url = "https://github.com/pinterest/PodToBUILD/releases/download/0.25.2-8a5efa0/PodToBUILD.zip",
)
load("@rules_pods//BazelExtensions:workspace.bzl", "new_pod_repository")
new_pod_repository(
name = "LibTorch",
# More versions at https://github.com/CocoaPods/Specs/tree/master/Specs/1/3/c/LibTorch
podspec_url = "https://raw.githubusercontent.com/CocoaPods/Specs/075e9679993ae4798982fe55acb95f99486cc963/Specs/1/3/c/LibTorch/1.4.0/LibTorch.podspec.json",
url = "https://ossci-ios.s3.amazonaws.com/libtorch_ios_1.4.0.zip",
)
```
This podspec's `OTHER_LDFLAGS` contains quoted `-force_load "...some path..."` which get truncated in such a way that the generated BUILD.bazel file is invalid:
```
# bazel build @LibTorch//:LibTorch
ERROR: …/external/LibTorch/BUILD.bazel:85:7: syntax error at 'external': expected ',', 'for' or ']'
ERROR: …/external/LibTorch/BUILD.bazel:201:7: syntax error at 'external': expected ',', 'for' or ']'
ERROR: …/external/LibTorch/BUILD.bazel:317:7: syntax error at 'external': expected ',', 'for' or ']'
ERROR: …/external/LibTorch/BUILD.bazel:421:7: syntax error at 'external': expected ',', 'for' or ']'
```
Generated code looks like:
```python
objc_library(
# …
copts = [
""external/LibTorch/install/lib/libtorch.a"",
"-force_load",
"-Wnon-modular-include-in-framework-module",
"-g",
"-stdlib=libc++",
"-DCOCOAPODS=1",
# …
],
# …
)
```
I'm not sure what `-force_load` means nor why there is even a `OTHER_LDFLAGS` but I bet just splitting this string on spaces is the issue and the generated code should actually look like:
```python
objc_library(
# …
copts = [
"-force_load \"external/LibTorch/install/lib/libtorch.a\"",
"-Wnon-modular-include-in-framework-module",
"-g",
"-stdlib=libc++",
"-DCOCOAPODS=1",
# …
],
# …
)
```
Moreover I'd say these ldflags should be put under `linkopts = [...]` instead of `copts = [...]` but again I'm not familiar with this.
cc #111
Note: [one of the example uses this flag](https://github.com/pinterest/PodToBUILD/blob/181508a3a5cdcbd5a3f21184a0fff7596a912bf2/Examples/PodSpecs/Calabash.podspec.json#L24)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.