grpc / grpc-swift

The Swift language implementation of gRPC.
Apache License 2.0
2.01k stars 413 forks source link

error: missing required module 'CNIOAtomics' #683

Open chris-speebly opened 4 years ago

chris-speebly commented 4 years ago

Question Checklist

Question Subject

I receive this error "missing required module 'CNIOAtomics' " when I add an ios binary framework with a swift-GRPC dependency to an XCode ios app project.

Question Description

objective to distribute an ios binary framework that has a swift-GRPC dependency

dev environment (this works) i have an ios app that references an ios framework. In the ios framework, i have added swift-GRPC using the XCode 11 method to add a swift package. This works.

Test environment (does not build)

In my test environment, I have an XCode ios project with binary from the dev environment framework project as a library dependency. When i build the ios app i receive this error message "missing require module CNIOAtomics".

I realize this issue probably does not have nuch to do with swift-grpc and might have more to do with my setup.

If someone can point me in a direction to help solve this issue it would be greatly apprecated

thanks

Chris

kmarcell commented 4 years ago

I had the same issue, and it went away when I added the framework that is dependent on the grpc-swift Swift Package to the "Link Binary with Libraries" section. I'm not sure if it'll work for you, but this helped me.

chris-speebly commented 4 years ago

Thanks for your response Kmarcell

Which NIO dependencies did you add? did you add them using Swift manager?

thanks

Chris

kmarcell commented 4 years ago

Hi @chris-speebly,

I created a package that depends on .package(url: "https://github.com/grpc/grpc-swift", .branch("nio")),, then added the package to an xcode project (framework), which is used by the app.

I've run into this issue again: "missing required module 'CNIOAtomics'" with unit tests, I could not find a solution around it yet.

chris-speebly commented 4 years ago

im able to get an ios app to compile that references the binary FrameworkSDK. The FrameworkSDK includes the swift-grpc package. In the client, i added the nio swift package and referenced nio and niohttp1 static libraries. My next step is to try to nfigure out how to eliminate the need for the nio and niohttp1 dependencies. stay tuned :)

saltyskip commented 4 years ago

@kmarcell same issue here on unit tests, were you able to find the workaround?

kosukeohmura commented 4 years ago

I tried to build universal framework that imports grpc-swift with SwiftPM using xcodebuild build command and faced same error. It can be built on debug mode.

The error log says that failed to CNIOSHA1.modulemap of swift-nio-transport-services. Is the problem not of grpc-swift but of swift-nio-transport-services?

A part of the error log:

CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'NIOTransportServices' from project 'swift-nio-transport-services')
    cd /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services
    export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
    export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk
    export TOOLCHAINS="com.apple.dt.toolchain.XcodeDefault com.apple.dt.toolchain.XcodeDefault"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name NIOTransportServices -O -whole-module-optimization -enforce-exclusivity=checked @/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/NIOTransportServices.o.SwiftFileList -DSWIFT_PACKAGE -Xcc -fmodule-map-file=/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIOSHA1.modulemap -Xcc -fmodule-map-file=/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIOAtomics.modulemap -Xcc -fmodule-map-file=/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIODarwin.modulemap -Xcc -fmodule-map-file=/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIOLinux.modulemap -DXcode -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -target arm64-apple-ios8.0 -g -Xfrontend -serialize-debugging-options -embed-bitcode-marker -swift-version 5 -I /Users/me/Library/Developer/Xcode/DerivedData/MySDK-atuztllpnqcksibqzsjiwabkcbbu/Build/Products/Release-iphoneos -F /Users/me/Library/Developer/Xcode/DerivedData/MySDK-atuztllpnqcksibqzsjiwabkcbbu/Build/Products/Release-iphoneos -F /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks -c -num-threads 8 -output-file-map /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/NIOTransportServices-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/NIOTransportServices.swiftmodule -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/Sources/CNIOSHA1/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/Sources/CNIOAtomics/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/Sources/CNIODarwin/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/Sources/CNIOLinux/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-atuztllpnqcksibqzsjiwabkcbbu/Build/Products/Release-iphoneos/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/DerivedSources-normal/arm64 -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/DerivedSources/arm64 -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/DerivedSources -Xcc -DSWIFT_PACKAGE -working-directory /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services

CompileSwift normal arm64 (in target 'NIOTransportServices' from project 'swift-nio-transport-services')
    cd /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSChannelOptions.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSConnectionBootstrap.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSConnectionChannel.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSErrors.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSEventLoop.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSEventLoopGroup.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSListenerBootstrap.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSListenerChannel.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSNetworkEvents.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/SocketAddress+NWEndpoint.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/StateManagedChannel.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/TCPOptions+SocketChannelOption.swift -supplementary-output-file-map /var/folders/tt/wqgftj2j1fz_0bh7x4mdhpp80000gp/T/supplementaryOutputs-b537b0 -target arm64-apple-ios8.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -I /Users/me/Library/Developer/Xcode/DerivedData/MySDK-atuztllpnqcksibqzsjiwabkcbbu/Build/Products/Release-iphoneos -F /Users/me/Library/Developer/Xcode/DerivedData/MySDK-atuztllpnqcksibqzsjiwabkcbbu/Build/Products/Release-iphoneos -F /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks -g -swift-version 5 -enforce-exclusivity=checked -O -D SWIFT_PACKAGE -D Xcode -serialize-debugging-options -Xcc -working-directory -Xcc /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services -Xcc -fmodule-map-file=/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIOSHA1.modulemap -Xcc -fmodule-map-file=/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIOAtomics.modulemap -Xcc -fmodule-map-file=/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIODarwin.modulemap -Xcc -fmodule-map-file=/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIOLinux.modulemap -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/Sources/CNIOSHA1/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/Sources/CNIOAtomics/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/Sources/CNIODarwin/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/Sources/CNIOLinux/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-atuztllpnqcksibqzsjiwabkcbbu/Build/Products/Release-iphoneos/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/DerivedSources-normal/arm64 -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/DerivedSources/arm64 -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/DerivedSources -Xcc -DSWIFT_PACKAGE -module-name NIOTransportServices -num-threads 8 -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/NIOTSChannelOptions.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/NIOTSConnectionBootstrap.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/NIOTSConnectionChannel.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/NIOTSErrors.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/NIOTSEventLoop.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/NIOTSEventLoopGroup.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/NIOTSListenerBootstrap.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/NIOTSListenerChannel.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/NIOTSNetworkEvents.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/SocketAddress+NWEndpoint.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/StateManagedChannel.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/TCPOptions+SocketChannelOption.o -embed-bitcode-marker
Command CompileSwift failed with a nonzero exit code

CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler (in target 'NIOTransportServices' from project 'swift-nio-transport-services')
    cd /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services
    export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
    export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk
    export TOOLCHAINS="com.apple.dt.toolchain.XcodeDefault com.apple.dt.toolchain.XcodeDefault"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name NIOTransportServices -O -whole-module-optimization -enforce-exclusivity=checked @/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/NIOTransportServices.o.SwiftFileList -DSWIFT_PACKAGE -Xcc -fmodule-map-file=/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIOSHA1.modulemap -Xcc -fmodule-map-file=/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIOAtomics.modulemap -Xcc -fmodule-map-file=/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIODarwin.modulemap -Xcc -fmodule-map-file=/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIOLinux.modulemap -DXcode -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -target armv7-apple-ios8.0 -g -Xfrontend -serialize-debugging-options -embed-bitcode-marker -swift-version 5 -I /Users/me/Library/Developer/Xcode/DerivedData/MySDK-atuztllpnqcksibqzsjiwabkcbbu/Build/Products/Release-iphoneos -F /Users/me/Library/Developer/Xcode/DerivedData/MySDK-atuztllpnqcksibqzsjiwabkcbbu/Build/Products/Release-iphoneos -F /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks -c -num-threads 8 -output-file-map /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/NIOTransportServices-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/NIOTransportServices.swiftmodule -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/Sources/CNIOSHA1/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/Sources/CNIOAtomics/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/Sources/CNIODarwin/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/Sources/CNIOLinux/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-atuztllpnqcksibqzsjiwabkcbbu/Build/Products/Release-iphoneos/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/DerivedSources-normal/armv7 -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/DerivedSources/armv7 -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/DerivedSources -Xcc -DSWIFT_PACKAGE -working-directory /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services

