Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » iPhone and Xcode 4

This thread is locked; no one can reply to it. rss feed Print
iPhone and Xcode 4
billyquith
Member #13,534
September 2011

I'm trying to compile Allegro 5.0.6 for iPhone. I followed the instructions in the read me. When I try and open ALLEGRO.xcodeproj in Xcode 4.3, I get:

Project <path>/allegro-5.0.6/build_ios/ALLEGRO.xcodeproj
cannot be opened: The project contains has no default build configuration - it may have been damaged

Anyone looking this problem? ;D

It does seem to open in Xcode 3.2.6. Will try and get this working. However, the more recent iOS versions are not supported by Xcode 3. So someone needs to fix this! :)

Elias
Member #358
May 2000

Does the same happen with the SVN version?

--
"Either help out or stop whining" - Evert

billyquith
Member #13,534
September 2011

Elias said:

Does the same happen with the SVN version?

I haven't tried that. This is 5.0.6, which is very recent. Have things been fixed very recently?

Just looked the svn history in 5.0 and I can't see anything regarding iPhone or Xcode.

Trent Gamblin
Member #261
April 2000
avatar

I think he means 5.1 svn. 5.0 is no good for seriously developing iOS apps, for various reasons. It's not updated anymore for one.

billyquith
Member #13,534
September 2011

Allegro 5.1 from svn, rev 15473.

iphone-xcode project in 5.1 gives the following error when you try and open with Xcode 4.3 or Xcode 3.2.6. Perhaps this project needs removing (or fixing) :-

Project <path>/allegro-svn/5.1/iphone-xcode/allegro5.xcodeproj
cannot be opened because it is missing its project.pbxproj file.

When I generate the project files using the read me instructions I get the same error as for 5.0.6 when opening with Xcode 4.3:

Project <path>/allegro-svn/5.1/build_ios/ALLEGRO.xcodeproj cannot be opened:
The project contains has no default build configuration - it may have been damaged

I'm not quite sure how you are developing for iPhone. Does everyone create their own project, without using cmake and then maintain this? I can only assume that noone uses Xcode project files. :(

Elias
Member #358
May 2000

It works here. Maybe it's a permission problem? Make sure you start with an empty build folder and don't use root for anything.

--
"Either help out or stop whining" - Evert

Trent Gamblin
Member #261
April 2000
avatar

The xcode project has been working for me for a long time. ???

Not sure, I second Elias' suggestions.

billyquith
Member #13,534
September 2011

Elias said:

It works here. Maybe it's a permission problem? Make sure you start with an empty build folder and don't use root for anything.

Creating and building a project for Xcode 4.3 works?

I've had a clean build directory every time I've tried this, as per readme instructions:

cd path/to
mkdir Build
cd Build
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-iphone.cmake -G Xcode ..  

With a deps folder in ../Build containing the precompiled binaries on the Allegro site.

