iphone compilation problems

Return to Compiling or Editing the Panda Source

iphone compilation problems

Postby catshow » Tue Nov 23, 2010 9:57 am

I am interested in getting Panda running on iOS. I saw that there is another post where work was started on getting iOS working but was abandoned for a while. I tried what was mentioned and I got compilation started, but the compilation fails in the glstuff directory.

If someone can give me some info or guidance on how to get everything I need compiled. I would be happy to release my changes back to the community.

I was using the Panda1.7.0 source tarball since cvs was out last weekend.

The contents of my Config.pp looks like this:

#define BUILD_IPHONE iPhoneOS
#define IOS_DEV_ROOT Developer
#define HAVE_GLES2 1
#define GLES2_LIBS 1
#define LINK_AS_BUNDLE
#define LINK_ALL_STATIC 1

#define HAVE_OPENSSL
#define HAVE_WX
catshow
 
Posts: 12
Joined: Tue Nov 23, 2010 9:44 am
Location: Greenville, SC

Postby rdb » Tue Nov 23, 2010 10:05 am

Hi, welcome to the forums!

The issues you had in glstuff were probably compilation issues with OpenGL ES. I have fixed several of them since 1.7.0 was released, so I advise getting the latest CVS source (it's back up again).

If you still run into errors using the latest CVS, please post the compilation errors here.
rdb
 
Posts: 9691
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby rdb » Tue Nov 23, 2010 11:57 am

catshow wrote:These are the compile errors:

gles2gsg.h:44:23: error: GLES2/gl2.h: No such file or directory
gles2gsg.h:45:26: error: GLES2/gl2ext.h: No such file or directory
In file included from ../glstuff/glstuff_src.h:37,
from gles2gsg.h:72,
from config_gles2gsg.cxx:16:
../glstuff/glTextureContext_src.h:31: error: ‘GLuint’ does not name a type
../glstuff/glTextureContext_src.h:38: error: ‘GLint’ does not name a type
../glstuff/glTextureContext_src.h:39: error: ‘GLsizei’ does not name a type

... and a bunch more.

Where do the include paths get generated? I need to add the frameworks path for OpenGLES.framework.


It's trying to compile OpenGL ES 2 support, but it cannot locate the headers. Is there even GLES2 support available? If not, you should define HAVE_GLES2 to nothing in the Config.pp file.

drwr (who made the iPhone port) can probably reply in more detail, though.
rdb
 
Posts: 9691
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

iPhone compile problems

Postby catshow » Tue Nov 23, 2010 12:20 pm

I think it does exist. The from 3GS on it supports gles2. Do you know where the include paths are generated?
catshow
 
Posts: 12
Joined: Tue Nov 23, 2010 9:44 am
Location: Greenville, SC

Postby rdb » Tue Nov 23, 2010 12:48 pm

The libraries and include paths are specified in Config.pp:
Code: Select all
// Is OpenGL ES 1.x installed, and where? This is a minimal subset of
// OpenGL for mobile devices.
#define GLES_IPATH
#define GLES_LPATH
#define GLES_LIBS GLES_cm
#defer HAVE_GLES $[libtest $[GLES_LPATH],$[GLES_LIBS]]

// OpenGL ES 2.x is a version of OpenGL ES but without fixed-function
// pipeline - everything is programmable there.
#define GLES2_IPATH
#define GLES2_LPATH
#define GLES2_LIBS GLESv2
#defer HAVE_GLES2 $[libtest $[GLES2_LPATH],$[GLES2_LIBS]]


As for specifying the framework, you can simply override the GLES_LIBS to the empty string, override HAVE_GLES to be 1 and add this line in panda/src/glesgsg/:
Code: Select all
#define OSX_SYS_FRAMEWORKS OpenGLES


And repeat the process similarly for GLES2 / gles2gsg.

But make sure you don't mix-and-match OpenGL ES with OpenGL ES 2. Unless the same framework handles both OpenGL ES and OpenGL ES 2?
Is there an OpenGLES2 framework?

Anyway, this is all just guesswork, so I could be totally wrong.
rdb
 
Posts: 9691
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby rdb » Tue Nov 23, 2010 12:53 pm

Also, to support OpenGL ES 2, you'll need to make various changes to panda/src/iphonedisplay, for instance you'll need to edit it to request a GLES2 context instead of GLES1.

But unless you feel like writing a shader for every bit of geometry, I recommend just compiling with HAVE_GLES2 set to nothing and compiling with just OpenGL ES 1 for now.
rdb
 
Posts: 9691
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

iphone compilation problems

Postby catshow » Tue Nov 23, 2010 1:22 pm

The headers are within the same framework called OpenGLES. They are found in
OpenGLES.framework/Headers/ES1 and OpenGLES.framework/Headers/ES2.

so from the earlier compilation error would theoretically be fixed with

#import <OpenGLES/ES1/gl.h>
#import <OpenGLES/ES1/glext.h>

or

#import <OpenGLES/ES2/gl.h>
#import <OpenGLES/ES2/glext.h>

gles2gsg.h:44:23: error: GLES2/gl2.h: No such file or directory
gles2gsg.h:45:26: error: GLES2/gl2ext.h: No such file or directory
catshow
 
Posts: 12
Joined: Tue Nov 23, 2010 9:44 am
Location: Greenville, SC

Postby rdb » Tue Nov 23, 2010 1:29 pm

Ah! You should edit panda/src/gles2gsg/gles2gsg.h, and find these lines:
Code: Select all
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>


Replace it with:
Code: Select all
#ifdef IS_OSX
  #include <OpenGLES/ES2/gl.h>
  #include <OpenGLES/ES2/glext.h>
#else
  #include <GLES2/gl2.h>
  #include <GLES2/gl2ext.h>
#endif

I've just committed this fix, too.
rdb
 
Posts: 9691
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby catshow » Tue Nov 23, 2010 7:22 pm

Sorry about creating that additional thread. I thought that I had hit reply.

Those changes made it compile. :D

Just to have the thread complete. This is what my current Config.pp looks like:

#define BUILD_IPHONE iPhoneOS
#define IOS_SDK_VERSION 4.2
#define OSX_DEV_ROOT Developer

#define HAVE_GLES 1
#define GLES_LIBS

#define HAVE_GLES2 1
#define GLES2_LIBS
#define LINK_ALL_STATIC 1

#define HAVE_FREETYPE
#define HAVE_GL
#define HAVE_OPENSSL
#define HAVE_PYTHON
#define HAVE_TINYDISPLAY
#define HAVE_WX

================
Notes

#define IOS_SDK_VERSION 4.2 <- I added this to control the SDK_VERSION

#define OSX_DEV_ROOT Developer <- I added this because I have Xcode4 installed on my machine, plus developers may not always have Xcode located in /Developer.

I went ahead and enabled GLES1 also, that way I can drop down to GLES1 if necessary.

I also had to modify the PostConfig.pp file in Panda3D/dtool/pptempl to be this:


// This file is included after including all of $DTOOL/Config.pp and
// the user's personal Config.pp file. It makes decisions necessary
// following the user's Config settings.

#if $[and $[OSX_PLATFORM],$[BUILD_IPHONE]]
//#define IOS_PLATFORM iPhoneSimulator
#define IOS_PLATFORM $[BUILD_IPHONE]

#if $[eq $[IOS_PLATFORM], iPhoneOS]
#define ARCH_FLAGS -arch armv7 -mno-thumb
#define osflags -fpascal-strings -miphoneos-version-min=4.0
#define DEBUGFLAGS -gdwarf-2
#elif $[eq $[IOS_PLATFORM], iPhoneSimulator]
#define ARCH_FLAGS -arch i386
#define osflags -x objective-c -fmessage-length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -fexceptions -fvisibility=hidden -mmacosx-version-min=10.6 -gdwarf-2 -fobjc-abi-version=2 -fobjc-legacy-dispatch -D__IPHONE_OS_VERSION_MIN_REQUIRED=40200
#define DEBUGFLAGS -gdwarf-2 -DDEBUG
#else
#error Inappropriate value for BUILD_IPHONE.
#endif

#define xcode $[OSX_DEV_ROOT]
#define dev /$[xcode]/Platforms/$[IOS_PLATFORM].platform/Developer
#define env env MACOSX_DEPLOYMENT_TARGET=10.6 PATH="$[dev]/usr/bin:/$[xcode]/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
#define CC $[env] $[dev]/usr/bin/gcc
#define CXX $[env] $[dev]/usr/bin/g++
#define OSX_CDEFS __IPHONE_OS_VERSION_MIN_REQUIRED=40000
#define OSX_CFLAGS -isysroot $[dev]/SDKs/$[IOS_PLATFORM]$[IOS_SDK_VERSION].sdk $[osflags]

#defer ODIR_SUFFIX -$[IOS_PLATFORM]

#endif

A couple more questions: Is there a way to change the output directory for the simulator builds? :?:

I want to be able to specify something like /usr/local/panda3d/$[IOS_PLATFORM]/include /lib

That way I can change the Xcode config to look in the right place depending on the build type.

Additionally, I would like the ability to do fatbinaries, How can I make it build for two different architectures?

Let me know if you want the PostConfig.pp, in patch format. If so, would you send the command to generate a patch file against cvs.

Thanks for the help
catshow
 
Posts: 12
Joined: Tue Nov 23, 2010 9:44 am
Location: Greenville, SC

Postby catshow » Wed Nov 24, 2010 1:52 am

Latest error. This time it is in the simulator environment.

env MACOSX_DEPLOYMENT_TARGET=10.6 PATH="/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++ -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk -fpascal-strings -fasm-blocks -miphoneos-version-min=4.0 -o Opt3-OSX-iPhoneSimulator/interrogate Opt3-OSX-iPhoneSimulator/interrogate_interrogate_composite1.o Opt3-OSX-iPhoneSimulator/interrogate_interrogate_composite2.o -L../cppparser/Opt3-OSX-iPhoneSimulator -L../dconfig/Opt3-OSX-iPhoneSimulator -L../dtoolbase/Opt3-OSX-iPhoneSimulator -L../dtoolutil/Opt3-OSX-iPhoneSimulator -L../interrogatedb/Opt3-OSX-iPhoneSimulator -L../prc/Opt3-OSX-iPhoneSimulator -L../pystub/Opt3-OSX-iPhoneSimulator -L/usr/local/panda/lib -lcppParser -linterrogatedb -ldconfig -ldtoolutil -ldtoolbase -lpystub -ldtoolutil -ldtoolbase -ldconfig -ldtoolutil -ldtoolbase -ldtoolutil -ldtoolbase -lprc -ldtoolbase -ldtoolbase -ldtoolutil -ldtoolbase -framework Foundation
Undefined symbols:
".objc_class_name_NSAutoreleasePool", referenced from:
literal-pointer@__OBJC@__cls_refs@NSAutoreleasePool in libdtoolutil.a(dtoolutil_filename_assist.o)

ld: symbol(s) not found
collect2: ld returned 1 exit status
make[1]: *** [Opt3-OSX-iPhoneSimulator/interrogate] Error 1
make: *** [interrogate] Error 2

This is what my Config.pp looks like

//#define BUILD_IPHONE iPhoneOS
#define BUILD_IPHONE iPhoneSimulator
#define OSX_DEV_ROOT Developer
#define IOS_SDK_VERSION 4.2

#define HAVE_GLES2 1
#define GLES2_LIBS

#define HAVE_GLES 1
#define GLES_LIBS

#define LINK_ALL_STATIC 1

#define HAVE_FREETYPE
#define HAVE_GL
#define HAVE_OPENSSL
#define HAVE_PYTHON
#define HAVE_TINYDISPLAY
#define HAVE_WX


This is my modified PostConfig.pp

// This file is included after including all of $DTOOL/Config.pp and
// the user's personal Config.pp file. It makes decisions necessary
// following the user's Config settings.

#if $[and $[OSX_PLATFORM],$[BUILD_IPHONE]]
//#define IOS_PLATFORM iPhoneSimulator
#define IOS_PLATFORM $[BUILD_IPHONE]

#if $[eq $[IOS_PLATFORM], iPhoneOS]
#define ARCH_FLAGS -arch armv7 -arch armv6 -mno-thumb
#define osflags -fpascal-strings -miphoneos-version-min=4.0
#define DEBUGFLAGS -gdwarf-2
#elif $[eq $[IOS_PLATFORM], iPhoneSimulator]
#define ARCH_FLAGS -arch i386
#define osflags -fpascal-strings -fasm-blocks -miphoneos-version-min=4.0
#define DEBUGFLAGS -gdwarf-2 -DDEBUG
#else
#error Inappropriate value for BUILD_IPHONE.
#endif

#define xcode $[OSX_DEV_ROOT]
#define dev /$[xcode]/Platforms/$[IOS_PLATFORM].platform/Developer
#define env env MACOSX_DEPLOYMENT_TARGET=10.6 PATH="$[dev]/usr/bin:/$[xcode]/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
#define CC $[env] $[dev]/usr/bin/gcc
#define CXX $[env] $[dev]/usr/bin/g++
#define OSX_CDEFS __IPHONE_OS_VERSION_MIN_REQUIRED=40000
#define OSX_CFLAGS -isysroot $[dev]/SDKs/$[IOS_PLATFORM]$[IOS_SDK_VERSION].sdk $[osflags]

#defer ODIR_SUFFIX -$[IOS_PLATFORM]

#endif [/b]
catshow
 
Posts: 12
Joined: Tue Nov 23, 2010 9:44 am
Location: Greenville, SC

Postby rdb » Wed Nov 24, 2010 3:16 am

You can set the installation directory for ppremake by defining INSTALL_DIR to the appropriate location, like:
Code: Select all
#defer INSTALL_DIR /usr/local/panda3d/$[IOS_PLATFORM]


Create fat binaries like this:
Code: Select all
#define UNIVERSAL_BINARIES 1
#define ARCH_FLAGS -arch i386 -arch ppc


The "cvs diff" command generates a patch.

Keep in mind that it won't use GLES2 unless you change this line in panda/src/iphonedisplay/eaglView.mm:
Code: Select all
    context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];

Maybe we should make a configuration variable to change this, or so.
rdb
 
Posts: 9691
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby catshow » Wed Nov 24, 2010 9:38 am

Thanks for the quick feedback. I figured out the arch thing before your reply, however the INSTALL_DIR was very helpful.

The latest is that it is trying to build the test_interrogate program even though I have this
Code: Select all
#define HAVE_INTERROGATE
.

I figured out that I needed to add this to the top of dtool/src/test_interrogate/Sources.pp to turn it off. So you might want to change that in the repository.

Code: Select all
#define BUILD_DIRECTORY $[HAVE_INTERROGATE]


Again thanks for all of the help so far.
catshow
 
Posts: 12
Joined: Tue Nov 23, 2010 9:44 am
Location: Greenville, SC

Postby rdb » Wed Nov 24, 2010 10:46 am

Ah, thank you! I've just committed that.
rdb
 
Posts: 9691
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby catshow » Wed Nov 24, 2010 11:00 am

I seem to be having problems where it is trying to build actual programs that run. The latest being check_adler_check_adler of the downloadertools directory I really don't need those to build for iphone os or simulator. Is there a libraries only option?

For some reason it will build using iphoneos but not for iphonesimulator. This is the latest error.

Code: Select all
env MACOSX_DEPLOYMENT_TARGET=10.6 PATH="/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++ -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk -fpascal-strings -fasm-blocks -miphoneos-version-min=4.0  -o Opt3-OSX-iPhoneSimulator/check_adler Opt3-OSX-iPhoneSimulator/check_adler_check_adler.o    -L../downloader/Opt3-OSX-iPhoneSimulator -L../express/Opt3-OSX-iPhoneSimulator -L../pandabase/Opt3-OSX-iPhoneSimulator -L/Users/gwatkins/iPhoneSimulator.platform/panda3d/lib -L/Users/gwatkins/iPhoneSimulator.platform/panda3d/lib -ldownloader -lexpress -lexpress -lpandabase -lpandabase -linterrogatedb -lprc -ldconfig -ldtoolutil -ldtoolbase -lpystub -lprc -lz  -framework Foundation
Undefined symbols:
  ".objc_class_name_NSAutoreleasePool", referenced from:
      literal-pointer@__OBJC@__cls_refs@NSAutoreleasePool in libdtoolutil.a(dtoolutil_filename_assist.o)