CompileSwift normal armv7 (in target 'NIOTransportServices' from project 'swift-nio-transport-services')
    cd /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSChannelOptions.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSConnectionBootstrap.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSConnectionChannel.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSErrors.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSEventLoop.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSEventLoopGroup.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSListenerBootstrap.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSListenerChannel.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/NIOTSNetworkEvents.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/SocketAddress+NWEndpoint.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/StateManagedChannel.swift /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/TCPOptions+SocketChannelOption.swift -supplementary-output-file-map /var/folders/tt/wqgftj2j1fz_0bh7x4mdhpp80000gp/T/supplementaryOutputs-f7072e -target armv7-apple-ios8.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -I /Users/me/Library/Developer/Xcode/DerivedData/MySDK-atuztllpnqcksibqzsjiwabkcbbu/Build/Products/Release-iphoneos -F /Users/me/Library/Developer/Xcode/DerivedData/MySDK-atuztllpnqcksibqzsjiwabkcbbu/Build/Products/Release-iphoneos -F /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks -g -swift-version 5 -enforce-exclusivity=checked -O -D SWIFT_PACKAGE -D Xcode -serialize-debugging-options -Xcc -working-directory -Xcc /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services -Xcc -fmodule-map-file=/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIOSHA1.modulemap -Xcc -fmodule-map-file=/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIOAtomics.modulemap -Xcc -fmodule-map-file=/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIODarwin.modulemap -Xcc -fmodule-map-file=/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIOLinux.modulemap -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/Sources/CNIOSHA1/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/Sources/CNIOAtomics/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/Sources/CNIODarwin/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/Sources/CNIOLinux/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-atuztllpnqcksibqzsjiwabkcbbu/Build/Products/Release-iphoneos/include -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/DerivedSources-normal/armv7 -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/DerivedSources/armv7 -Xcc -I/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/DerivedSources -Xcc -DSWIFT_PACKAGE -module-name NIOTransportServices -num-threads 8 -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/NIOTSChannelOptions.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/NIOTSConnectionBootstrap.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/NIOTSConnectionChannel.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/NIOTSErrors.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/NIOTSEventLoop.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/NIOTSEventLoopGroup.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/NIOTSListenerBootstrap.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/NIOTSListenerChannel.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/NIOTSNetworkEvents.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/SocketAddress+NWEndpoint.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/StateManagedChannel.o -o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/TCPOptions+SocketChannelOption.o -embed-bitcode-marker
<unknown>:0: error: module map file '/Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/GeneratedModuleMaps/iphoneos/CNIOSHA1.modulemap' not found
<unknown>:0: error: missing required module 'CNIOAtomics'

CreateUniversalBinary /Users/me/Library/Developer/Xcode/DerivedData/MySDK-atuztllpnqcksibqzsjiwabkcbbu/Build/Products/Release-iphoneos/NIOTLS.o normal armv7\ arm64 (in target 'NIOTLS' from project 'swift-nio')
    cd /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo -create /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/build/swift-nio.build/Release-iphoneos/NIOTLS.build/Objects-normal/armv7/Binary/NIOTLS.o /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio/build/swift-nio.build/Release-iphoneos/NIOTLS.build/Objects-normal/arm64/Binary/NIOTLS.o -output /Users/me/Library/Developer/Xcode/DerivedData/MySDK-atuztllpnqcksibqzsjiwabkcbbu/Build/Products/Release-iphoneos/NIOTLS.o