Gives log:

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler using: Xcode
-- Check for working C compiler using: Xcode -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler using: Xcode
-- Check for working CXX compiler using: Xcode -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Adding /Users/Nick/Code/gamedev/libs/allegro-svn/5.1/deps to CMAKE_FIND_ROOT_PATH
-- Looking for include files ALLEGRO_HAVE_DIRENT_H
-- Looking for include files ALLEGRO_HAVE_DIRENT_H - found
-- Looking for include files ALLEGRO_HAVE_INTTYPES_H
-- Looking for include files ALLEGRO_HAVE_INTTYPES_H - found
-- Looking for include files ALLEGRO_HAVE_LINUX_JOYSTICK_H
-- Looking for include files ALLEGRO_HAVE_LINUX_JOYSTICK_H - not found.
-- Looking for include files ALLEGRO_HAVE_STDBOOL_H
-- Looking for include files ALLEGRO_HAVE_STDBOOL_H - found
-- Looking for include files ALLEGRO_HAVE_STDINT_H
-- Looking for include files ALLEGRO_HAVE_STDINT_H - found
-- Looking for include files ALLEGRO_HAVE_SYS_IO_H
-- Looking for include files ALLEGRO_HAVE_SYS_IO_H - not found.
-- Looking for include files ALLEGRO_HAVE_SYS_STAT_H
-- Looking for include files ALLEGRO_HAVE_SYS_STAT_H - found
-- Looking for include files ALLEGRO_HAVE_SYS_TIME_H
-- Looking for include files ALLEGRO_HAVE_SYS_TIME_H - found
-- Looking for include files ALLEGRO_HAVE_TIME_H
-- Looking for include files ALLEGRO_HAVE_TIME_H - found
-- Looking for include files ALLEGRO_HAVE_SYS_UTSNAME_H
-- Looking for include files ALLEGRO_HAVE_SYS_UTSNAME_H - found
-- Looking for include files ALLEGRO_HAVE_SYS_TYPES_H
-- Looking for include files ALLEGRO_HAVE_SYS_TYPES_H - found
-- Looking for include files ALLEGRO_HAVE_SOUNDCARD_H
-- Looking for include files ALLEGRO_HAVE_SOUNDCARD_H - not found.
-- Looking for include files ALLEGRO_HAVE_SYS_SOUNDCARD_H
-- Looking for include files ALLEGRO_HAVE_SYS_SOUNDCARD_H - not found.
-- Looking for include files ALLEGRO_HAVE_MACHINE_SOUNDCARD_H
-- Looking for include files ALLEGRO_HAVE_MACHINE_SOUNDCARD_H - not found.
-- Looking for include files ALLEGRO_HAVE_LINUX_SOUNDCARD_H
-- Looking for include files ALLEGRO_HAVE_LINUX_SOUNDCARD_H - not found.
-- Looking for include files ALLEGRO_HAVE_OSATOMIC_H
-- Looking for include files ALLEGRO_HAVE_OSATOMIC_H - found
-- Looking for include files ALLEGRO_HAVE_SYS_INOTIFY_H
-- Looking for include files ALLEGRO_HAVE_SYS_INOTIFY_H - not found.
-- Looking for include files ALLEGRO_HAVE_SYS_TIMERFD_H
-- Looking for include files ALLEGRO_HAVE_SYS_TIMERFD_H - not found.
-- Looking for getexecname
-- Looking for getexecname - not found
-- Looking for mkstemp
-- Looking for mkstemp - found
-- Looking for mmap
-- Looking for mmap - found
-- Looking for mprotect
-- Looking for mprotect - found
-- Looking for sched_yield
-- Looking for sched_yield - found
-- Looking for sysconf
-- Looking for sysconf - found
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for ftello
-- Looking for ftello - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of _Bool
-- Check size of _Bool - done
-- Performing Test ALLEGRO_HAVE_PROCFS_ARGCV
-- Performing Test ALLEGRO_HAVE_PROCFS_ARGCV - Failed
-- Performing Test ALLEGRO_HAVE_SV_PROCFS_H
-- Performing Test ALLEGRO_HAVE_SV_PROCFS_H - Failed
-- Performing Test ALLEGRO_HAVE_VA_COPY
-- Performing Test ALLEGRO_HAVE_VA_COPY - Success
-- Check if constructors are supported - yes
-- Found OpenGL: /System/Library/Frameworks/OpenGL.framework 
-- Found OpenAL: /System/Library/Frameworks/OpenAL.framework 
-- Found FLAC: /opt/local/include 
-- Performing Test FLAC_COMPILES
-- Performing Test FLAC_COMPILES - Success
-- Could NOT find DUMB (missing:  DUMB_INCLUDE_DIR DUMB_LIBRARY) 
WARNING: libdumb not found or compile test failed, disabling support. <http://dumb.sourceforge.net/>
-- Found OGG: /opt/local/include 
-- Found VORBIS: /opt/local/include 
-- Performing Test VORBIS_COMPILES
-- Performing Test VORBIS_COMPILES - Success
-- Found Freetype: /Users/Nick/Code/gamedev/libs/allegro-svn/5.1/deps/lib/libfreetype.a 
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.5")
-- Found PhysFS: /Users/Nick/Code/gamedev/libs/allegro-svn/5.1/deps/lib/libphysfs.a 
-- Found PHYSFS: /Users/Nick/Code/gamedev/libs/allegro-svn/5.1/deps/lib/libphysfs.a 
-- Performing Test PHYSFS_IMPLICIT_ZLIB
-- Performing Test PHYSFS_IMPLICIT_ZLIB - Failed
-- Found THEORA: /opt/local/include 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/Nick/Code/gamedev/libs/allegro-svn/5.1/build

Seems a bit mixed up. It is using some OSX and iOS libs.

Do you use Macports cmake?

Elias
Member #358
May 2000

Still on XCode 4.2 here, but don't think it should make much difference. Does cmake display any warnings or errors?

[edit:] Ah, you posted the logs now. Yes, cmake 2.8.7 here.

--
"Either help out or stop whining" - Evert

billyquith
Member #13,534
September 2011

cmake version 2.8.7 here.

Are there any more logs or debug things I could turn on?

According to Ogre cmake:

# CMake 2.8.2 has a bug that creates unusable Xcode projects when using ARCHS_STANDARD_32_BIT
# to specify both armv6 and armv7.
if(OGRE_BUILD_PLATFORM_APPLE_IOS AND (CMAKE_VERSION VERSION_EQUAL 2.8.2) AND (CMAKE_GENERATOR STREQUAL "Xcode"))
        message(FATAL_ERROR "CMake 2.8.2 cannot create compatible Xcode projects for iOS, please download the latest version or an older release from http://www.cmake.org/files/")
endif()

The missing .pbxproj file for "allegro/iphone-xcode" appears to be a valid complaint. svn viewer reveals it is missing. This is where all the project information is stored.

http://alleg.svn.sourceforge.net/viewvc/alleg/allegro/branches/5.1/iphone-xcode/allegro5.xcodeproj/

Aha. After much fiddling and Googling, you appear to be missing:

set(CMAKE_CONFIGURATION_TYPES Debug Release Debug-iPhone)

from the iPhone settings. This allows you to open the project. It still appears to have problems.

Elias
Member #358
May 2000

Thanks, I removed that empty iphone-xcode folder.

If you add that CMAKE_CONFIGURATION_TYPES settings to CMakeLists.txt does it work?

We could really need someone who maintains OSX binaries, like for Windows. And possibly, like there, not use cmake at all for building them, considering how fragile it is under OSX. But unlikely we'll find someone... so until then have to live with it.

Google also suggests that cmake 2.8.7 doesn't work under OSX Lion with XCode 4.3 - in which case the only option would be to wait until they fix it :/

[edit:] Ok, I see your edit. I'll attempt to fix it on the weekend, but not sure I'll be able to... getting cmake to create an ios xcode project means hacks over hacks since it's not really supported, and some of those hacks likely stopped working.

--
"Either help out or stop whining" - Evert

billyquith
Member #13,534
September 2011

Elias said:

If you add that CMAKE_CONFIGURATION_TYPES settings to CMakeLists.txt does it work?

No. But it will at least load into Xcode. It didn't before. You can also use xcodebuild, but it fails with a load errors.

The SDKs have all moved so some sort of search will be needed, depending on your version of Xcode. They are in Application/Xcode.app/Contents... now instead of /Developer.

Ok, so looks like I'll have to manually create the project and build the libs. I wish I'd known this before, that it was so broken. Could have set that up by now. Perhaps add some notes somewhere.

Perhaps look at Ogre. They seem to have a really nice clear layout. It may be worth starting the cmake files again.

Elias
Member #358
May 2000

The hacks come from Ogre I think :P

--
"Either help out or stop whining" - Evert

billyquith
Member #13,534
September 2011

Elias said:

Google also suggests that cmake 2.8.7 doesn't work under OSX Lion with XCode 4.3 - in which case the only option would be to wait until they fix it :/

Could you therefore please check-in a working Allegro5 iPhone/iOS Xcode 4 project (like before). You both said you had a working project file. Or alternatively working binaries would be nicer as I won't have to fix all the dependencies. ;D

I'd like to see how useable Allegro 5.1.2 is on iOS. Thanks.

Elias
Member #358
May 2000

Could you therefore please check-in a working Allegro5 iPhone/iOS Xcode 4 project (like before)

It was just an empty folder from a few years ago - the only project in SVN was for XCode 1.0 or so. After upgrading to XCode 4.3 and re-creating the project I don't have a working xcode setup myself :/ But I'll try to repair it.

If you can't wait until then, it would be easy compiling without cmake - you'd just have to create the config headers (they have a .h.cmake extension) yourself and add to the include path. Create a folder, copy them there, rename them to without the .cmake at the end and replace the #cmakedefine lines with something appropriate. Then add all source files to a new library project and it should build. Repeat for each addon (or compile them all together into a monolith build).

--
"Either help out or stop whining" - Evert

billyquith
Member #13,534
September 2011

Elias said:

But I'll try to repair it.

That would be great. :D

I think on Allegro 4.x the only way to get frameworks working was to use Xcode, which I don't think I could get to work. In the end I gave up and used makefiles (generated with cmake) and installed static libs in /usr/local/lib.

I suppose ideally what you'd do for Mac is compile Allegro for targets i386, x86_64, armv6, armv7 and put them all in the same archive using lipo. Ideally this would work for static libs and frameworks. ;D

https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/lipo.1.html

Another option is to perhaps use premake. cmake just confuses the hell out of me on OSX. I don't think any two projects seem to have the same cmake config options. ???

[edit 23-Mar-12] So for cmake for Xcode 4.3 you need:

set(CMAKE_CONFIGURATION_TYPES Debug Release)

to get the Mac version to work. And something similar for iPhone (as mentioned above).

These are some useful notes:
http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Building%20From%20Source%20-%20iPhone

For Mac & iOS, I think there needs to be a script, like the above, in addition to the cmake files, which makes Xcode project file for Allegro, for iphone (armv6 & armv7), then iPhone simulator (which is actually i386, not ARM), and also for Mac x86_64. Then these four libraries are combined, using lipo, into a framework, which is optionally installed to the usual place.

This is where OSX keeps the supplied frameworks for the different platforms: http://developer.apple.com/library/ios/#DOCUMENTATION/Miscellaneous/Conceptual/iPhoneOSTechOverview/iPhoneOSFrameworks/iPhoneOSFrameworks.html

If lipo isn't used, I don't think Allegro has different names for the iPhone targets. I'm not sure if iPhone frameworks are usually installed with the Mac ones or elsewhere.

[edit 24-Mar-12] The other thing you need to think about is which iOS versions to support. I have a 1st gen iTouch I'm trying to use, so iOS 3.1.3. Looks like you need to use iOS SDK 4.3 to use this. The danger in using later base SDKs in Allegro is that you use features from them that stops older devices being used. This may be useful:

http://stackoverflow.com/questions/7790497/iphone-app-developed-with-sdk-4-2-requires-backward-compatibility-with-ios-3-1

Elias
Member #358
May 2000

Ok, it should be all fixed in SVN.

I suppose ideally what you'd do for Mac is compile Allegro for targets i386, x86_64, armv6, armv7 and put them all in the same archive using lipo.

Yes, as I said many times. Basically we need to find someone like MichaƂ who does for OSX what he does for Windows.

Quote:

Another option is to perhaps use premake.

Do you know how well premake works for ios? Which other projects use it? Also, would premake completely replace cmake also for the other platforms?

Quote:

For Mac & iOS, I think there needs to be a script, like the above, in addition to the cmake files, which makes Xcode project file for Allegro

Indeed. Either use a script to repair whatever cmake does, or wait until cmake devs finally fix it.

Quote:

The other thing you need to think about is which iOS versions to support.

Allegro 5 supports all ios versions as far as I know. There's runtime checks to never call unsupported functions on olders OSes.

--
"Either help out or stop whining" - Evert

billyquith
Member #13,534
September 2011

Elias said:

Ok, it should be all fixed in SVN.

I tried with Xcode 4.3.2 and iOS 5.1. asteroids does not build for iPhone. ex_draw compiles but does not run because the font is missing. I think this may work for OSX, but not for iPhone.

Quote:

Do you know how well premake works for ios? Which other projects use it? Also, would premake completely replace cmake also for the other platforms?

I don't. I haven't really used it much, other than to generate a couple of projects, and it was a hell of a lot easier to understand than cmake.

Quote:

Allegro 5 supports all ios versions as far as I know. There's runtime checks to never call unsupported functions on olders OSes.

You may want to test iOS 5.1. I don't know if some of the problems I was having are due to stale example code (inside IPHONE defines) or due to features removed in 5.1. I'm trying to go back to Xcode 3 and iOS 4.3.

[edit] I think cmake 2.8.7 is borked. I can't run it on Xcode 3.2.6 without getting:

error: There is no SDK with the name or path
'/Developer-3.2.6/SDKs/MacOSX10.7.sdk'

Elias
Member #358
May 2000

because the font is missing

Yeah, I found no way to properly add the resources. You have to manually add them in XCode (for each example/demo you want to work) :( Someone needs to update the readme with details, but basically just add the examples/data folder for the examples and for the demos in addition to that also their respective data folders.

I also had problems getting any examples to work on ios (5.1 here) due to the recent OpenGL changes - but I think Trent fixed that by now. I'll try again next weekend.

--
"Either help out or stop whining" - Evert

billyquith
Member #13,534
September 2011

Elias said:

Yeah, I found no way to properly add the resources.

Do you have to explicitly specify them for each example? The sources are all specified aren't they?

If it is because of paths I think it is because they are in groups (yellow folders) instead of folders (blue).

[edit] I'm testing with cmake 2.8.8 rc1 now. Some of these issues have been fixed. I've reported other issues in other new threads.

Cheers.

Go to: