5

I'm building a framework, while trying to compile the framework for production with custom shell script code, it freeze's on this step.

This is the custom shell script code:

# define output folder environment variable
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal

# Step 1. Build Device and Simulator versions
xcodebuild -target SomeSDK ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos  BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"
xcodebuild -target SomeSDK -configuration ${CONFIGURATION} -sdk iphonesimulator -arch i386 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"

# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"

# Step 2. Create universal binary file using lipo
lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/lib${PROJECT_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/lib${PROJECT_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${PROJECT_NAME}.a"

# Last touch. copy the header files. Just for convenience
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/include" "${UNIVERSAL_OUTPUTFOLDER}/"

This is an image where it freezes:

custom shell script

How can I fix that? why this is happening?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
ytpm
  • 4,962
  • 6
  • 56
  • 113
  • I'm just guessing but maybe its a user permission thing? Maybe the user that runs the shell script is not authorised to run mkdir or cp in that directory? Try adding some echo's to check where it stops. Maybe echo whoami and try to run all that in the terminal manually? Just guesswork tho .. – Peter Segerblom Mar 20 '15 at 11:31
  • Or codesigning from `xcodebuild` (not sure if you need `security unlock` when running `xcodebuild` in a shell child process of Xcode, but I would expect you do). So why are you running `xcodebuild` from within Xcode in the first place? – trojanfoe Mar 20 '15 at 11:34
  • Also at this step when it freezes, the cpu seems to really works.. all the mac is getting slow as hell and nothing is working. Also after I close the XCode, it continues. – ytpm Mar 20 '15 at 11:36
  • and what process is taking the CPU? – trojanfoe Mar 20 '15 at 11:36
  • What do you mean "what proccess"? – ytpm Mar 20 '15 at 11:38
  • I don't have a clue.. It's hard to know because when I build the project then it's starting to get really slow and I can't do nothing. What else can I do? – ytpm Mar 20 '15 at 11:49
  • 1
    So you don't know how to find out what process is taking most of the CPU of your Mac? I would expect most users to know that and I would expect a developer to know how to do much more. – trojanfoe Mar 20 '15 at 11:55
  • I know, but I just can't do it because when building the CPU is starting to work really hard and nothing moves on the mac. I can't even close the Xcode, for the 3rd time I need to restart the mac in order to use it. It just stuck. – ytpm Mar 20 '15 at 12:39
  • Just open the terminal and type "top" before starting to build. Also have you tried commenting parts of the script out? First build it without the script then add first line then second ... and on you go until you get the problem. – Peter Segerblom Mar 20 '15 at 14:42
  • @PeterSegerblom Here is the build log: http://applikato.me/log.txt I just don't know what seems to be the problem, he could be working that hard for that long? yesterday all night I left him to work and until this morning it didn't finish building. Clearly he freezes somewhere, but I just don't know where. Btw, this is how the script that I run looks: http://pastebin.com/PTKJXiAR, I comment out most of it and it still freezes. – ytpm Mar 20 '15 at 16:45
  • In my case its freezing while archiving app. Its running in iDevice or Simulator successfully. What to do. – Prince Kumar Sharma Dec 15 '16 at 12:03

2 Answers2

4

I found the answer to what I asked for, I just did it wrong.

Let me start by saying that all the tutorials on the web that shows how to create an iOS Static Library, are missing something and not perfect at least what I saw, that's the reason in the first place I had this issue.

Those are the ones I used to do it right:

And this is the answer to my problem:

Instead of creating a new Aggregate Target and insert the Custom Shell Script code there, I just added the Custom Shell Script code into the target it self, which was wrong. That's why compilation never completed and always freeze.

Just click on the + button under the Targets section, choose Other and then Aggregate. In this target you have to go and add your Custom Shell Script code and it will works flawless.

Thanks for the help.

Enjoy!

Community
  • 1
  • 1
ytpm
  • 4,962
  • 6
  • 56
  • 113
2

Run this commond in terminal

sudo pkill -9 node

then re-run the project

Amit Raj Modi
  • 86
  • 1
  • 2