ld: symbol(s) not found
catshow
 
Posts: 12
Joined: Tue Nov 23, 2010 9:44 am
Location: Greenville, SC

Postby rdb » Wed Nov 24, 2010 11:40 am

I don't know if there is an easy way to disable all bin_target statements.

As for the linker issue - I don't know. NSAutoreleasePool is supposed to be defined in Foundation.
I've googled for the issue, and I can find a lot of advices, most of which are all different.

Maybe you still have libraries on the linker path that you compiled against the iPhone itself, or using a different architecture, or so?
rdb
 
Posts: 9691
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby drwr » Mon Nov 29, 2010 5:06 pm

Hmm, there's not (currently) a built-in way to disable bin_targets, but you could just do "make install-iphonedisplay" instead of "make install" to build only the targets directly needed in support of the iphonedisplay target.

David
drwr
 
Posts: 11425
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby catshow » Tue Nov 30, 2010 9:56 am

I got the simulator to compile, I think with ios4.0 plus they went with the non-fragile abi. So these were the new compiler flags in dtool/pptempl/PostConfig.pp that I used just for the simulator build.

Code: Select all
   #elif $[eq $[IOS_PLATFORM], iPhoneSimulator]
      #define ARCH_FLAGS -arch i386
      #define osflags -fpascal-strings -fasm-blocks -fmessage-length=0 -fobjc-abi-version=2 -fobjc-legacy-dispatch -fexceptions -fvisibility=hidden -pipe -Wno-trigraphs -O0 -Wreturn-type -Wunused-variable -DDEBUG -mmacosx-version-min=10.6
      #define DEBUGFLAGS -gdwarf-2 -DDEBUG
   #else
      #error Inappropriate value for BUILD_IPHONE.
   #endif


I am not ready to send in the final version of that file yet, because I haven't actually made an app run yet on either platform. Hopefully, I can get to that tonight.

Does anyone have an Xcode project that worked before?
catshow
 
Posts: 12
Joined: Tue Nov 23, 2010 9:44 am
Location: Greenville, SC

Postby drwr » Tue Nov 30, 2010 2:03 pm

I never used an XCode project; I did all of my compilations via command-line Make.

David
drwr
 
Posts: 11425
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby catshow » Tue Nov 30, 2010 2:10 pm

Do you still have that project around? I would like to build an xcode template based on it.

Thanks
catshow
 
Posts: 12
Joined: Tue Nov 23, 2010 9:44 am
Location: Greenville, SC

Postby drwr » Tue Nov 30, 2010 2:14 pm

I'll check my computer at home tonight. But I wasn't using anything that's not already in the source tree: all of my makefiles were generated by ppremake.

David
drwr
 
Posts: 11425
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby catshow » Thu Dec 02, 2010 8:34 am

Any luck finding that old iphone project?

If not, how should I go about starting a new iphone project? Should, I try to base it on the iphone_pview app in the Panda3D/panda/src/iphone folder?

BTW: I am a total newb to panda3d.
catshow
 
Posts: 12
Joined: Tue Nov 23, 2010 9:44 am
Location: Greenville, SC

