Building iOS app using Xcode works, but building the same app with xcodebuild command fails

140

So the problem is somehow the $PODS_ROOT variable is set to /Users/aa/code/WW2/ios/Pods, probably due to a canceled npm build. I only needed to restart the terminal and the problem is solved.

As a side note, I should have used the search function in the finder as it's much faster because it uses an index unlike grep.

Share:
140
Sid Go
Author by

Sid Go

Updated on December 08, 2022

Comments

  • Sid Go
    Sid Go over 1 year

    Both new flutter and new react-native projects fail to build because the xcodebuild tool fails. They, however, succeed when I build the projects manually inside Xcode.

    Apparently, the reason is because xcodebuild adds additional flag during the build, that, is:

    export OTHER_CPLUSPLUSFLAGS=" -fmodule-map-file="/Users/aa/code/WW2/ios/Pods/Headers/Public/SSZipArchive/SSZipArchive.modulemap""

    The result is that the build is failing because it cannot find the said module map, with the following error:

    <unknown>:0: error: module map file '/Users/aa/code/WW2/ios/Pods/Headers/Public/SSZipArchive/SSZipArchive.modulemap' not found

    The said module map is from a previous project (called WW2) which I moved. But the problem is that even newly-created projects are affected.

    I wasted two days to solve this, even reading through the documentation about xcode build settings, but to no avail. What I'm trying to do is to find the source of this additional flag or configuration. I even used grep to find a file containing the particular flag, but it's not yet finished scanning my system.