Comments (4)
I can reproduce a similar error without requiring Setapp. Instead I just create two separate packages using swift-bridge. When I try to include both packages in Xcode project I get error:
multiple targets named 'RustXcframework' in: 'myotherswiftpackage', 'myswiftpackage'; consider using the `moduleAliases` parameter in manifest to provide unique names
Trying to figure out moduleAliases fix, but no luck so far.
from swift-bridge.
I have fixed the multiple targets named 'RustXcframework'
error by manually renaming the generated framework in my shell script as I saw in another issue. So after call to swift-bridge-cli
I do:
mv MyOtherSwiftPackage/RustXcframework.xcframework MyOtherSwiftPackage/MyOtherRust.xcframework
sed -i '' 's/RustXcframework/MyOtherRust/g' ./MyOtherSwiftPackage/Package.swift
sed -i '' 's/RustXcframework/MyOtherRust/g' ./MyOtherSwiftPackage/Package.swift
sed -i '' 's/RustXcframework/MyOtherRust/g' ./MyOtherSwiftPackage/Sources/MyOtherSwiftPackage/*.swift
sed -i '' 's/RustXcframework/MyOtherRust/g' ./MyOtherSwiftPackage/MyOtherRust.xcframework/*/Headers/module.modulemap
Instead of hardcoding framework name to RustXcframework.xcframework would it make sense to use a unique name each time based on the name passed into swift-bridge-cli
.?
Once I do these things then the multiple targets named 'RustXcframework'
goes away, but I then the original error + 1:
Multiple commands produce '/Users/jessegrosjean/Library/Developer/Xcode/DerivedData/Workspace-hbkovcglkaahjfbtnhikecddkhwb/Build/Products/Debug/include/SwiftBridgeCore.h'
Multiple commands produce '/Users/jessegrosjean/Library/Developer/Xcode/DerivedData/Workspace-hbkovcglkaahjfbtnhikecddkhwb/Build/Products/Debug/include/module.modulemap'
Again this is happening when I use swift-bridge to create two swift packages that wrap rust code, and include them both in the same app.
from swift-bridge.
I think I found solution and have fully documented at end of README here:
https://github.com/jessegrosjean/swift-cargo-problem
That example is using cargo-swift
instead of swift-bridge
, but I think both generators have the same problem.
I think the boiled down answer is that if your swift package references a framework, that framework needs to have unique name, plus unique internal names for headers, etc. So if you are generating swift packages that use an XCFramework you nee to make all the generated values are unique, otherwise you can't use two of the generated packages in the same app.
from swift-bridge.
Related Issues (20)
- swift-bridge-build should not emit errors and instead let rustc show errors emitted by the procedural macro HOT 2
- Problem with x86_64-apple-ios-simulator HOT 2
- Add RustVec.intoArray() HOT 1
- SwiftData struct for translating Swift's Data class HOT 1
- extern Swift declaration not public HOT 12
- Support Box<FnOnce> in extern "Rust" HOT 3
- Clippy finds clippy::unnecessary-cast
- Getting these errors in my project HOT 1
- Add an additional XCode + Rust project option HOT 1
- Building for Release HOT 5
- #[swift_bridge::bridge] macro forces module to be private HOT 2
- warning: `extern` block uses type `RustString`, which is not FFI-safe HOT 4
- Book update: Xcode 15 (at least) requires a bridge in order to import into swift
- Can't seem to return refs of custom types HOT 11
- Cannot use two `#[swift_bridge(..)]` attributes on the same function
- Already_declared causes swift generation to never declare Class HOT 1
- Result returns translating incorrectly? HOT 3
- Is &Vec<T> supported? HOT 2
- Cannot for the life of me get Xcode + Cargo to work HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-bridge.