Open yashdesai7 opened 2 years ago
swift package generate-xcodeproj
is no longer supported by Swift, so it's highly likely that build failures occur when you do this. Is there any reason you can't simply depend on the Swift package directly?
Yes. I can not move to SPM yet.
On Tue, May 17, 2022 at 11:40 PM Cory Benfield @.***> wrote:
swift package generate-xcodeproj is no longer supported by Swift, so it's highly likely that build failures occur when you do this. Is there any reason you can't simply depend on the Swift package directly?
— Reply to this email directly, view it on GitHub https://github.com/grpc/grpc-swift/issues/1408#issuecomment-1129629834, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALEVB6P3BHEC2MICYVY7OLVKSGHNANCNFSM5WGWZG4Q . You are receiving this because you authored the thread.Message ID: @.***>
--
Thanks, Yash Desai
I think the "allow non-modular includes" setting should work so long as you apply it to all targets.
Interesting. This dose not work for NIOSSL
@Lukasa would you be able to help here ?
@yashdesai7 Like @Lukasa said sadly the swift package generate-xcodeproj
is no longer officially supported. However, I just tried to reproduce your issue. I checked out the latest commit on main, generated the project and clean build swift-rio-Package
and a couple of the executable targets.
For me all of the clean build succeeded on both MacOS and iOS. Do you have a more complex setup by any chance?
@FranzBusch
did you build the grpc-swift-Package or GRPC target from this repo?
I don’t have a complex setup. I just checked out the repo and tried to build but I was building a GRPC target as I will need a GRPC framework. I also tried building grpc-swift-Package, GRPC, with xcodeproj and seeing the same error.
I suspect you build the swift-nio-Package and I believe NIO
target builds that with xcodeproj. I tried that and it built fine for me as well.
@yashdesai7 Sorry I misspoke earlier. I build the GRPC
target for both MacOS and iOS successfully. I was also able to build the grpc-swift-Package
target for MacOS (This one failed for iOS, but that is intended I think)
So I can sadly not reproduce the build error you are seeing.
Could you provide some more infos:
@FranzBusch
Version 13.4 (13F17a)
swift package generate-xcodeproj
❯ tree -d
.
├── Examples
│ ├── EchoWeb
│ │ └── Generated
│ └── Google
│ ├── NaturalLanguage
│ │ └── Sources
│ ├── SpeechToText
│ │ ├── Images
│ │ ├── Sources
│ │ │ ├── Configuration
│ │ │ │ └── Assets.xcassets
│ │ │ │ └── AppIcon.appiconset
│ │ │ └── Launch
│ │ │ └── Base.lproj
│ │ └── SpeechToText-gRPC-iOS.xcodeproj
│ │ └── xcshareddata
│ │ └── xcschemes
│ └── common
│ └── include
│ └── google
│ └── protobuf
│ └── compiler
├── FuzzTesting
│ ├── FailCases
│ └── Sources
│ ├── EchoImplementation -> ../../Sources/Examples/Echo/Implementation
│ ├── EchoModel -> ../../Sources/Examples/Echo/Model
│ └── ServerFuzzer
├── Performance
│ ├── QPSBenchmark
│ │ ├── Sources
│ │ │ ├── BenchmarkUtils
│ │ │ └── QPSBenchmark
│ │ │ ├── Model
│ │ │ └── Runtime
│ │ ├── Tests
│ │ │ └── BenchmarkUtilsTests
│ │ └── scenarios
│ └── allocations
│ └── tests
│ └── shared
├── Sources
│ ├── CGRPCZlib
│ │ └── include
│ ├── Examples
│ │ ├── Echo
│ │ │ ├── Implementation
│ │ │ ├── Model
│ │ │ └── Runtime
│ │ ├── HelloWorld
│ │ │ ├── Client
│ │ │ ├── Model
│ │ │ └── Server
│ │ ├── PacketCapture
│ │ └── RouteGuide
│ │ ├── Client
│ │ ├── Model
│ │ └── Server
│ ├── GRPC
│ │ ├── CallHandlers
│ │ ├── ClientCalls
│ │ ├── Compression
│ │ ├── ConnectionPool
│ │ ├── GRPCChannel
│ │ ├── Interceptor
│ │ └── ServerCallContexts
│ ├── GRPCConnectionBackoffInteropTest
│ ├── GRPCInteroperabilityTestModels
│ │ ├── Generated
│ │ └── src
│ │ └── proto
│ │ └── grpc
│ │ └── testing
│ ├── GRPCInteroperabilityTests
│ ├── GRPCInteroperabilityTestsImplementation
│ ├── GRPCPerformanceTests
│ │ └── Benchmarks
│ ├── GRPCSampleData
│ └── protoc-gen-grpc-swift
├── Tests
│ └── GRPCTests
│ ├── Codegen
│ │ └── Normalization
│ ├── ConnectionPool
│ └── EchoHelpers
│ ├── Interceptors
│ └── Providers
├── dev
│ └── codegen-tests
│ ├── 01-echo
│ │ ├── golden
│ │ └── proto
│ ├── 02-multifile
│ │ ├── golden
│ │ └── proto
│ ├── 03-multifile-with-module-map
│ │ ├── golden
│ │ └── proto
│ ├── 04-service-with-message-import
│ │ ├── golden
│ │ └── proto
│ ├── 05-service-only
│ │ ├── golden
│ │ └── proto
│ └── 06-test-client-only
│ ├── golden
│ └── proto
├── docs
├── grpc-swift.xcodeproj
│ ├── project.xcworkspace
│ │ ├── xcshareddata
│ │ │ └── swiftpm
│ │ └── xcuserdata
│ │ └── yashdesa.xcuserdatad
│ ├── xcshareddata
│ │ └── xcschemes
│ └── xcuserdata
│ └── yashdesa.xcuserdatad
│ └── xcschemes
└── scripts
@yashdesai7 I was finally able to reproduce the build errors.
I dug a bit into the errors and what Xcode is doing here. Sadly, how swift package generate-xcodeproj
is generating a project is not compatible any more with what SPM is doing.
Furthermore, it doesn't look like we can easily fix this from the NIO/gRPC side.
Maybe you can explain your restriction around why you can't use SPM right now and how/where you want to integrate gRPC a bit and I might be able to suggest alternative solutions.
Moving to SPM requires larger efforts across teams and I dont think it's going to happen anytime soon.
@FranzBusch you also mentioned grpc-Lite-swift-Package
, I dont see that target. is there a lite version of gRPC swift implementation ?
@yashdesai7 that was just my brain getting things mixed up. There are some variations of grpc-Lite floating around but nothing in Swift.
I am currently trying to think of different solutions how you could still integrate grpc-swift without relying on the generated project.
How are you using/planning to use the xcproj? Are you just building a framework and then integrate it manually or is the project part of an xcworkspace in the end?
Are you just building a framework and then integrate it manually ?
Yes
is the project part of an xcworkspace in the end?
I explored a cocoapod option as well but , grpc-swift also brings in SwiftProtobuf.framework that's causing build issues as we already integrated SwiftProtobuf.framework directly. But I am open to this as well. If I can work around SwiftProtobuf as well.
Sadly, I don't think there is much we can do for you here. SPM is the official integration method and using the generated xcproj
is deprecated.
The only thing that I would try is to build an xcframework from swift-grpc
. This is another unsupported workflow but I have seen people make it work with other packages (Though I am not sure if this is just going to end up in the same errors). However, one important note on the integration of packages as frameworks in general. It is super easy to get duplicated symbols or versions clashes this way.
In the end, I can only recommend you to push the migration to SPM since the ecosystem is moving more and more into that direction.
Interesting, It is not working for NIOSSL
On Tue, May 17, 2022 at 11:49 PM Cory Benfield @.***> wrote:
I think the "allow non-modular includes" setting should work so long as you apply it to all targets.
— Reply to this email directly, view it on GitHub https://github.com/grpc/grpc-swift/issues/1408#issuecomment-1129636031, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALEVB3YP7NEJW3NQO6GAULVKSHIVANCNFSM5WGWZG4Q . You are receiving this because you authored the thread.Message ID: @.***>
--
Thanks, Yash Desai Contact: +1 607 644 5866
Following up on this, it still doesn't work now that Xcode supports building frameworks from packages. Reference here.
I'm trying this:
xcodebuild archive -scheme GRPC -destination "generic/platform=iOS" -archivePath "archives/GRPC-iOS"
xcodebuild archive -scheme GRPC -destination "generic/platform=iOS Simulator" -archivePath "archives/GRPC-iOS_Simulator"
xcodebuild -create-xcframework -archive archives/GRPC-iOS.xcarchive -framework GRPC.framework -archive archives/GRPC-iOS_Simulator.xcarchive -framework GRPC.framework -output xcframeworks/GRPC.xcframework
Also related to the issue https://github.com/grpc/grpc-swift/issues/1405 : the workaround script no longer works.
And the issue https://github.com/grpc/grpc-swift/issues/1391: It's not possible to use BUILD_LIBRARY_FOR_DISTRIBUTION
.
Also related to:
What are you trying to achieve?
Trying to build the
GRPC
target using xcodeproj file.What have you tried so far?
swift package generate-xcodeproj
CNIOBoringSSLShims
with errorInclude of non-modular header inside framework module 'CNIOBoringSSL.CNIOBoringSSL_bn': '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/clang/include/inttypes.h'
Allow non modular includes in Framework modules
to YESNIOSSL
with errorAllow non modular includes in Framework modules
to YES does not help here.could not build Objective-C module 'CNIOBoringSSL'
CNIOBoringSSL
andNIOSSL
already hasOther Swift Flags
build setting with-fmodule-map-file=$(SRCROOT)/.build/checkouts/swift-nio/Sources/CNIOWindows/include/module.modulemap
so I updated this module map with custom path for 'CNIOBoringSSL' that helped fixing thecould not build Objective-C module
but I started getting symbol not found in the scope for below enum althoughCNIOBoringSSL_ssl.h
is part ofCNIOBoringSSL.h
which is part of my custom module map which looks likemodule CNIOBoringSSL { header "/Users/yash/Downloads/grpc-swift-main/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSL/include/CNIOBoringSSL.h" export * }
module CNIOBoringSSLShims { header "/Users/yash/Downloads/grpc-swift-main/.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSLShims/include/CNIOBoringSSLShims.h" export * }
enum ssl_private_key_result_t BORINGSSL_ENUM_INT { ssl_private_key_success, ssl_private_key_retry, ssl_private_key_failure, };