Postby drwr » Thu Dec 02, 2010 3:00 pm

Oops, sorry, I didn't get a chance to look last night. I'll check again. But let me reiterate: there is no 'project' in the XCode sense. All I ever had was a tree of source code, as checked out from CVS, and with embedded Makefiles as generated by ppremake.

In short, I don't have anything that you don't already have.

The iphone_pview app is the only app I ever built. I had been working by hacking the code I needed into that app. I believe I had written it to unpack and launch its application code from a Panda3D multifile (.mf) file; this was an early precursor to the modern .p3d system.

The modern design for a Python-based iphone project would be to write a standalone app that launches a p3d file. This would be very similar to the existing code in iphone_pview, but it would utilize the modern conventions for p3d files. I don't expect a newcomer to Panda3D to have an easy time writing this code.

To write a C++ or Objective-C based iPhone project, though, you could start with iphone_pview and simply modify it to suit your needs, writing the application directly there. That would be much simpler.

For a Panda newcomer, it would probably be worthwhile to write the application first in the standard desktop environment, to learn the normal Panda conventions.

David
drwr
 
Posts: 11425
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby catshow » Thu Dec 02, 2010 3:20 pm

I understand that the code that you have is not an Xcode project. I am just looking for the basic structure of a panda app that worked once on an iphone. So I would gladly accept anything that you have.

I will also try to work with the iphone_pview app.

I also understand that I would be writing in C++. My python skills are next to nil any way.

As far as the OS/X route goes, that was why I wanted to get the simulator platform moving along, so I can build my app using the simulator which should get me close to where I want to be.

I have everything compiled, I just need to be able to run something now.

Thanks for your help.
catshow
 
Posts: 12
Joined: Tue Nov 23, 2010 9:44 am
Location: Greenville, SC

Postby Spydrouge » Mon Apr 30, 2012 9:36 pm

How did this go?
Spydrouge
 
Posts: 3
Joined: Sun Apr 29, 2012 2:29 am

Postby b0j3 » Sun Oct 28, 2012 12:14 pm

I'm trying to compile panda3d 1.8.0 for the iPhone, but when compiling dtool the error I get is:

make[1]: *** No rule to make target `../cppparser/Opt4-iPhone/libp3cppParser', needed by `Opt4-iPhone/interrogate'. Stop.
make[1]: Leaving directory `/Users/bostjan/peskovnik/panda3d-1.8.0/dtool/src/interrogate'

Any ideas what might be wrong?
I can post the Config.iPhone.pp if needed.
b0j3
 
Posts: 7
Joined: Thu Oct 11, 2012 4:48 am


Return to Compiling or Editing the Panda Source

Who is online

Users browsing this forum: No registered users and 0 guests