# Xcodebuild fails with 'missing module map file' when compiling framework with a package dependency

**URL:** <https://forums.swift.org/t/xcodebuild-fails-with-missing-module-map-file-when-compiling-framework-with-a-package-dependency/64963>\
**Category:** Using Swift\
**Tags:** spm, xcodebuild\
**Created:** [May 12, 2023, 3:58pm UTC](https://forums.swift.org/t/xcodebuild-fails-with-missing-module-map-file-when-compiling-framework-with-a-package-dependency/64963 "2023-05-12T15:58:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MihaMarkic](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mihamarkic/32/29965_2.png) [@MihaMarkic](https://forums.swift.org/u/MihaMarkic)\
**Post date:** [May 12, 2023, 3:58pm UTC](https://forums.swift.org/t/xcodebuild-fails-with-missing-module-map-file-when-compiling-framework-with-a-package-dependency/64963/1 "2023-05-12T15:58:29Z")

</div>

I'm trying to create a Framework with a package dependency of [EmarsysSDK](https://github.com/emartech/ios-emarsys-sdk#2-installation-with-swift-package-manager).  
xcodebuild compiles fine until I add `import EmarsysSDK` to start using the added package. Then xcodebuild won't compile anymore with

```swift
<unknown>:0: error: module map file 'PROJECTPATH/build/GeneratedModuleMaps-iphonesimulator/EmarsysSDK.modulemap' not found
/PROJECTPATH/Emarsys.swift:9:29: error: no such module 'EmarsysSDK'
@_implementationOnly import EmarsysSDK
                            ^

```

I don't see other errors in output though at the end it says 2 failures.

Here is command line  
`xcodebuild -sdk iphonesimulator16.2 -project EmarsysBridge.xcodeproj -configuration Release`

I've tried using `@_implementationOnly` (as seen above) with import, but it doesn't change anything. XCode is 14.2. running on x64.  
The project is really a vanilla Framework from template with package dependency added and that import statement.  
I see that missing file in question is mentioned few times in xcodebuild output though.

TIA,  
Am I missing something obvious?

---

<div class="post-metadata">

**Author:** ![MihaMarkic](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mihamarkic/32/29965_2.png) [@MihaMarkic](https://forums.swift.org/u/MihaMarkic)\
**Post date:** [May 12, 2023, 3:59pm UTC](https://forums.swift.org/t/xcodebuild-fails-with-missing-module-map-file-when-compiling-framework-with-a-package-dependency/64963/2 "2023-05-12T15:59:13Z")

</div>

Failed to mention that the same project compiles just fine within XCode.

---

<div class="post-metadata">

**Author:** ![MihaMarkic](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mihamarkic/32/29965_2.png) [@MihaMarkic](https://forums.swift.org/u/MihaMarkic)\
**Post date:** [May 15, 2023, 11:17am UTC](https://forums.swift.org/t/xcodebuild-fails-with-missing-module-map-file-when-compiling-framework-with-a-package-dependency/64963/3 "2023-05-15T11:17:01Z")

</div>

Nevermind, it was a combination of factors, most importantly build output not being there where I expected it to be and I didn't pass -schema or -target argument to xcodebuild.
