kstenerud / iOS-Universal-Framework

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

Issues with XCode6 #197

Open loretoparisi opened 9 years ago

loretoparisi commented 9 years ago

After moving to XCode6 I have compilation issues, not for the build phase, but for the deploy:

       /bin/sh -c /Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed-bwacnbtcxpahjwadabtuksommgai/Build/Intermediates/ObjectiveLyricsTouch.build/Debug-iphonesimulator/ObjectiveLyricsTouch.build/Script-3E353A6F158B841100F2E8FC.sh

   ** BUILD SUCCEEDED **

   Create universal static library
     /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool  -static /Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed- bwacnbtcxpahjwadabtuksommgai/Build/Products/Debug- iphoneos/ObjectiveLyricsTouch.framework/ObjectiveLyricsTouch  /Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed-bwacnbtcxpahjwadabtuksommgai/Build/Products/Debug- iphonesimulator/ObjectiveLyricsTouch.framework/ObjectiveLyricsTouch -o  /Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed-bwacnbtcxpahjwadabtuksommgai/Build/Products/Debug-iphoneos/ObjectiveLyricsTouch.framework/ObjectiveLyricsTouch.temp
       error:     /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: can't open file: /Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed-bwacnbtcxpahjwadabtuksommgai/Build/Products/Debug-iphonesimulator/ObjectiveLyricsTouch.framework/ObjectiveLyricsTouch (No such file or directory)
      Showing first 200 notices only
loretoparisi commented 9 years ago

Looking at the script the problem seems to be here:

    # Build the fat static library binary

    echo "Create universal static library"

    if [[ "$XCODE_VERSION_MAJOR" = "0500" ]]
    then
    echo "$DT_TOOLCHAIN_DIR/usr/bin/libtool" -static "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" "${UFW_OTHER_BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" -o "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}.temp"
    "$DT_TOOLCHAIN_DIR/usr/bin/libtool" -static "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" "${UFW_OTHER_BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" -o "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}.temp"
    else
    echo "$PLATFORM_DEVELOPER_BIN_DIR/libtool" -static "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" "${UFW_OTHER_BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" -o "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}.temp"
    "$PLATFORM_DEVELOPER_BIN_DIR/libtool" -static "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" "${UFW_OTHER_BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" -o "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}.temp"
    fi
    echo mv "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}.temp" "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"
    mv "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}.temp" "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"
    fi

If we look closer at the error:

    error:  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed- bwacnbtcxpahjwadabtuksommgai/Build/Products/Debug-iphonesimulator/ObjectiveLyricsTouch.framework/ObjectiveLyricsTouch (No such file or directory)

It seems that the libtool cannot open the generated static library header file:

   /ObjectiveLyricsTouch.framework/ObjectiveLyricsTouch 

Tried to use the

     if [[ "$XCODE_VERSION_MAJOR" = "0600" ]]

with no success.

But looking at the folder generated framwork's build folder

 /Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed-bwacnbtcxpahjwadabtuksommgai/Build/Products/Debug-iphonesimulator/ObjectiveLyricsTouch.framework/

I do not have the generated static library file there, so the error.

So looking at the build folder you can see as the script generates the iOS Simulator build ( the Debug-iphonesimulator folder)

     /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static /Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed-bwacnbtcxpahjwadabtuksommgai/Build/Products/Debug-iphoneos/ObjectiveLyricsTouch.framework/ObjectiveLyricsTouch /Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed-bwacnbtcxpahjwadabtuksommgai/Build/Products/Debug-iphonesimulator/ObjectiveLyricsTouch.framework/ObjectiveLyricsTouch -o /Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed-bwacnbtcxpahjwadabtuksommgai/Build/Products/Debug-iphoneos/ObjectiveLyricsTouch.framework/ObjectiveLyricsTouch.temp

where the actual static library is not present, so the error!

loretoparisi commented 9 years ago

If I remove the i386 (iphonesimulator) target I get

    Build other platform
     xcodebuild -project     /Users/admin/Projects/MusiXmatch/ObjectiveLyricsTouch/ObjectiveLyricsTouch.xcodeproj -target ObjectiveLyricsTouch -configuration Debug -sdk iphonesimulator8.0 BUILD_DIR=/Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed-bwacnbtcxpahjwadabtuksommgai/Build/Products CONFIGURATION_TEMP_DIR=/Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed-bwacnbtcxpahjwadabtuksommgai/Build/Intermediates/ObjectiveLyricsTouch.build/Debug-iphonesimulator build
         2014-09-10 19:18:22.033 xcodebuild[20367:507] [MT] PluginLoading: Required plug-in compatibility UUID C4A681B0-4A26-480E-93EC-1218098B9AA0 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/SparkInspectorXcodePlugin.xcplugin' not present in DVTPlugInCompatibilityUUIDs
       Build settings from command line:
BUILD_DIR = /Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed-bwacnbtcxpahjwadabtuksommgai/Build/Products
CONFIGURATION_TEMP_DIR = /Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed-bwacnbtcxpahjwadabtuksommgai/Build/Intermediates/ObjectiveLyricsTouch.build/Debug-iphonesimulator
SDKROOT = iphonesimulator8.0

      === BUILD TARGET ObjectiveLyricsTouch OF PROJECT ObjectiveLyricsTouch WITH     CONFIGURATION Debug ===

      ** BUILD FAILED **

    The following build commands failed:
        Check dependencies
           (1 failure)
    Command /bin/sh failed with exit code 65

What I have noticed is that while the BUILD_DIR exists the CONFIGURATION_TEMP_DIR does not.

Whirlwind commented 9 years ago

me too. How should I do?

loretoparisi commented 9 years ago

So far I have found no solution for that. Strangely the "iphonesimulator" folder still exists in XCode6 so the IF

         if [[ "$XCODE_VERSION_MAJOR" = "0500" || "$XCODE_VERSION_MAJOR" = "0600" ]]
        then
       echo "$DT_TOOLCHAIN_DIR/usr/bin/libtool" -static        "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"  "${UFW_OTHER_BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" -o  "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}.temp"
         "$DT_TOOLCHAIN_DIR/usr/bin/libtool" -static    "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"  "${UFW_OTHER_BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" -o  "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}.temp"

should be still ok. What it seems to be is that the command before does not create the static library at all in that folder but in another one since I have no static library in the derived data folder for the iphonesimulator:

             error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed-bwacnbtcxpahjwadabtuksommgai/Build/Products/Debug-iphonesimulator/ObjectiveLyricsTouch.framework/ObjectiveLyricsTouch (No such file or directory)

The file in the device debug folder is generated instead:

              MacBook-Pro-di-Loreto:lyriXmatch4iphone-development-new admin$ ls -l /Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed-bwacnbtcxpahjwadabtuksommgai/Build/Products/Debug-iphoneos/ObjectiveLyricsTouch.framework/ObjectiveLyricsTouch 
                -rw-r--r--  1 admin  staff  6216560 11 Set 11:35 /Users/admin/Library/Developer/Xcode/DerivedData/MXMTestbed-bwacnbtcxpahjwadabtuksommgai/Build/Products/Debug-iphoneos/ObjectiveLyricsTouch.framework/ObjectiveLyricsTouch
loretoparisi commented 9 years ago

Anyone have found a solution for this?

loretoparisi commented 9 years ago

So, that is my solution to make the new Embedded Frameworks to work, but my concerns are that there's now way to submit the app with a Embedded Framework if the Deployment Target is not iOS 8.0:

http://stackoverflow.com/questions/25909870/xcode-6-and-embedded-frameworks-only-supported-in-ios8/25910262#25910262

I'm stucked and a bit upset with Apple.

loretoparisi commented 9 years ago

Since it seems that there's no solution to this, I tried to create a new framework structure (just one class) and I had as result:

        UFW (M iphoneos): INFO: warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /System/Library/Frameworks/Foundation.framework/Foundation is a dynamic library, not added to the  static library
       warning:     /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /System/Library/Frameworks/Foundation.framework/Foundation is a dynamic library, not added to the static library

This (new) warning it's very interesting!

 Foundation.framework/Foundation is a dynamic library, not added to the static library

Anyways the error was:

   OSError: [Errno 2] No such file or directory: '/Users/admin/Library/Developer/Xcode/DerivedData/StaticFrameworkTouch-eujicmfqoyyarxayqyucambnuorh/Build/Products/Debug-iphoneos/StaticFrameworkTouch.framework/Versions/A'
     Command /bin/sh failed with exit code 1
loretoparisi commented 9 years ago

I finally moved to @jverkoey iOS Framework, that works on XCode6 targeting iOS7 and iOS8.

https://github.com/jverkoey/iOS-Framework

smallchild commented 9 years ago

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: can't open file:.... why?

HoangTuEch commented 9 years ago

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: can't open file:.... somebody help me please :D

ezibyte commented 9 years ago

We rolled back to xCode 5.x to make the libraries and it is working fine. Later you can test the libraries with xCode 6.x. However, with this approach you need to maintain two version of xCode.

HoangTuEch commented 9 years ago

but if I use xcode 5, I can't use target IOS SDK 8.1

ezibyte commented 9 years ago

You can compile library with xCode 5.x for iOS 7.x or higher. And in xCode 6.x you can test the library with iOS 7.x or 8.x. It will work fine. We are doing the same.

talkol commented 9 years ago

Everything was working for me with xcode 6.1.1 but as soon as I upgraded to xcode 6.2 things started failing with the errors described in this thread.

The solution was to re-install the old xcode 6.1.1 side-by-side with 6.2. Then, re-run the installer of the Universal Framework (eg. Real Framework/install.sh).

Only then things started working again in 6.1.1