RegisterExecutionPolicyException /Users/me/Library/Developer/Xcode/DerivedData/MySDK-atuztllpnqcksibqzsjiwabkcbbu/Build/Products/Release-iphoneos/NIOTLS.o (in target 'NIOTLS' from project 'swift-nio')
    cd /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio
    builtin-RegisterExecutionPolicyException /Users/me/Library/Developer/Xcode/DerivedData/MySDK-atuztllpnqcksibqzsjiwabkcbbu/Build/Products/Release-iphoneos/NIOTLS.o
note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'NIOTLS' from project 'swift-nio')

WriteAuxiliaryFile /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/NIOTransportServices.o.LinkFileList (in target 'NIOTransportServices' from project 'swift-nio-transport-services')
    cd /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services
    write-file /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/arm64/NIOTransportServices.o.LinkFileList

WriteAuxiliaryFile /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/NIOTransportServices.o.LinkFileList (in target 'NIOTransportServices' from project 'swift-nio-transport-services')
    cd /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services
    write-file /Users/me/Library/Developer/Xcode/DerivedData/MySDK-eaghabnmubciucgwerehdblmzwyk/SourcePackages/checkouts/swift-nio-transport-services/build/swift-nio-transport-services.build/Release-iphoneos/NIOTransportServices.build/Objects-normal/armv7/NIOTransportServices.o.LinkFileList

** BUILD FAILED **

The following build commands failed:
    CompileSwift normal arm64
    CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler
    CompileSwift normal armv7
(3 failures)

** BUILD FAILED **
davidvartan commented 4 years ago

Seeing this error when building a static library that uses the nio branch via SPM. However, works fine when building a regular OS X target that references that static library.

weissi commented 4 years ago

@KosukeOhmura how do you depend on gRPC Swift? Using Xcode's package support?

kosukeohmura commented 4 years ago

@weissi Yes, using Xcode 11 GUI.

weissi commented 4 years ago

@KosukeOhmura could you send me the output of

proj=NIOSMTP.xcodeproj; grep -A5 isa\ \=\ XCRemoteSwiftPackageReference "$proj/project.pbxproj"; grep -C10 packageProductDependencies "$proj/project.pbxproj"

replacing NIOSMTP.xcodeproj with your actual project? And run this command from the directory that contains your project

weissi commented 4 years ago

@KosukeOhmura is your project open-source by any chance so we could have a look?

kosukeohmura commented 4 years ago

@weissi Thank you for your reply.

It is not an OSS but I will create a project that can reproduce the error tomorrow.

weissi commented 4 years ago

@KosukeOhmura oh aweseome, that's even better! thank you

kosukeohmura commented 4 years ago

@weissi Sorry for the late reply. I've made a repository https://github.com/KosukeOhmura/GRPCSwiftImportChallange for reproducing it.

weissi commented 4 years ago

@KosukeOhmura Thank you so much, I reproduce! Will track it down and will let you know.

weissi commented 4 years ago

@KosukeOhmura I just noticed that the problem is not GRPC itself. If in Xcode you select the GRPCSwiftImportChallenge scheme itself, the build works.

Screenshot 2020-02-04 at 11 52 18 am

The problem is with the odd script in GRPCSwiftImportChallengeUniversal. If you use Xcode's Swift package support you shouldn't need to build any universal frameworks. It's much simpler, you just depend on the package and everything works automagically without scripts.

Can you confirm you can actually build it?

So, I would recommend on not building a framework at all and leveraging Xcode's Swift package support, it'll just work on all platforms. If for any reason you have to distribute a binary framework, you should use .xcframeworks, explained in WWDC 2019#416

weissi commented 4 years ago

@KosukeOhmura just had some folks look at this. The problem with your script is that it doesn't pass -scheme to xcodebuild which will trigger the legacy builds which are incompatible with Xcode's package support. So if you have to use this script, make all xcodebuild invocations have a -scheme SchemeName

chris-speebly commented 4 years ago

