Skip to content

Instantly share code, notes, and snippets.

@micahpearlman
Created January 26, 2013 20:38
Show Gist options
  • Save micahpearlman/4644484 to your computer and use it in GitHub Desktop.
Save micahpearlman/4644484 to your computer and use it in GitHub Desktop.
When doing an XCode AdHoc (or any custom) build in an XCode workspace, Xcode cannot find the other projects in the workspace. To fix it do the following:
see: http://stackoverflow.com/questions/8523690/xcode-custom-build-configuration-causes-library-file-not-found-for-static-libr
In the project with the Adhoc build configuration, override the "Per-configuration Build Products Path" (CONFIGURATION_BUILD_DIR) and "Per-configuration Intermediate Build Files Path" (CONFIGURATION_TEMP_DIR) for the Adhoc build configuration to use the same folder as the release configuration.
Adhoc: CONFIGURATION_BUILD_DIR = $(SYMROOT)/Release$(EFFECTIVE_PLATFORM_NAME)
Adhoc: CONFIGURATION_TEMP_DIR = $(PROJECT_TEMP_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)
Now when you do an Adhoc build, Xcode will put libFoo.a and Bar.app in the Release-iphoneos folder. The linker will be happy and you can use -force_load $(BUILT_PRODUCTS_DIR)/libFoo.a as usual.
Alternatively, you can add the Release-iphoneos folder to the library search paths for the Adhoc build configuration:
Adhoc: LIBRARY_SEARCH_PATHS = $(inherited) $(BUILD_DIR)/Release($EFFECTIVE_PLATFORM_NAME)
But then you'll have to set a different -force_load for each build configuration:
Debug: OTHER_LINKER_FLAGS = $(inherited) -force_load $(BUILT_PRODUCTS_DIR)/libFoo.a
Adhoc: OTHER_LINKER_FLAGS = $(inherited) -force_load $(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)
Release: OTHER_LINKER_FLAGS = $(inherited) -force_load $(BUILT_PRODUCTS_DIR)/libFoo.a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment