bazel-ios / cocoapods-bazel

A Cocoapods plugin for automatically generating Bazel BUILD files
Apache License 2.0
109 stars 21 forks source link

Symbols not found issue on M1 mac with objective-c pod #66

Open tejassharma96 opened 2 years ago

tejassharma96 commented 2 years ago

Hi! I'm trying to test out cocoapods-bazel to integrate pods into a project. It seems to work fine for swift pods, but it spits out ld: symbol(s) not found for architecture arm64 when I try to install SDWebImage. I tried to use another Pod that is pure swift and it seemed to work fine there. I couldn't find a pod with mixed sources to test, so not sure how it would work there.

Here is a project for repro: https://github.com/tejassharma96/basic-bazel-app Repro steps (on m1, not sure if this issue exists on intel macs):

Would appreciate any help here and info on what I might be doing wrong here. Thanks!

tejassharma96 commented 2 years ago

Actually tried it out with zxcvbn-ios, which is also objective-c, and that worked.

Based on that, I tried removing "WebImage/SDWebImage.h" from public_headers in the BUILD.bazel for SDWebImage, which didn't work and gave me the same error. I tried doing the opposite, ie removing everything except "WebImage/SDWebImage.h" from public_headers. This didn't give me the symbols not found error, but instead failed because it couldn't find a header :/

lumpidu commented 2 months ago

A bit late to the game, but I tried out your repo, which showed a linking problem, because you were missing to add the Accelerate Apple framework as a dependency for SDWebImage.

So simply add the followoing lines to your apple_framework and ios_application targets:

sdk_frameworks = ["Accelerate"]
tejassharma96 commented 2 months ago

ah interesting @lumpidu, thank you for the info! how did you figure out that Accelerate was missing? is that called out anywhere in the logs or did you need to investigate SDWebImage to see which frameworks it depends on?

lumpidu commented 2 months ago

I googled the unreferenced symbols it spat out. And there came up some threads where Accelerate was mentioned. That did the trick.