Will this work if you add the binary to an iOS project?

On Tue, Feb 4, 2020 at 11:37 AM Johannes Weiss notifications@github.com wrote:

@KosukeOhmura https://github.com/KosukeOhmura just had some folks look at this. The problem with your script is that it doesn't pass -scheme to xcodebuild which will trigger the legacy builds which are incompatible with Xcode's package support. So if you have to use this script, make all xcodebuild invocations have a -scheme SchemeName

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/grpc/grpc-swift/issues/683?email_source=notifications&email_token=AN5SEQKERNFISMF2DNNKKT3RBGKT3A5CNFSM4KCPM4H2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKYJOPA#issuecomment-581998396, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN5SEQLKDGVHGHNY6QKR5JTRBGKT3ANCNFSM4KCPM4HQ .

weissi commented 4 years ago

Will this work if you add the binary to an iOS project?

The -scheme shouldn't break anything but it'll make the package support work. If you want to make a binary library that you distribute you should use .xcframeworks.

kosukeohmura commented 4 years ago

@weissi I've succeeded to make a binary framework by using .xcframework. Thank you for the investigating and information. But I've run into this issue again when I imported the .xcframework to an iOS app and built it.

I've updated the repository, would you check it again, please?

weissi commented 4 years ago

@KosukeOhmura Thank you for updating the project. I do reproduce the issue too :(. I'm following up with some folks that are more knowledgeable about .xcframeworks than I am.

For the time being, couldn't you make the GRPCImportChallenge project a Swift Package instead of an Xcode project and .xcframework? If you made that a Swift package, then you could just add that to your app AppImportsXCFramework.

kosukeohmura commented 4 years ago

@weissi My needs are:

Since it is impossible to make my framework as a Swift package without disclosing source codes, I think providing as a binary framework is an only way to meet the requirements.

chris-speebly commented 4 years ago

I’m in the same vote.

I think when grpc is released as a cocoapod in 1.0.0 it will be possible to add a compiled framework with a grpc dependency to an iOS app project.

On Thu, Feb 6, 2020 at 9:28 PM Kosuke Ohmura notifications@github.com wrote:

@weissi https://github.com/weissi My needs are:

  • distribute my framework (depends on grpc-swift) to only one client
  • without disclosing our git repo and source codes
  • easy, simple

Since it is impossible to make my framework as a Swift package without disclosing source codes, I think providing as a binary framework is an only way to meet the requirements.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/grpc/grpc-swift/issues/683?email_source=notifications&email_token=AN5SEQOXJKKJF5TH7VBQ2UDRBTBMTA5CNFSM4KCPM4H2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELBQCPY#issuecomment-583205183, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN5SEQJYEH2452B4W2UFO7LRBTBMTANCNFSM4KCPM4HQ .

weissi commented 4 years ago

@KosukeOhmura / @chris-speebly understood. I think you might have hit a limitation with Xcode’s package support. I’ll follow up when I know more. Don’t think this is related to NIO/gRPC at all but more they way the stuff is distributed.

weissi commented 4 years ago

@KosukeOhmura / @chris-speebly okay, unfortunately, I can confirm the limitation. An .xcframework can only contain a single module. So if you want to do that, you'd need to create one .xcframework per module. I know this probably doesn't sound appealing but that's the current situation. Please file Feedbacks if that's not acceptable or causes a lot of work for you.

kosukeohmura commented 4 years ago

@weissi Thank you for investigating.

you'd need to create one .xcframework per module.

Could you explain how to do it actually please? I don't have idea to how to do it.

Taking my repository for example, do you mean to run xcodebuild -create-xcframework for GRPCSwiftImportChallange, grpc-swift and each libraries grpc-swift dependes on? If so, how do I import grpc-swift to GRPCSwiftImportChallange when developing it?

weissi commented 4 years ago

@weissi Thank you for investigating.

you'd need to create one .xcframework per module.

Could you explain how to do it actually please? I don't have idea to how to do it.

Taking my repository for example, do you mean to run xcodebuild -create-xcframework for GRPCSwiftImportChallange, grpc-swift and each libraries grpc-swift dependes on? If so, how do I import grpc-swift to GRPCSwiftImportChallange when developing it?

Hi @KosukeOhmura , unfortunately, I only know how to do this with an Xcode package dependency (ie. without binary frameworks).

And yes, as far as I understand, you'd need to run xcodebuild -create-xcframework once for each module... You could probably automate that but the whole process really doesn’t sound great...

jhbritton-RSK commented 3 years ago

I get this error too when I am running my Unit Tests. The application itself runs fine but when it comes to running the test it get this build error.

I did look at the previous message but i belive the problem im facing wouldn't be solved by the above as am using the SwiftPackageManager.

Lukasa commented 3 years ago

This issue is usually the result of Xcode having trouble with the package graph. I recommend blowing away DerivedData and trying again. If that doesn’t help, you’ll need to file a bug report against Xcode using FeedbackAssistant.

wuxiaohua1011 commented 3 years ago

I was able to install vapor https://vapor.codes/ using SPM and got this problem resolved.

Vapor probably uses CNIOAtomics as a dependency

geri-m commented 3 years ago

@KosukeOhmura / @chris-speebly okay, unfortunately, I can confirm the limitation. An .xcframework can only contain a single module. So if you want to do that, you'd need to create one .xcframework per module. I know this probably doesn't sound appealing but that's the current situation. Please file Feedbacks if that's not acceptable or causes a lot of work for you.

@weissi I'm creating a binary XCFramework which is distributed via SwiftPM. The XCFramework references grpc-swift (current version 1.1.0; via Swift PM). When integrated into an app, I also run into the error: missing required module 'CNIOAtomics' Issue. As the last statement was already some time ago, I wanted to check if there is an update or workaround in the mean time.

weissi commented 3 years ago

CC @glbrntt

geri-m commented 3 years ago

@weissi @glbrntt sorry for bothering again. but is there any hint you can give or resource you can point me to? Many thanks in advance.

glbrntt commented 3 years ago

I don't believe there's any update on this; the comment above you referenced is still accurate.

chrishyze commented 2 years ago

According to this: https://github.com/apple/swift-nio/issues/1128#issuecomment-527566361.

I added build setting -Xcc -fmodule-map-file=$(PROJECT_TEMP_ROOT)/GeneratedModuleMaps/CNIOAtomics.modulemap to OTHER_SWIFT_FLAGS in my project test target, and it worked fine for me.

It also can fix any issue like missing required module 'XXX' I got.

meokz commented 2 years ago

Adding OTHER_SWIFT_FLAGS does not help me 😭

geri-m commented 2 years ago

@kosukeohmura have you been able to make this work for your case?

FranzBusch commented 2 years ago

@glbrntt did you try the -fmoudle-map-file setting above? This should fix it right now.

geri-m commented 2 years ago

@FranzBusch well, Xcode actually adds the fmodule-map-file paraemeter correctly to the compile command ... -Xcc -fmodule-map-file\=/Users/xxx/Library/Developer/Xcode/DerivedData/ReferenceApp-bjtrgvpqimrxzndbhcmwnborqajw/Build/Intermediates.noindex/GeneratedModuleMaps-iphoneos/CNIOAtomics.modulemap

Note: I'm facing a problem, that @kosukeohmura referred. (not the one that my test target is not working)

FranzBusch commented 2 years ago

@geri-m ah sorry I missed that part.

I have one idea that I successfully used to work around a similar issue. You can try creating a package yourself that vends a library with the type dynamic and a GRPC as a depends of that package. When building this it should produce a dynamic framework.

In theory you could bundle these as an xcframework.

However, I don't know if this will work and it is not a recommended way. Since source packages should not be distributed as xcframeworks.

bimawa commented 2 years ago

Guys still reproduced on xcode13.3.1 installing cross SPM. <unknown>:0: error: missing required module 'CNIOAtomics'

bimawa commented 2 years ago

Ok guys! I did it: Just added next configs to OTHER SWIFT FLAGS:

-Xcc 
-fmodule-map-file=$(PROJECT_TEMP_ROOT)/GeneratedModuleMaps-iphonesimulator/CNIODarwin.modulemap
-Xcc
-fmodule-map-file=$(PROJECT_TEMP_ROOT)/GeneratedModuleMaps-iphonesimulator/CNIOAtomics.modulemap

Same for device, but without iphonesimulator.

geri-m commented 2 years ago

@bimawa unfortunately that didn't work for me. Would you mind sharing your package.swift file? (XCode 13.4)

bimawa commented 2 years ago

@geri-m Damn it, you are right.. :( GeneratedMouleMaps is appeared after when I set SMP dependency in host project. CleanShot 2022-05-20 at 12 14 11 When I added this dependency on GRPC-swift repo, SPM generated to me GeneratedModules in Build folder. ..

I go back to dig in this...

bimawa commented 2 years ago

Nothing help. It looks like a bug on swift side not fixed. So, only sources dependency working correctly. Currently, I go try to use github repositories for my protoLibrary.

Binary framework should work too, but we should hide to the private all imports of GRPC with "@_implementationOnly" attribute, but I did not test it yet. Jordan talking about it here: https://forums.swift.org/t/update-on-implementation-only-imports/26996

bimawa commented 2 years ago

Ok guys, I added new library to Package.swift for swift-nio

let package = Package(
    name: "swift-nio",
    products: [
        .library(name: "NIOCore", type: .dynamic,   targets: ["NIOCore"]),
        .library(name: "NIO", type: .dynamic,   targets: ["NIO"]),
        .library(name: "NIOEmbedded", type: .dynamic,   targets: ["NIOEmbedded"]),
        .library(name: "CNIOAtomics", type: .dynamic,   targets: ["CNIOAtomics"]), // here
        .library(name: "NIOPosix", type: .dynamic,   targets: ["NIOPosix"]),
        .library(name: "_NIOConcurrency", type: .dynamic,   targets: ["_NIOConcurrency"]),
        .library(name: "NIOTLS", type: .dynamic,   targets: ["NIOTLS"]),
        .library(name: "NIOHTTP1", type: .dynamic,   targets: ["NIOHTTP1"]),
        .library(name: "NIOConcurrencyHelpers", type: .dynamic,   targets: ["NIOConcurrencyHelpers"]),
        .library(name: "NIOFoundationCompat", type: .dynamic,   targets: ["NIOFoundationCompat"]),
        .library(name: "NIOWebSocket", type: .dynamic,   targets: ["NIOWebSocket"]),
        .library(name: "NIOTestUtils", type: .dynamic,   targets: ["NIOTestUtils"]),
    ],
    dependencies: [
    ],
    targets: targets
)

Then created xcFramework for CNIOAtomics by my script: create-xcframework.sh CNIOAtomics. here After import this framework I got the next errors:

CleanShot 2022-06-19 at 15 12 01@2x

also I found the PR for remove CNIOAtomics and CNIOSHA1

mylaluna commented 1 year ago

This issue still exists...

itsPG commented 1 year ago

I ran into this issue.

and solved by adding "grpc" to the linking libraries

screenshot

@mylaluna I hope this could help you

mylaluna commented 1 year ago

Hi @itsPG ,

You saved my day. Adding GRPC to the Link Binary with Libraries in test target works.

Thanks :)

palfonsoilluscio commented 1 year ago

Hi everyone:

I have tried all above answers, but unfortunately no success for me. I'm working on a framework which uses swift-grpc, we need to distribute the binary via XCFramework, so tried adding the flag, the GRPC to the Link Binary with Libraries and @_implementationOnly fixes. Still facing the "error: missing required module 'CNIOAtomics'" when creating the XCFramework via script. Kindly advice on what the ultimate solution could be?