Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error "Header 'Realm/RLMDictionary_Private.h' not found" in module.modulemap #7344

Closed
npjk opened this issue Jul 17, 2021 · 10 comments
Closed

Comments

@npjk
Copy link
Contributor

npjk commented Jul 17, 2021

Goals

I am trying to use version of Realm in a SPM package.

Expected Results

Xcode should resolve the dependencies successfully and then the package should build successfully.

Actual Results

The dependency is resolved successfully but then the build fails with two errors :

Screenshot 2021-07-17 at 21 04 43

Steps for others to Reproduce

  1. Create a swift package with Xcode.
  2. Add realm-cocoa as a dependency.
  3. Start building.

Code Sample

This is the Package.swift file :

let package = Package(
    name: "MyLibrary",
    platforms: [.iOS(.v14)],
    products: [
        .library(
            name: "MyLibrary",
            targets: ["MyLibrary"]
        ),
    ],
    dependencies: [
        .package(name: "Realm", url: "https://github.com/realm/realm-cocoa", .upToNextMajor(from: "10.10.0")),
    ],
    targets: [
        .target(
            name: "MyLibrary",
            dependencies: [
                .product(name: "Realm", package: "Realm"),
                .product(name: "RealmSwift", package: "Realm"),
            ]
        ),
        .testTarget(
            name: "MyLibraryTests",
            dependencies: [
                .target(name: "MyLibrary"),
                .product(name: "Realm", package: "Realm"),
                .product(name: "RealmSwift", package: "Realm"),
            ]
        ),
    ]
)

Version of Realm and Tooling

Realm framework version:

From 10.8.0 to 10.10.0.

Build succeeds with 10.7.7 or earlier.

Xcode version:

12.5.1

iOS/OSX version:

I tried targeting an iPhone running on iOS 14.6 and simulator running iOS 14.3.

Dependency manager + version:

SPM, bundled with Xcode

@leemaguire
Copy link
Contributor

leemaguire commented Jul 19, 2021

Hi @nicolas255 I cannot reproduce your issue, have you cleaned your build, derived data and reset package caches?

@npjk
Copy link
Contributor Author

npjk commented Jul 19, 2021

Hi @leemaguire, I tested all of that but no luck there…

In the meantime, I also tried to upgrade from 10.7.4 to 10.10.0 in an existing project where packages are managed by Xcode (it's an iOS app project) and I have the same two issues. Then I tried to replicate them in a fresh iOS project and same issues again.

One thing that could be relevant (?) is that I am trying this on a case sensitive file system. At first I thought it could be that but I don't see any issue with the file names.

@npjk
Copy link
Contributor Author

npjk commented Jul 19, 2021

Another update: we managed to try on two additional macs. One of them (Intel) is also on a case sensitive FS and has the same issues. The other one (M1) is not on a case sensitive FS and it builds successfully… Both tries were done with Xcode 12.5.1.

I tried to see why that error could occur but I don't have any experience with packages that include anything other than Swift.

Edit: third mac (Intel) with case sensitive FS has the same issues.

@schmidan
Copy link

I ran into the same issue with SPM and 10.10.0 downgrading to 10.7.7 helps.
My system is Case Sensitive. I will report back when i get to test on an insensitive system.

for what its worth the apps realm is being upgraded from 3.21.0 :)

@npjk
Copy link
Contributor Author

npjk commented Jul 21, 2021

As soon as I have a little more time I will try to narrow down to the changes that cause this. Or at least to a specific commit…

@npjk
Copy link
Contributor Author

npjk commented Jul 25, 2021

So I found the issue, it's in the symlink there: https://github.com/realm/realm-cocoa/blob/267531b38c710f5a7f3352b34eb95ece53773093/include/Realm/RLMDictionary_Private.h which links to a realm directory instead of Realm.

I made a fork with a fix for it https://github.com/nicolas255/realm-cocoa/commit/5893c464fe2ffbcbed15c4bcb6574f999dcc3e15

And then it builds (after cleaning up the derived data)!

@npjk
Copy link
Contributor Author

npjk commented Aug 3, 2021

Could someone else look into this ? I'm kind of stuck with that question mark issue… 😟

@jsflax
Copy link
Contributor

jsflax commented Aug 3, 2021

@nicolas255 we'll take a look at your PR today and try to get a release out later tonight.

@npjk
Copy link
Contributor Author

npjk commented Aug 3, 2021

@jsflax awesome !!

@schmidan could you try to upgrade to the revision of the PR (#7360) and see if you can build with it ??

Using :

.package(name: "Realm", url: "https://github.com/nicolas255/realm-cocoa", .branch("master")),

(or the equivalent using Xcode UI)

@leemaguire
Copy link
Contributor

Closed via #7360

@sync-by-unito sync-by-unito bot closed this as completed Aug 30, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants