tuist: SPM external dependency of Realm fails to build
Describe the bug
I’m having problems with version 2.0 of Tuist and the Realm dependency when I’m trying to add a SPM dependency in the new Dependencies.swift file. If I fetch the dependencies and then try to warm the cache I receive the following error:
$ tuist cache warm
Resolved cache profile 'Development' from Tuist's defaults
Generating workspace Tuist2.xcworkspace
Generating project Tuist2
Generating project RealmDatabase
Generating project Realm
Hashing cacheable targets
Targets to be cached: Bid, ObjectStore, Realm, Storage, SyncClient, Tuist2Kit, Tuist2UI
Filtering cacheable targets
Generating workspace Tuist2.xcworkspace
Generating project Tuist2
Generating project Realm
Generating project RealmDatabase
Building cacheable targets
** BUILD FAILED **
The following build commands failed:
CompileC /Users/user/Library/Developer/Xcode/DerivedData/Tuist2-ghwkelueyzdckhgvykcnxryadssl/Build/Intermediates.noindex/RealmDatabase.build/Debug-iphonesimulator/Storage.build/Objects-normal/x86_64/version.o /Users/josemiguel.benedicto/Downloads/tuist2/Tuist/Dependencies/SwiftPackageManager/.build/checkouts/realm-core/src/realm/version.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'Storage' from project 'RealmDatabase')
(1 failure)
[Storage] Compiling version.cpp
❌ /Users/user/Downloads/tuist2/Tuist/Dependencies/SwiftPackageManager/.build/checkouts/realm-core/src/realm/version.cpp:35:5: non-void function 'get_extra' should return a value [-Wreturn-type]
return REALM_VERSION_EXTRA;
^
If I generate the project, focus in the app target and build it without warming the cache I receive the same error:
❌ /Users/user/Documents/workspace/tuist2/Tuist/Dependencies/SwiftPackageManager/.build/checkouts/realm-core/src/realm/version.cpp:35:5: non-void function 'get_extra' should return a value [-Wreturn-type]
return REALM_VERSION_EXTRA;
^
The following build commands failed:
CompileC /Users/user/Library/Developer/Xcode/DerivedData/Tuist2-ghwkelueyzdckhgvykcnxryadssl/Build/Intermediates.noindex/RealmDatabase.build/Debug-iphonesimulator/Storage.build/Objects-normal/x86_64/version.o /Users/user/Downloads/tuist2/Tuist/Dependencies/SwiftPackageManager/.build/checkouts/realm-core/src/realm/version.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'Storage' from project 'RealmDatabase')
(1 failure)
To Reproduce Steps to reproduce the behavior:
I have a super small project that includes Realm dependency to reproduce the issue:
tuist2.zip
Then follow these commands to warm the cache:
- tuist dependency fetch
- tuist cache warm
It is also replicable when generating and focusing the project and then building in Xcode:
- tuist dependency fetch
- tuist generate
- tuist focus Tuist2
- Run the Tuist2 target
Expected behavior The SPM package compiles
Screenshots N/A
Desktop (please complete the following information):
- OS: macOS
- Version 12.1
- Xcode 13.2.1
Additional context I suspect there are some issues relate wrong C++ dialect or some flags that aren’t applied property or missing build settings when compiling.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 14
- Comments: 30 (3 by maintainers)
Folks, this is an open source project. I imagine the maintainers don’t actively use Realm so it’s not immediately something we can budget time for, it would be helpful to get a PR that adds a test for this / attempts a fix we can then review and help further
Would be nice with some updates regarding this issue. Would love to help but I think I won’t be able to 😄
We are currently also facing the issue with Realm. When we include an external SPM dependency that relies on
Realmit fails to build. I already tried out themainbranch oftuistand the issue still persists in the generated project.Is there any progress??
@danyf90 As a test I altered the generated Realm project to add a Headers build phase, then added all the header files to it and it allowed it to get further, however, it failed at a later stage due to symbols and warnings about the header files not being in Realm.h umbrella header. I will have been hacking it to try and add the header files so likely did something wrong there.
Thanks for the information. For now I will move all my other SPM dependencies to use Dependencies.swift and will leave Realm using the previous approach for now.
@Drag0ndust a part of the fix will be included in the next version (which probably will be released today in some hours), yet there will be the need of a second fix and it won’t compile yet. But you may workaround this second issue by adding the correct
HEADER_SEARCH_PATH