Connecting to Amazon EC2 server on Mac using Terminal app

Go to the folder where your .pem file is stored. You can retrieve the .pem file from your amazon account.

Launch the terminal app and run the  command

cd /folder/where/perm/file/stored/
ssh-add filename.pem

This should work fine most of the time and you should get a response similar to this.

Identity added:xxxxx

If the permission set on the .pem file aren’t correct then terminal will show this error

Permissions 0444 for 'filename.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
ec2-user@xx.xx.xx.xx:22: No such file or directory

To fix it, set the appropriate permissions.

chmod 400 filename.pem

Now, it’s time to connect to ec2 server.

ssh-add filename.pem
ssh ec2-user@xx.xx.xx.xx:22

If evrything works fine, then you should see this response on your terminal screen:

Last login: Tue Apr 23 03:34:27 2013 from xx.xx.xx.xx
__| __|_ )
_| ( / Amazon Linux AMI
There are 15 security update(s) out of 141 total update(s) available
Run "sudo yum update" to apply all updates.
Amazon Linux version 2013.03 is available.
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)
[ec2-user@ip-xx-xx-xx-xx ~]$

Installing OGRE XCode template for iOS

This is the continuation of my previous blog Building OGRE for iOS. To install the template, you need to follow these steps.

OGRE XCode template

This will install the OGRE template for you. Let us create our first sample OGRE demo using the template we installed it now. To do that, open XCode and select the OGRE template and hit next.

OGRE XCode template

If you see the next attached screenshot carefully, for some reason, the XCode was not letting me add ‘/’ at the beginning of the root SDK path of OGRE. Just ignore it for now. Lets correct this later by making few changes in the XCode project settings.XCode project creation

Now, select the target ‘DemoApp’. Now, select ‘Header Search Paths’ under ‘Build Settings’ and add the missing ‘/’ . Also, make the same changes for ‘Library Search Paths’ too 🙂

OGRE demo app project settings

Now. it’s time to compile the app. If you have done everything right then you should see this error 🙂


Undefined symbols for architecture i386:
"boost::system::system_category()", referenced from:
__GLOBAL__I_a in main.o
__GLOBAL__I_a in OgreDemoApp.o
__GLOBAL__I_a in OgreFramework.o
boost::unique_lock<boost::recursive_mutex>::lock() in libOgreMainStatic.a(OgreConfigFile.o)
boost::recursive_mutex::recursive_mutex() in libOgreMainStatic.a(OgreConfigFile.o)
__GLOBAL__I_a in libOgreMainStatic.a(OgreConfigFile.o)
__GLOBAL__I_a in libRenderSystem_GLESStatic.a(OgreGLESPlugin.o)
"boost::system::generic_category()", referenced from:
__GLOBAL__I_a in main.o
__GLOBAL__I_a in OgreDemoApp.o
__GLOBAL__I_a in OgreFramework.o
__GLOBAL__I_a in libOgreMainStatic.a(OgreConfigFile.o)
__GLOBAL__I_a in libRenderSystem_GLESStatic.a(OgreGLESPlugin.o)
__GLOBAL__I_a in libOgreMainStatic.a(OgreLogManager.o)
__GLOBAL__I_a in libOgreMainStatic.a(OgreQuaternion.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

To fix this error, add -lboost_system in the Other Linker Flags. That’s it…Compile and Run the program now. You should see the OGRE beast staring at you 🙂

OGRE Simulator beast

Compiling OpenCV source to support iOS 5.0

The latest version of the OpenCV framework isn’t compatible with anything other than iOS 6.0. This is due to the script what they used to build the framework. Since they have not specified the deployment target, the XCode takes iOS 6.0 (the latest SDK) as the default deployment target. This is very annoying as there are many users who still use iOS 5.0.

The latest OpenCV framework[v2.4.5] for iOS can be downloaded from here. If you try to build the application using this framework and try to run the compiled app on iOS 5, you will encounter this error.

dyld: lazy symbol binding failed: Symbol not found: _objc_setProperty_nonatomic
Referenced from: /var/mobile/Applications/9C52EB2F-9A11-4656-BBAC-0EE6960A323B/
Expected in: /usr/lib/libobjc.A.dylib
dyld: Symbol not found: _objc_setProperty_nonatomic
Referenced from: /var/mobile/Applications/9C52EB2F-9A11-4656-BBAC-0EE6960A323B/
Expected in: /usr/lib/libobjc.A.dylib

After googling, I ended up with this link where they have addressed the problem as well as the fix for the problem. I had to download the entire OpenCV source from github.Though this wasn’t the latest code [v2.4.3], I still downloaded the source as this had deployment target correction script.

After you download the source, you need to execute the following 2 commands in the terminal.

cd /Users/praveencastelino/Downloads/opencv-ios_deployment_target_722dedb/ios
python ./ /Users/praveencastelino/Downloads/ 5.0

1] go to the iOS folder in the OpenCV source.
2] Excecute the python script python ./ <build directory> <deployment target>

If everything works fine then you should have the OpenCV framework compiled to run on iOS 5.0.
OpenCV build folder structure

You can also download the OpenCV framework that I have compiled from here.

Building OGRE for iOS

I was looking out for a 3D Engine (OpenSource) to render 3D models. I wanted to use Cocos3d but this has few limitations. It is not a cross platform engine. [ I can’t ignore my friend Android 😦 ]. Also, it lacks many of the cool features when compared to sophisticated 3D engines. The next engine was OGRE. This is written C++ and a cross platform engine. Moreover, this is exactly what I was looking for. After downloading the source, the next big task was to compile the source. There are many tutorials available in the website but most them are obsolete. So I thought of writing one myself to help someone to quickly get started with OGRE 🙂

Follow the following steps to compile OGRE on iOS platform:

  • Get the latest source from here(v1.8.1)
  • Download the OGRE iOS dependancy and XCode template from here(1.8)
  • Open the iOS dependancies dmg and copy the folder iOSDependencies to the source folder ogre_src_v1-8-1. Ensure that the iOSDependencies and OgreMain folder are at the same hierarchical level.
  • OGRE folder structure
  • Now, navigate to the SDK -> iOS folder. You should find a script.iOS script
  • Open the terminal and navigate it to the above folder where the script resides and run the script ./ in the terminal.
  • If everything worked fine then you should see a build folder in the same location where the script was. This folder contains a XCode project. XCode Build folder
  • Launch the  XCode project and set the target to SampleBrowser. Run the project. Wait for the Simulator to launch the OGRE beast 🙂XCode OGRE Project

PS: XCode Version 4.6.1 (4H512) and OS X (10.8.3)