ionic-team / ionic-team/capacitor

[Bug]: CordovaPlugins.podspec vendored_libraries path

Open
#8,038 4 comments 0 reactions 0 assignees View on GitHub
cli type: bug
Dominant language
TypeScript
Stars
16.7k
Forks
1.3k
Avg merge
3d 15h
Merged PRs (30d)
10

Description

### Capacitor Version

Latest Dependencies:

@capacitor/cli: 7.4.0
@capacitor/core: 7.4.0
@capacitor/android: 7.4.0
@capacitor/ios: 7.4.0

Installed Dependencies:

@capacitor/android: not installed
@capacitor/cli: 7.4.0
@capacitor/core: 7.4.0
@capacitor/ios: 7.4.0

[success] iOS looking great! 👌

### Other API Details

```Shell

```

### Platforms Affected

- [x] iOS
- [ ] Android
- [ ] Web

### Current Behavior

In my project, I'm using a Cordova plugin that includes the following in its plugin.xml:
``

After running the update command with Capacitor CLI, it generates a CordovaPlugins.podspec file which contains this line:
`s.vendored_libraries = 'sources/CordovaPluginHoneywellCaptuvo2/libCaptuvoSDK.a'`

However, after the update, the actual path to the file is:
`noarc/CordovaPluginHoneywellCaptuvo2/libCaptuvoSDK.a`

I checked the implementation in cli/src/ios/update.ts and found that the first segment (sources) is hardcoded:
`let sourcesFolderName = 'sources';`

This causes the path in the .podspec to be incorrect when the file is actually placed in the noarc folder due to the -fno-objc-arc compiler flag.

As a result I get the following error when build iOS project in xcode:
```
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_Captuvo", referenced from:
in CaptuvoCDV.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

It would be great if this could be fixed or made configurable to support such cases correctly.

### Expected Behavior

After running npx cap update, the generated CordovaPlugins.podspec should correctly reflect the actual path of the static library based on the compiler-flags="-fno-objc-arc" attribute in plugin.xml.

Specifically, if the file is placed in the noarc directory due to -fno-objc-arc, then the s.vendored_libraries path should be:

`noarc/CordovaPluginHoneywellCaptuvo2/libCaptuvoSDK.a`
instead of:
`sources/CordovaPluginHoneywellCaptuvo2/libCaptuvoSDK.a`

This will ensure that CocoaPods correctly links the static library, and the iOS project compiles successfully without manual corrections.

### Project Reproduction

https://github.com/vokanred/capacitor-cordova-noarc

### Additional Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.