[solved]Linker errors adapting Ogre1.7 iOS sample to 1.8

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

[solved]Linker errors adapting Ogre1.7 iOS sample to 1.8

Post by d000hg »

Since I run XCode 3.2.6 I can't use the 1.8 project templates; I generated a 1.7 project and tweaked it to use the 1.8 libs and headers in my built 1.8 SDK, and tweaked IPHONE->IOS. Everything compiles fine but I get a few linker errors:

Code: Select all

  "_inflateInit2_", referenced from:
      _zzip_inflate_init in libzzip.a(file.o)

  "_inflateEnd", referenced from:
      _zzip_file_close in libzzip.a(file.o)
      _png_read_destroy in libFreeImage.a(pngread.o)
      _ZIPSetupEncode in libFreeImage.a(tif_zip.o)
      _ZIPCleanup in libFreeImage.a(tif_zip.o)
      _PixarLogCleanup in libFreeImage.a(tif_pixarlog.o)

  "_inflateSync", referenced from:
      _ZIPDecode in libFreeImage.a(tif_zip.o)
      _PixarLogDecode in libFreeImage.a(tif_pixarlog.o)

  "_inflate", referenced from:
      _zzip_file_read in libzzip.a(file.o)
      _png_read_row in libFreeImage.a(pngread.o)
      _png_inflate in libFreeImage.a(pngrutil.o)
      _png_read_finish_row in libFreeImage.a(pngrutil.o)
      _ZIPDecode in libFreeImage.a(tif_zip.o)
      _PixarLogDecode in libFreeImage.a(tif_pixarlog.o)
     (maybe you meant: cstring=png_inflate logic error)

  "_CGImageCreate", referenced from:
      Ogre::EAGLWindow::copyContentsToMemory(Ogre::PixelBox const&, Ogre::RenderTarget::FrameBuffer)in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)

  "_CGColorSpaceCreateDeviceRGB", referenced from:
      Ogre::EAGLWindow::copyContentsToMemory(Ogre::PixelBox const&, Ogre::RenderTarget::FrameBuffer)in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)

  "_CGDataProviderCreateWithData", referenced from:
      Ogre::EAGLWindow::copyContentsToMemory(Ogre::PixelBox const&, Ogre::RenderTarget::FrameBuffer)in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)

  "_CGBitmapContextGetData", referenced from:
      Ogre::EAGLWindow::copyContentsToMemory(Ogre::PixelBox const&, Ogre::RenderTarget::FrameBuffer)in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)

  "_inflateInit_", referenced from:
      _png_create_read_struct_2 in libFreeImage.a(pngread.o)
      _ZIPSetupDecode in libFreeImage.a(tif_zip.o)
      _PixarLogSetupDecode in libFreeImage.a(tif_pixarlog.o)

  "_inflateReset", referenced from:
      _zzip_rewind in libzzip.a(file.o)
      _png_reset_zstream in libFreeImage.a(png.o)
      _png_inflate in libFreeImage.a(pngrutil.o)
      _png_read_finish_row in libFreeImage.a(pngrutil.o)
      _ZIPPreDecode in libFreeImage.a(tif_zip.o)
      _PixarLogPreDecode in libFreeImage.a(tif_pixarlog.o)

  "_CGImageRelease", referenced from:
      Ogre::EAGLWindow::copyContentsToMemory(Ogre::PixelBox const&, Ogre::RenderTarget::FrameBuffer)in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)

  "_CGContextDrawImage", referenced from:
      Ogre::EAGLWindow::copyContentsToMemory(Ogre::PixelBox const&, Ogre::RenderTarget::FrameBuffer)in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)

ld: symbol(s) not found
collect2: ld returned 1 exit status
I should add that the SampleBrowser in the 1.8 project builds and runs just fine. Can anyone suggest what is wrong?
Last edited by d000hg on Fri May 04, 2012 6:29 pm, edited 1 time in total.
User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!
x 8

Re: Odd inker errors adapting Ogre1.7 iOS sample to 1.8

Post by Brocan »

For inflate/deflate/etc... errors link against zlib or add -lz to your linker flags.
For _CG* errors add QuartzCore framework to the project.

Cheers!
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Odd inker errors adapting Ogre1.7 iOS sample to 1.8

Post by d000hg »

Both those things are already done - this is a working 1.7 project which I simply changed to point at 1.8 headers/libs. So I have all the frameworks already, and libzzlib is already added.

I found some similar issues here: http://www.ogre3d.org/forums/viewtopic. ... 76#p422015 but I don't know why it would be working in 1.7 and not in 1.8, also I have more errors than they do.
User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!
x 8

Re: Odd inker errors adapting Ogre1.7 iOS sample to 1.8

Post by Brocan »

Are 1.7 and 1.8 libs linked against same versions of zlib and quartz core?
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Odd inker errors adapting Ogre1.7 iOS sample to 1.8

Post by d000hg »

Same QuartzCore. zlib versions are the ones from respective Ogre versions, I've no idea if they're the same. But the 1.8 SampleBrowser runs fine which I built from source.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Odd inker errors adapting Ogre1.7 iOS sample to 1.8

Post by d000hg »

Well I tried the suggestion of adding /usr/lib/libz.dylib to Other Linker Flags and this removed the libzzlib errors. But I would really like to understand why this is needed for 1.8 and not for 1.7... and I would really like to understand what this does especially since iOS doesn't support dynamic linking AFAIK.

[s]The other errors remain[/s]

Aha! Apparently in Ogre 1.8 we also need the CoreGraphics framework - again I don't know why and would love to understand!
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Odd inker errors adapting Ogre1.7 iOS sample to 1.8

Post by masterfalcon »

Dynamic linking is supported, but not for libraries that you compile. For example, all system frameworks are loaded dynamically.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Odd inker errors adapting Ogre1.7 iOS sample to 1.8

Post by d000hg »

Are you aware why I don't need zlib.dylib and CoreGraphics framework for Ogre 1.7 but I do for 1.8? Greater iOS functionality/APIs being used as 1.8 gets more mature on iOS for 1.8?
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Odd inker errors adapting Ogre1.7 iOS sample to 1.8

Post by masterfalcon »

Something like that. I don't recall exactly right now.