kstenerud / iOS-Universal-Framework

An XCode project template to build universal frameworks (arm7, arm7s, and simulator) for iOS / iPhone.
2.95k stars 473 forks source link

Doesn't compile for armv6 in Xcode 4.2 (new problem) #29

Open cgriffin opened 12 years ago

cgriffin commented 12 years ago

I'm having the same issue. I can compile the framework fine when it's not a dependency of my main project. When I add it to my main project I get this:

=== BUILD NATIVE TARGET SQLiteMath OF PROJECT SQLiteMath WITH CONFIGURATION Debug === Check dependencies [BEROR]No architectures to compile for (ARCHS=armv6 armv7, VALID_ARCHS=i386). \ BUILD FAILED ** The following build commands failed: Check dependencies (1 failure)

I tried the suggestion from the other ticket but that didn't help.

It looks like the framework is built correctly. All the parts are there and the binary has both armv6 and armv7. It also compiles without error for the simulator. Just gets that error when compiling for device.

kstenerud commented 12 years ago

I'm not able to replicate this. Do you have an example project you can send me?

I did the following:

I don't get anything beyond the standard annoying warnings when using a fake framework project as a dependency.

As an aside, I'm still working on getting them to build all architectures by default on xcode 4.2.

nicktoumpelis commented 12 years ago

I have a similar issue with a real framework. The project builds properly for devices but not for the simulator. The complication seems to be with a project that I link against. You can download the project here.

kstenerud commented 12 years ago

This seems to be an issue with how plcrashreporter builds its framework. I was able to get past the first hurdle by replacing the dependency "libCrashReporter-iphoneos.a with "CrashReporter.framework", but then the CrashReporter build fails saying it doesn't know to build product type "com.apple.product-type.framework" (the same thing that would happen if you tried to build a real static framework on an unmodified Xcode).

I wrote up a quick example with an inner and outer framework using the real framework template and put it in https://github.com/kstenerud/Universal-Framework-Examples

Basically I did the following:

nicktoumpelis commented 12 years ago

Thanks Karl. I'll try to do it like that.

nicktoumpelis commented 12 years ago

Your example was illuminating :) I managed to do it without any major changes to my original project. Thanks!

nicktoumpelis commented 12 years ago

Actually, I was wrong before. It seems that somehow (due to some paths in project settings) Xcode was tricking me... The solution however was relatively simple. In the last script, in the "Build other platform" section, I added a conditional for the simulator, that allows me to set ARCHS=i386 for it:

echo "Build other platform"

if [[ "$UFW_OTHER_PLATFORM" = "iphonesimulator" ]]
then
    xcodebuild -project "${PROJECT_FILE_PATH}" -target "${TARGET_NAME}" -configuration "${CONFIGURATION}" ARCHS=i386 -sdk ${UFW_OTHER_PLATFORM}${UFW_SDK_VERSION} BUILD_DIR="${BUILD_DIR}" CONFIGURATION_TEMP_DIR="${PROJECT_TEMP_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}" $ACTION
else
    xcodebuild -project "${PROJECT_FILE_PATH}" -target "${TARGET_NAME}" -configuration "${CONFIGURATION}" -sdk ${UFW_OTHER_PLATFORM}${UFW_SDK_VERSION} BUILD_DIR="${BUILD_DIR}" CONFIGURATION_TEMP_DIR="${PROJECT_TEMP_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}" $ACTION
fi

You also need to add i386 to "Valid Architectures" in project settings.

I hope this helps.

cgriffin commented 12 years ago

Thinks for finding that. I have been off on another project so I wont get back to this right away. I'll let you know when I do get to try it.

On Oct 24, 2011, at 6:54 AM, Nick Toumpelis wrote:

Actually, I was wrong before. It seems that somehow (due to some paths in project settings) Xcode was tricking me... The solution however was relatively simple. In the last script, in the "Build other platform" section, I added a conditional for the simulator, that allows me to set ARCHS=i386 for it:

echo "Build other platform"

if [[ "$UFW_OTHER_PLATFORM" = "iphonesimulator" ]] then xcodebuild -project "${PROJECT_FILE_PATH}" -target "${TARGET_NAME}" -configuration "${CONFIGURATION}" ARCHS=i386 -sdk ${UFW_OTHER_PLATFORM}${UFW_SDK_VERSION} BUILD_DIR="${BUILD_DIR}" CONFIGURATION_TEMP_DIR="${PROJECT_TEMP_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}" $ACTION else xcodebuild -project "${PROJECT_FILE_PATH}" -target "${TARGET_NAME}" -configuration "${CONFIGURATION}" -sdk ${UFW_OTHER_PLATFORM}${UFW_SDK_VERSION} BUILD_DIR="${BUILD_DIR}" CONFIGURATION_TEMP_DIR="${PROJECT_TEMP_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}" $ACTION fi

I hope this helps.

Reply to this email directly or view it on GitHub: https://github.com/kstenerud/iOS-Universal-Framework/issues/29#issuecomment-2503658

jasoncrawford commented 12 years ago

I was having a similar problem. The details in case this is helpful for anyone:

The framework was building fine (real framework). I could link it into an application and build for simulator. But when I tried to build for device, Xcode would complain that I didn't have a slice for armv6.

If I updated the framework build settings to build for "armv6 armv7" instead of $(ARCHS_STANDARD_32_BIT) (which was just armv7), then the library build would fail with the same message that cgriffin opened this thread with.

I used nicktoumpelis's script hack to include ARCHS=i386 when building for simulator and that did it for me. Thanks all.

jppetersen commented 12 years ago

Had the same issue as jason (but using a fake framework), and the same fix worked for me also.

blommegard commented 12 years ago

Works like a charm!