Apache Cordova
  1. Apache Cordova
  2. CB-1122

Compile errors when building for Archive

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.1.0
    • Component/s: iOS
    • Labels:
      None

      Description

      On Tue, Jul 24, 2012 at 4:45 PM, Michael McCabe <michaelmccabe5@gmail.com> wrote:
      > I'm having the same problem. I tried installing Cordova-2.0.0.pkg before
      > running the create script and am still getting the errors of missing
      > CDVViewController.h (in AppDelegate.h and MainViewController.h) only when
      > archiving.
      >
      > Has anyone gotten the build to work after installing the pkg? I'm running
      > XCode 4.2, mac-os 10.6.8 and ios sdk 5.0, btw.

      1. header.png
        130 kB
        Shazron Abdullah
      2. Archive-tmq.zip
        2 kB
        Quinn C. Hoyer

        Issue Links

          Activity

          Hide
          Shazron Abdullah added a comment -

          Build for Archiving (Product -> Archive) produced no compilation errors for me when building a new 2.0.0 project.

          Show
          Shazron Abdullah added a comment - Build for Archiving (Product -> Archive) produced no compilation errors for me when building a new 2.0.0 project.
          Hide
          Koray Balci added a comment -

          I am having the same problem with an upgrade from 1.9.0 version. Compiling and running fine, but Archiving for the "AdHoc" configuration fails with the same errors because the lib.a and Cordova includes are not copied to the correct path.

          Show
          Koray Balci added a comment - I am having the same problem with an upgrade from 1.9.0 version. Compiling and running fine, but Archiving for the "AdHoc" configuration fails with the same errors because the lib.a and Cordova includes are not copied to the correct path.
          Hide
          Shazron Abdullah added a comment -

          @Koray can you check your Xcode setting? See "Note 2" from the Upgrade Guide for 1.90 -> 2.0:
          http://docs.phonegap.com/en/2.0.0/guide_upgrading_ios_index.md.html#Upgrading%20Cordova%20iOS

          Show
          Shazron Abdullah added a comment - @Koray can you check your Xcode setting? See "Note 2" from the Upgrade Guide for 1.90 -> 2.0: http://docs.phonegap.com/en/2.0.0/guide_upgrading_ios_index.md.html#Upgrading%20Cordova%20iOS
          Hide
          Koray Balci added a comment -

          That setting was correct, I checked and didn't need to change it.

          Show
          Koray Balci added a comment - That setting was correct, I checked and didn't need to change it.
          Hide
          Shazron Abdullah added a comment -

          @Koray Thanks. Re-opening. I will test with the new information.

          Show
          Shazron Abdullah added a comment - @Koray Thanks. Re-opening. I will test with the new information.
          Hide
          Shazron Abdullah added a comment -
          Show
          Shazron Abdullah added a comment - Google Group thread to update: https://groups.google.com/forum/?fromgroups#!topic/phonegap/IcR8-ijrUfk
          Hide
          Shazron Abdullah added a comment -

          I think this is Xcode version related (please report with your Xcode and OS version).

          Try this and clean then rebuild:
          In your project's target Build Settings -> Header Search Paths, add:

          $(OBJROOT)/UninstalledProducts/include
          

          This is the folder structure for an archive build:
          http://cl.ly/ILO4

          Show
          Shazron Abdullah added a comment - I think this is Xcode version related (please report with your Xcode and OS version). Try this and clean then rebuild: In your project's target Build Settings -> Header Search Paths, add: $(OBJROOT)/UninstalledProducts/include This is the folder structure for an archive build: http://cl.ly/ILO4
          Hide
          Koray Balci added a comment -

          I tried both with XCode 4.3.2 and then upgraded and tested with 4.4 but failed. Had to revert back to 1.9.0 for now since we had to distribute our app.

          Show
          Koray Balci added a comment - I tried both with XCode 4.3.2 and then upgraded and tested with 4.4 but failed. Had to revert back to 1.9.0 for now since we had to distribute our app.
          Hide
          Alessandro Polverini added a comment -

          I have the same problem: followed all the steps for the upgrade, but unable to compile the app anymore

          Show
          Alessandro Polverini added a comment - I have the same problem: followed all the steps for the upgrade, but unable to compile the app anymore
          Hide
          David Conlisk added a comment - - edited

          I'm having the same issue with XCode 4.3.3 on Mac OS 10.7.4 (Lion). I tried adding $(OBJROOT)/UninstalledProducts/include but there is no Header Search Paths in my project's target Build Settings, only Framework Search Paths. I added it there to no effect. At the moment I can't deploy my app because of version 2.0 of Cordova/PhoneGap. It builds fine, this only happens when I try to archive the app.

          Thanks,

          David

          Show
          David Conlisk added a comment - - edited I'm having the same issue with XCode 4.3.3 on Mac OS 10.7.4 (Lion). I tried adding $(OBJROOT)/UninstalledProducts/include but there is no Header Search Paths in my project's target Build Settings, only Framework Search Paths. I added it there to no effect. At the moment I can't deploy my app because of version 2.0 of Cordova/PhoneGap. It builds fine, this only happens when I try to archive the app. Thanks, David
          Show
          Shazron Abdullah added a comment - @Alessandro I'm assuming you turned on this setting? https://github.com/apache/incubator-cordova-docs/blob/master/docs/en/edge/guide/getting-started/ios/index.md#problems-in-xcode
          Hide
          Shazron Abdullah added a comment -

          @David that's strange that it is not there. See the attached screenshot, please double check.

          Show
          Shazron Abdullah added a comment - @David that's strange that it is not there. See the attached screenshot, please double check.
          Hide
          Alessandro Polverini added a comment -

          @Shazron
          Yes I checked all those settings, thanks for your reply.

          For now, as a workaround, I created a new project from scratch and imported all the old code and data

          Show
          Alessandro Polverini added a comment - @Shazron Yes I checked all those settings, thanks for your reply. For now, as a workaround, I created a new project from scratch and imported all the old code and data
          Hide
          Shazron Abdullah added a comment -

          @Alessandro what Cordova version did you upgrade from?

          Show
          Shazron Abdullah added a comment - @Alessandro what Cordova version did you upgrade from?
          Hide
          Alessandro Polverini added a comment -

          @Shazron: 1.8.1

          But I first followed the instructions to upgrade to 1.9 (i.e.: nothing relevant)

          Show
          Alessandro Polverini added a comment - @Shazron: 1.8.1 But I first followed the instructions to upgrade to 1.9 (i.e.: nothing relevant)
          Hide
          David Conlisk added a comment -

          Hi Shazron, it is definitely not there in my project. I posted more information on the Google groups thread also. I checked another project of mine and it doesn't have that setting either, neither does the Cordova2 or CordovaLib projects when I open them in XCode 4.4.

          Show
          David Conlisk added a comment - Hi Shazron, it is definitely not there in my project. I posted more information on the Google groups thread also. I checked another project of mine and it doesn't have that setting either, neither does the Cordova2 or CordovaLib projects when I open them in XCode 4.4.
          Hide
          Shazron Abdullah added a comment -

          @David, was that using a visual inspection or typing "header" in the search box? sorry, I'm just being thorough because it is peculiar that it is missing. If it is still missing, try creating a new project and see if that setting is there.

          Show
          Shazron Abdullah added a comment - @David, was that using a visual inspection or typing "header" in the search box? sorry, I'm just being thorough because it is peculiar that it is missing. If it is still missing, try creating a new project and see if that setting is there.
          Hide
          David Conlisk added a comment -

          Hi Shazron,

          I typed header into the search box. I just tried creating a new project using the create command, then copied in my plugins and www folder and all seems good now. Thanks for your time with this.

          David

          Show
          David Conlisk added a comment - Hi Shazron, I typed header into the search box. I just tried creating a new project using the create command, then copied in my plugins and www folder and all seems good now. Thanks for your time with this. David
          Hide
          Shazron Abdullah added a comment - - edited

          I'm writing a diagnostic+test tool to figure this issue out. I've tested a new project on a clean system, with a new user - and they build ok, including Archive, so I'm perplexed at this problem.

          The tool (most likely a shell script or py/rb script) will check an Xcode project:

          1. Check and print the HEADER_SEARCH_PATHS setting (3 lines, I will expand on this later)
          2. Check and print the VERSION of CordovaLib that is referenced (should be at least 2.0.0)
          3. Check and print the PUBLIC_HEADERS_FOLDER_PATH build setting of CordovaLib (which should be "include/Cordova")
          4. Check and print the CORDOVALIB setting
          5. Check and print the "Xcode Preferences -> Locations -> Derived Data -> Advanced... -> Build Location" setting (should be "Unique")
          6. Instruction to run "cordova/debug" on their project (sometimes this builds properly on the command line while in Xcode GUI it fails)

          These are the pre-requisites for a successful build. The tool will be called in the Makefile in the default target as a sanity check (creating a test project).

          Show
          Shazron Abdullah added a comment - - edited I'm writing a diagnostic+test tool to figure this issue out. I've tested a new project on a clean system, with a new user - and they build ok, including Archive, so I'm perplexed at this problem. The tool (most likely a shell script or py/rb script) will check an Xcode project: Check and print the HEADER_SEARCH_PATHS setting (3 lines, I will expand on this later) Check and print the VERSION of CordovaLib that is referenced (should be at least 2.0.0) Check and print the PUBLIC_HEADERS_FOLDER_PATH build setting of CordovaLib (which should be "include/Cordova") Check and print the CORDOVALIB setting Check and print the "Xcode Preferences -> Locations -> Derived Data -> Advanced... -> Build Location" setting (should be "Unique") Instruction to run "cordova/debug" on their project (sometimes this builds properly on the command line while in Xcode GUI it fails) These are the pre-requisites for a successful build. The tool will be called in the Makefile in the default target as a sanity check (creating a test project).
          Hide
          Shazron Abdullah added a comment -

          [2.1] bin/create now updates the CordovaLib subproject directly - your project will not contain a reference to the CORDOVALIB Xcode variable anymore, but a direct reference. There is a new script in bin as well to update your subproject reference. I will be updating the diagnostic tool accordingly.

          Show
          Shazron Abdullah added a comment - [2.1] bin/create now updates the CordovaLib subproject directly - your project will not contain a reference to the CORDOVALIB Xcode variable anymore, but a direct reference. There is a new script in bin as well to update your subproject reference. I will be updating the diagnostic tool accordingly.
          Show
          Shazron Abdullah added a comment - Fix commit, diag tool added: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/21d285d7
          Hide
          Joel Anair added a comment -

          I'm having this exact issue, XCode 4.3.2 on Mac OS X 10.7.4. Would it be useful for me to run your diagnostic script and send you the results?

          Show
          Joel Anair added a comment - I'm having this exact issue, XCode 4.3.2 on Mac OS X 10.7.4. Would it be useful for me to run your diagnostic script and send you the results?
          Hide
          Shazron Abdullah added a comment -

          @Joel - absolutely! Please run the diagnose_project script. Instructions in this thread: https://groups.google.com/d/topic/phonegap/Z8fUgTgdOjU/discussion

          Show
          Shazron Abdullah added a comment - @Joel - absolutely! Please run the diagnose_project script. Instructions in this thread: https://groups.google.com/d/topic/phonegap/Z8fUgTgdOjU/discussion
          Hide
          Quinn C. Hoyer added a comment - - edited

          We are also having this problem. It work on one machine (the machine where the Upgrade was performed) but fails on another machine. Cordova 2.0 has been installed on both machines, and the CordovaLibs directory has been verified. I've included the output of the diagnostic tools as Archive-tmq.zip

          Both diagnostic outputs are nearly identical except for user directory...

          Show
          Quinn C. Hoyer added a comment - - edited We are also having this problem. It work on one machine (the machine where the Upgrade was performed) but fails on another machine. Cordova 2.0 has been installed on both machines, and the CordovaLibs directory has been verified. I've included the output of the diagnostic tools as Archive-tmq.zip Both diagnostic outputs are nearly identical except for user directory...
          Hide
          Shazron Abdullah added a comment -

          @Quinn You are missing the HEADER_SEARCH_PATHS Build Setting for your project. Go here, steps 31 and 32 for "Upgrading
          1.9.0 to 2.0.0":
          http://docs.phonegap.com/en/2.0.0/guide_upgrading_ios_index.md.html#Upgrading%20Cordova%20iOS

          Show
          Shazron Abdullah added a comment - @Quinn You are missing the HEADER_SEARCH_PATHS Build Setting for your project. Go here, steps 31 and 32 for "Upgrading 1.9.0 to 2.0.0": http://docs.phonegap.com/en/2.0.0/guide_upgrading_ios_index.md.html#Upgrading%20Cordova%20iOS
          Hide
          Quinn C. Hoyer added a comment -

          That did fix the problem, but do you have an idea why it was working for one config, but not the other, even though neither of them had the HEADER_SEARCH_PATHS set?

          Show
          Quinn C. Hoyer added a comment - That did fix the problem, but do you have an idea why it was working for one config, but not the other, even though neither of them had the HEADER_SEARCH_PATHS set?
          Hide
          Shazron Abdullah added a comment -

          @Quinn - no idea, since it should fail for the other config as well :/

          Show
          Shazron Abdullah added a comment - @Quinn - no idea, since it should fail for the other config as well :/
          Hide
          Shazron Abdullah added a comment -

          CB-1456 is an enhancement to the diagnose_project script

          Show
          Shazron Abdullah added a comment - CB-1456 is an enhancement to the diagnose_project script
          Show
          Shazron Abdullah added a comment - Latest diagnostic script: https://raw.github.com/apache/incubator-cordova-ios/f187cdd742ae179263192abad231f26d153e9be8/bin/diagnose_project
          Hide
          Carlos Santana added a comment - - edited

          I was able to fix this problem by updating my build script.
          I added to my .app creation command line the following CONFIGURATION_BUILD_DIR=$

          {myApp.ios.out.release}/build
          Where ${myApp.ios.out.release}

          is the xcode main project folder where myApp.xcode is located.
          What will this do is force main project and subproject (i.e CordovaLib) to build in the same location.
          The variable CONFIGURATION_BUILD_DIR will be use by both projects build settings.
          Here is the example of the command I use to build .app and ipa ( I have a modify project because I moved the CordovaLib subproject inside the main project)
          xcodebuild" -sdk iphoneos" -verbose -project myApp.xcodeproj -target myApp-configuration ReleaseCONFIGURATION_BUILD_DIR=$

          {myApp.ios.out.release}/build 'CODE_SIGN_IDENTITY="iPhone Developer"' build
          xcrun" -sdk iphoneos PackageApplication ${myApp.ios.out.release}

          /build/MSM.app -o $

          {myApp.ios.out.release.ipa}

          -verbose

          I hope this helps

          Show
          Carlos Santana added a comment - - edited I was able to fix this problem by updating my build script. I added to my .app creation command line the following CONFIGURATION_BUILD_DIR=$ {myApp.ios.out.release}/build Where ${myApp.ios.out.release} is the xcode main project folder where myApp.xcode is located. What will this do is force main project and subproject (i.e CordovaLib) to build in the same location. The variable CONFIGURATION_BUILD_DIR will be use by both projects build settings. Here is the example of the command I use to build .app and ipa ( I have a modify project because I moved the CordovaLib subproject inside the main project) xcodebuild" -sdk iphoneos" -verbose -project myApp.xcodeproj -target myApp-configuration ReleaseCONFIGURATION_BUILD_DIR=$ {myApp.ios.out.release}/build 'CODE_SIGN_IDENTITY="iPhone Developer"' build xcrun" -sdk iphoneos PackageApplication ${myApp.ios.out.release} /build/MSM.app -o $ {myApp.ios.out.release.ipa} -verbose I hope this helps
          Hide
          Shazron Abdullah added a comment -

          Thanks Carlos - this is exactly the method that we are already using in the cordova/debug build script included when you create a new project.

          Show
          Shazron Abdullah added a comment - Thanks Carlos - this is exactly the method that we are already using in the cordova/debug build script included when you create a new project.
          Hide
          Carlos Santana added a comment -

          Shazron, hehe I'm not that smart I took the variable from the debug script.

          By adding this variable CONFIGURATION_BUILD_DIR actually I'm fixing two problems.
          Problem #1: Compile Error
          Since Header Search Path already contains the build $(BUILT_PRODUCTS_DIR) and this match $(CONFIGURATION_BUILD_DIR) then the compiler will know where to find the include files to compile

          Problem #2: Building a good IPA containing the cordovalib linked with compiled library
          I tried fixing the header search path to make the compile work from command line this produced an ipa that was not usable, the final output didnt' contain the cordovalib compiled.

          The key thing is that the cordovalib output needs to be found by archive process to put everything inside the ipa

          This is why I took the shortcut of just adding the $(CONFIGURATION_BUILD_DIR) to fix both problems.

          I hope this helps clarify.

          I took me a while to figured out when I upgraded from cordova 1.6.1 to 2.0.0 and suddenly I was not getting a good IPA to be install on phone for ad-hoc/enterprise distribution over webpage.

          --Carlos

          Show
          Carlos Santana added a comment - Shazron, hehe I'm not that smart I took the variable from the debug script. By adding this variable CONFIGURATION_BUILD_DIR actually I'm fixing two problems. Problem #1: Compile Error Since Header Search Path already contains the build $(BUILT_PRODUCTS_DIR) and this match $(CONFIGURATION_BUILD_DIR) then the compiler will know where to find the include files to compile Problem #2: Building a good IPA containing the cordovalib linked with compiled library I tried fixing the header search path to make the compile work from command line this produced an ipa that was not usable, the final output didnt' contain the cordovalib compiled. The key thing is that the cordovalib output needs to be found by archive process to put everything inside the ipa This is why I took the shortcut of just adding the $(CONFIGURATION_BUILD_DIR) to fix both problems. I hope this helps clarify. I took me a while to figured out when I upgraded from cordova 1.6.1 to 2.0.0 and suddenly I was not getting a good IPA to be install on phone for ad-hoc/enterprise distribution over webpage. --Carlos

            People

            • Assignee:
              Shazron Abdullah
              Reporter:
              Shazron Abdullah
            • Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development