Xcode 4 & three20 & create IPA archive: No such file or directory
Asked Answered
P

12

14

In Xcode 3.2.5 I use "Build And Archive" to create an IPA file without any problems. How can I do that in Xcode 4? I think I have to use "Product -> Archive", but I get over 100 error messages in the three20 framework. Most are "No such file or directory". ("Product -> Build For -> Build For Archiving" works. No errors.)

For example, this is the first error message:

../scripts/Protect.command: line 23: cd: /Users/[USERNAME]/Library/Developer/Xcode/DerivedData/[PROJECTNAME]-blabla/ArchiveIntermediates/[PROJECTNAME]/BuildProductsPath/Release-iphoneos/../three20/Three20Core: No such file or directory

The path "/[PROJECTNAME]/BuildProductsPath/three20/" really doesn't exists, but this path exists: "/[PROJECTNAME]/three20/"

What can I do?

Petronia answered 10/3, 2011 at 14:54 Comment(0)
S
16

The Three20 documentation did not solve this issue for me (unfortunately...). Eventually what worked for me was a mix of a few solutions. There is a difference between "Archive" and "Build for Archiving" (or build for run) and using these steps I have both of them working with no build issues:

You will need to change the scripts as Manni mentioned, set the "Skip Install" flag for each Three20 project linked to your project tree and add the following paths to your project's "Header search paths":

"$(BUILT_PRODUCTS_DIR)/../three20" "$(BUILT_PRODUCTS_DIR)/../../three20"

this will get you to work with the Build option. When you want to perform the archive action, then you will also need to change the "Locations" preference in Xcode as featherless mentioned above.

I documented these steps in this post.

Stereotyped answered 24/4, 2011 at 20:14 Comment(3)
Great! I had to upgrade the Three20 Framework and after that, i did the changes! And it worked!!! ThxOberon
The sooner I remove this from the project the better!!! Too much maintenance time required on itCouple
btw the adding the "$(BUILT_PRODUCTS_DIR)/../three20" "$(BUILT_PRODUCTS_DIR)/../../three20" path step is already done by following @Manni's steps.Brilliancy
P
13

Configuration that works both for build and archive in Xcode4.
https://github.com/pazustep/three20/commit/4a9aad4eb90a6962dd729d245f9293a7cc0d7f36


src/common/Configurations/Paths.xcconfig

REPO_ROOT_PATH    = $(SRCROOT)/../..
ROOT_SOURCE_PATH  = $(REPO_ROOT_PATH)/src

//OBJROOT = $(REPO_ROOT_PATH)/Build
//SYMROOT = $(OBJROOT)/Products

// Search Paths

LIBRARY_SEARCH_PATHS    = $(STDLIB_LIBRARY)
//HEADER_SEARCH_PATHS     = $(STDLIB_HEADERS) "$(CONFIGURATION_BUILD_DIR)/../three20"
HEADER_SEARCH_PATHS     = $(STDLIB_HEADERS) "$(BUILT_PRODUCTS_DIR)/../three20" "$(BUILT_PRODUCTS_DIR)/../../three20"

src/scripts/Protect.command

# Ignore whitespace characters in paths
IFS=$'\n'

#cd ${CONFIGURATION_BUILD_DIR}${PUBLIC_HEADERS_FOLDER_PATH}

if [ "${DEPLOYMENT_LOCATION}" == "YES" ]; then
    PREFIX=${BUILT_PRODUCTS_DIR}/..
else
    PREFIX=${BUILT_PRODUCTS_DIR}
fi

cd ${PREFIX}${PUBLIC_HEADERS_FOLDER_PATH}

chmod a-w *.h 2>> /dev/null
chmod a-w private/*.h 2>> /dev/null

exit 0
Petronia answered 11/3, 2011 at 8:14 Comment(1)
After this changes, I get "Three20/Three20.h: No such file or directory" in my source code: #import "Three20/Three20.h"Petronia
P
5

Another thing that could throw off the build process is using a scheme name that contains spaces.

XCode won't stop you from doing it, but if you use a name like "Ad Hoc" for your scheme, you'll end up the same errors:

Three20/Three20+Additions.h: No such file or directory
Potbelly answered 19/5, 2011 at 13:9 Comment(1)
I've re-learned this rule several times. I tend to see errors during the link phase.Pry
I
4

I'm looking into this right now and will hopefully put together an adequate patch that works in both Xcode 3.2.# and Xcode 4.

Edit: So it looks like the easiest way to get old Xcode 3.2 projects to work with Xcode 4 is to do the following:

  • Go into Xcode 4's preferences (Cmd+,).
  • Select the "Locations" tab.
  • Where it says "Build Locations", select the drop down and pick "Place build products in locations specified by targets"

I'll write up a three20.info article going into more details about this.

Irrespective answered 10/3, 2011 at 15:44 Comment(3)
I changed the build location but I still get the "no such file or directory" error message :-(Petronia
I had to compile it the usual way once before trying to create archive for this to work!Oas
I'm afraid this post is outdated for Xcode 4.5, there you only have preferences -> locations tab-> derived data -> advanced ->build location -> custom which gives your three options: 1. relative to derived data, relative to work space, and absolute.. which one them is it? (question asked here)Brilliancy
P
2

three20.info: Xcode 4 Transition Guide
http://three20.info/article/2011-03-10-Xcode4-Support

This guide has been put together by the Three20 team in order to help you migrate your apps to Xcode 4 successfully.

Petronia answered 11/3, 2011 at 7:40 Comment(2)
Please use this article to transition to Xcode 4. All other methods are not officially supported.Irrespective
Alas, this article is not working for me. Will keep trying different things though. :(Lockard
L
2

Make sure your scheme name doesn't contains spaces. That also leads to the "File not found" build error.

Lepidopteran answered 14/11, 2011 at 9:30 Comment(0)
L
1

I had to go under Project Info > Build (tab) and add the following to the header search path:

three20/Build/Products/three20

This path may be specific to my project, but there it is in case it works for someone else.

Lasagne answered 19/12, 2011 at 20:9 Comment(0)
P
0

Open the file /src/common/Configurations/Paths.xcconfig

old code:

HEADER_SEARCH_PATHS     = $(STDLIB_HEADERS) "$(CONFIGURATION_BUILD_DIR)/../three20"

new code:

HEADER_SEARCH_PATHS     = $(STDLIB_HEADERS) "$(CONFIGURATION_BUILD_DIR)/../../three20"

So, I still have 7 errors, but I can create the archive...

Petronia answered 10/3, 2011 at 15:39 Comment(0)
P
0

Google Groups: Xcode 4, Three20 and Project -> Archive
http://groups.google.com/group/three20/browse_frm/thread/cde36b7dab178bad

Petronia answered 11/3, 2011 at 8:19 Comment(0)
M
0

Amir Naor's answer is perfect. I verified his answer on xcode 4.2 and it worked. I missed the step "You will need to change the scripts as Manni mentioned above" so I kept getting the similar error as quoted in the original question post. hope you don't make the same mistake. also as of xcode 4.2, the step "then you will also need to change the "Locations" preference in Xcode as featherless mentioned above." isn't needed any more.

Malissamalissia answered 16/10, 2011 at 13:44 Comment(0)
B
0

I did the following to make it work for me:

  1. for the three20 static library, I used cocoapods to include the files within the main project.. it just got rid of all the trouble three20 was giving me (and they are lots..) btw i tried replacing three20 with Nimbus.. but Nimbus was lacking on some of the features that my project was using three20 for.. so Nimbus wasn't helpful.
  2. set skip install to yes under build settings for all other sub projects/static libraries and switched the copy headers from public to project under build phases
  3. most importantly: under the sub libraries.. under build phases i ensured that copy files destination was changed from Absolute path to products directory.

and that was it!

hint: to get an idea of the offending files that's causing your archive to create an archive file rather than an ipa do this:

  1. Select the archive and click the Distribute button.
  2. Select the 'Save Built Products' option.
  3. Hit Next and Save.
  4. Browse the created directory in Finder.
  5. The 'libraries' subdirectory will identify the libraries that you need to set the Skip Install to Yes.
  6. in some cases usr/local/include will identify the culprit header files you need to move from Public to Project or the files that you have to change from absolute path to products directory. but that directory (ie usr/local/include) varies depending on your sublibrary directory structure
Brilliancy answered 27/2, 2013 at 19:7 Comment(0)
A
0

If you want a quick workaround, just do next simple steps:

1. go to the mentioned /Users/[USERNAME]/Library/Developer/Xcode/DerivedData/[PROJECTNAME]-blabla/ArchiveIntermediates/[PROJECTNAME]/BuildProductsPath/ path (it will be in your error message). It should be a substring till /.. in that path.
2. create Release-iphoneos (or Debug-iphoneos if appropriate) folder there

Then everything will build fine!

Three20 script assumes you already have that folder, but when you build first time there is no one exists. That's why you need to fix "Build" and "Archive" separately: "Build" action usually uses Debug-iphoneos folder and "Archive" action uses Release-iphoneos.

Tip: you can create all the required folders at once to avoid problems with different configurations. These are:
Release-iphoneos
Debug-iphoneos
Release-iphonesimulator
Debug-iphonesimulator

Adamson answered 14/1, 2015 at 9:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.