Skip to content

SPM external dependency of Realm fails to build #3928

@jmbene

Description

@jmbene

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:

  1. tuist dependency fetch
  2. tuist cache warm

It is also replicable when generating and focusing the project and then building in Xcode:

  1. tuist dependency fetch
  2. tuist generate
  3. tuist focus Tuist2
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions