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

Swift Static Libraries causing build error only with cordova build command (works fine in Xcode UI) #617

Closed
3 tasks done
sachinmobstac opened this issue May 14, 2019 · 7 comments · Fixed by #1310
Closed
3 tasks done
Milestone

Comments

@sachinmobstac
Copy link

sachinmobstac commented May 14, 2019

Bug Report

Problem

Can't compile a project which has Pod distributed as Swift Static Library.

What is expected to happen?

The Project should compile without any errors

What does actually happen?

The Project compiles with the below error:

<unknown>:0: error: module map file '/Users/sachinvas/Library/Developer/Xcode/DerivedData/MyApp-djlbvgkjcelsaocynsvraskofynn/Build/Products/Debug-iphonesimulator/Starscream/Starscream.modulemap' not found
<unknown>:0: error: module map file '/Users/sachinvas/Library/Developer/Xcode/DerivedData/MyApp-djlbvgkjcelsaocynsvraskofynn/Build/Products/Debug-iphonesimulator/Starscream/Starscream.modulemap' not found
<unknown>:0: error: underlying Objective-C module 'SocketIO' not found
/Users/sachinvas/Projects/Private/myapp/platforms/ios/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngine.swift:27:8: error: cannot load underlying module for 'Starscream'
import Starscream

Information

I am trying to run the example app in here.

The -fmodule-map-file flag has two different path's

xcodebuild

-fmodule-map-file=/Users/sachinvas/Library/Developer/Xcode/DerivedData/MyApp-djlbvgkjcelsaocynsvraskofynn/Build/Products/Debug-iphonesimulator/Starscream/Starscream.modulemap

Xcode UI

-fmodule-map-file=/Users/sachinvas/Projects/Private/myapp/platforms/ios/Pods/Headers/Public/Starscream/Starscream.modulemap

Command or Code

cordova platforms add ios
cordova build ios (Device Only)

Environment, Platform, Device

iOS 10.0 or higher
iPhone 7

Version information

cordova-ios 5.0.1
cordova-cli latest

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@sachinmobstac
Copy link
Author

Any updates on this issue?

@janpio
Copy link
Member

janpio commented May 23, 2019

No, as you can see there are not comments or other changes.

Your issue doesn't show any errors in "The Project compiles with the below error:" by the way.

@sachinmobstac
Copy link
Author

@janpio, Sorry for that. I will add more details. Looks like there is a path issue when using the xcodebuild command vs the Xcode UI. I know Xcode UI uses the xcodebuild command to build the project, however I am not sure why the path gets resolved when using the Xcode UI and throws error when using the xcodebuild command.

@sachinmobstac
Copy link
Author

@janpio, I have updated the issue which reflects the error which I am facing and added additional information.

@janpio
Copy link
Member

janpio commented May 23, 2019

Thanks, that might give an user or contributor that knows more about Swift/Pods/iOS something to go on.

@j3k0
Copy link

j3k0 commented Oct 19, 2022

It's probably due to this CocoaPods bug: CocoaPods/CocoaPods#10675 (which has been sitting there for 1 year, so I'm not sure how long before, or if, it will be fixed...

A workaround would be to run xcodebuild without a CONFIGURATION_BUILD_DIR. Would that be possible?

@breautek
Copy link
Contributor

A workaround would be to run xcodebuild without a CONFIGURATION_BUILD_DIR. Would that be possible?

Not sure how far this will get you, or if you can unset CONFIGURATION_BUILD_DIR, but you should be able to configure it via buildFlags which can set in either build.json or via --buildFlag CLI argument.

So if something expects a specific build directory, then in theory you should be able to set it to the expected value. I don't know if this will cause any other unwanted side effects however.

cmfsotelo added a commit to OutSystems/cordova-ios that referenced this issue Nov 25, 2022
cmfsotelo added a commit to OutSystems/cordova-ios that referenced this issue Nov 28, 2022
@dpogue dpogue linked a pull request Apr 16, 2023 that will close this issue
10 tasks
@dpogue dpogue added this to the 7.0.0 milestone Apr 16, 2023
dpogue added a commit to dpogue/cordova-ios that referenced this issue Apr 16, 2023
Once upon a time, Xcode's default directory values had issues when there
were spaces in project names, so we override the CONFIGURATION_BUILD_DIR
and SHARED_PRECOMPS_DIR variables with our own paths.

However, this can interfere with Cocoapods, and Xcode should be able to
handle things sensibly nowadays.

Unfortunately, that results in our build artifacts living somewhere in a
randomly-named Xcode DerivedData directory, and then we can't do things
like run the app in a simulator or on a device because we don't know the
path to it.

Setting SYMROOT allows us to control the output directory of the built
products, with the caveat that Xcode always creates a subdirectory named
with the current configuration.

So instead of `build/emulator`, we'll have `build/Debug-iphonesimulator`
and instead of `build/device`, we'll have `build/Release-iphoneos`.

Hypothetically this is better because now we are sure that debug and
release files never get mixed up in the same output directory.

The downside is that this is a breaking change because it alters the
path for the output .ipa files.

Closes apache#617.
Closes apache#659.
Closes apache#671.

Co-Authored-By: Susan Tan <[email protected]>
dpogue added a commit to dpogue/cordova-ios that referenced this issue Apr 16, 2023
Once upon a time, Xcode's default directory values had issues when there
were spaces in project names, so we override the CONFIGURATION_BUILD_DIR
and SHARED_PRECOMPS_DIR variables with our own paths.

However, this can interfere with Cocoapods, and Xcode should be able to
handle things sensibly nowadays.

Unfortunately, that results in our build artifacts living somewhere in a
randomly-named Xcode DerivedData directory, and then we can't do things
like run the app in a simulator or on a device because we don't know the
path to it.

Setting SYMROOT allows us to control the output directory of the built
products, with the caveat that Xcode always creates a subdirectory named
with the current configuration.

So instead of `build/emulator`, we'll have `build/Debug-iphonesimulator`
and instead of `build/device`, we'll have `build/Release-iphoneos`.

Hypothetically this is better because now we are sure that debug and
release files never get mixed up in the same output directory.

The downside is that this is a breaking change because it alters the
path for the output .ipa files.

Closes apache#617.
Closes apache#659.
Closes apache#671.

Co-Authored-By: Susan Tan <[email protected]>
dpogue added a commit to dpogue/cordova-ios that referenced this issue Apr 16, 2023
Once upon a time, Xcode's default directory values had issues when there
were spaces in project names, so we override the CONFIGURATION_BUILD_DIR
and SHARED_PRECOMPS_DIR variables with our own paths.

However, this can interfere with Cocoapods, and Xcode should be able to
handle things sensibly nowadays.

Unfortunately, that results in our build artifacts living somewhere in a
randomly-named Xcode DerivedData directory, and then we can't do things
like run the app in a simulator or on a device because we don't know the
path to it.

Setting SYMROOT allows us to control the output directory of the built
products, with the caveat that Xcode always creates a subdirectory named
with the current configuration.

So instead of `build/emulator`, we'll have `build/Debug-iphonesimulator`
and instead of `build/device`, we'll have `build/Release-iphoneos`.

Hypothetically this is better because now we are sure that debug and
release files never get mixed up in the same output directory.

The downside is that this is a breaking change because it alters the
path for the output .ipa files.

Closes apache#617.
Closes apache#659.
Closes apache#671.

Co-Authored-By: Susan Tan <[email protected]>
dpogue added a commit to dpogue/cordova-ios that referenced this issue Apr 16, 2023
Once upon a time, Xcode's default directory values had issues when there
were spaces in project names, so we override the CONFIGURATION_BUILD_DIR
and SHARED_PRECOMPS_DIR variables with our own paths.

However, this can interfere with Cocoapods, and Xcode should be able to
handle things sensibly nowadays.

Unfortunately, that results in our build artifacts living somewhere in a
randomly-named Xcode DerivedData directory, and then we can't do things
like run the app in a simulator or on a device because we don't know the
path to it.

Setting SYMROOT allows us to control the output directory of the built
products, with the caveat that Xcode always creates a subdirectory named
with the current configuration.

So instead of `build/emulator`, we'll have `build/Debug-iphonesimulator`
and instead of `build/device`, we'll have `build/Release-iphoneos`.

Hypothetically this is better because now we are sure that debug and
release files never get mixed up in the same output directory.

The downside is that this is a breaking change because it alters the
path for the output .ipa files.

Closes apache#617.
Closes apache#659.
Closes apache#671.

Co-Authored-By: Susan Tan <[email protected]>
erisu pushed a commit that referenced this issue May 28, 2023
Once upon a time, Xcode's default directory values had issues when there
were spaces in project names, so we override the CONFIGURATION_BUILD_DIR
and SHARED_PRECOMPS_DIR variables with our own paths.

However, this can interfere with Cocoapods, and Xcode should be able to
handle things sensibly nowadays.

Unfortunately, that results in our build artifacts living somewhere in a
randomly-named Xcode DerivedData directory, and then we can't do things
like run the app in a simulator or on a device because we don't know the
path to it.

Setting SYMROOT allows us to control the output directory of the built
products, with the caveat that Xcode always creates a subdirectory named
with the current configuration.

So instead of `build/emulator`, we'll have `build/Debug-iphonesimulator`
and instead of `build/device`, we'll have `build/Release-iphoneos`.

Hypothetically this is better because now we are sure that debug and
release files never get mixed up in the same output directory.

The downside is that this is a breaking change because it alters the
path for the output .ipa files.

Closes #617
Closes #659
Closes #671

Co-authored-by: Susan Tan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants