SDL_image iOS build error

Hi! I build SDL_image on iOS. And build success .a lib.When I use it, it have a link error:

ld: warning: directory not found for option ‘-L/Users/zxl/Documents/iPhone/fall/SDL/lib’

Undefined symbols for architecture x86_64:

“_CGImageSourceCreateImageAtIndex”, referenced from:

  _CreateCGImageFromCGImageSource in libSDL2_image.a(IMG_ImageIO.o)

“_CGImageSourceCreateWithDataProvider”, referenced from:

  _CreateCGImageSourceFromRWops in libSDL2_image.a(IMG_ImageIO.o)

“_CGImageSourceCreateWithURL”, referenced from:

  _CreateCGImageSourceFromFile in libSDL2_image.a(IMG_ImageIO.o)

“_CGImageSourceGetType”, referenced from:

  _Internal_isType_ImageIO in libSDL2_image.a(IMG_ImageIO.o)

“_UTTypeConformsTo”, referenced from:

  _Internal_isType_ImageIO in libSDL2_image.a(IMG_ImageIO.o)

“_kCGImageSourceTypeIdentifierHint”, referenced from:

  _CreateHintDictionary in libSDL2_image.a(IMG_ImageIO.o)

“_kUTTypeGIF”, referenced from:

  _IMG_isGIF in libSDL2_image.a(IMG_ImageIO.o)

  _IMG_LoadGIF_RW in libSDL2_image.a(IMG_ImageIO.o)

“_kUTTypeJPEG”, referenced from:

  _IMG_isJPG in libSDL2_image.a(IMG_ImageIO.o)

  _IMG_LoadJPG_RW in libSDL2_image.a(IMG_ImageIO.o)

“_kUTTypePNG”, referenced from:

  _IMG_isPNG in libSDL2_image.a(IMG_ImageIO.o)

  _IMG_LoadPNG_RW in libSDL2_image.a(IMG_ImageIO.o)

“_kUTTypeTIFF”, referenced from:

  _IMG_isTIF in libSDL2_image.a(IMG_ImageIO.o)

  _IMG_LoadTIF_RW in libSDL2_image.a(IMG_ImageIO.o)

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)?

I didn’t know how to fix it. I use lipo -info it have all architectures armv7 i386 x86_64 arm64.

Anyone can help me? I also found someone also have this problem in the mail list. He seems not resolve it. ?

It looks like you’re linking statically with SDL instead of using the
framework bundle. If you do that, you have to specify all the
dependencies yourself.

Try adding this to your compile command for each missing dependency:
-framework

Looking at your output I think you’re missing "ApplicationServices"
To find out what SDL or SDL_Image needs type this in a Terminal:
otool -L

Hello,

Linking your app to the ImageIO framework ought to resolve it.

Cheers,
Jeffrey Carpenter
<@Jeffrey_Carpenter>On 2014/09/ 23, at 7:45, ?? <35328502 at qq.com> wrote:

Hi! I build SDL_image on iOS. And build success .a lib.
When I use it, it have a link error:
ld: warning: directory not found for option '-L/Users/zxl/Documents/iPhone/fall/SDL/lib’
Undefined symbols for architecture x86_64:
"_CGImageSourceCreateImageAtIndex", referenced from:
_CreateCGImageFromCGImageSource in libSDL2_image.a(IMG_ImageIO.o)
"_CGImageSourceCreateWithDataProvider", referenced from:
_CreateCGImageSourceFromRWops in libSDL2_image.a(IMG_ImageIO.o)
"_CGImageSourceCreateWithURL", referenced from:
_CreateCGImageSourceFromFile in libSDL2_image.a(IMG_ImageIO.o)
"_CGImageSourceGetType", referenced from:
_Internal_isType_ImageIO in libSDL2_image.a(IMG_ImageIO.o)
"_UTTypeConformsTo", referenced from:
_Internal_isType_ImageIO in libSDL2_image.a(IMG_ImageIO.o)
"_kCGImageSourceTypeIdentifierHint", referenced from:
_CreateHintDictionary in libSDL2_image.a(IMG_ImageIO.o)
"_kUTTypeGIF", referenced from:
_IMG_isGIF in libSDL2_image.a(IMG_ImageIO.o)
_IMG_LoadGIF_RW in libSDL2_image.a(IMG_ImageIO.o)
"_kUTTypeJPEG", referenced from:
_IMG_isJPG in libSDL2_image.a(IMG_ImageIO.o)
_IMG_LoadJPG_RW in libSDL2_image.a(IMG_ImageIO.o)
"_kUTTypePNG", referenced from:
_IMG_isPNG in libSDL2_image.a(IMG_ImageIO.o)
_IMG_LoadPNG_RW in libSDL2_image.a(IMG_ImageIO.o)
"_kUTTypeTIFF", referenced from:
_IMG_isTIF in libSDL2_image.a(IMG_ImageIO.o)
_IMG_LoadTIF_RW in libSDL2_image.a(IMG_ImageIO.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I didn’t know how to fix it. I use lipo -info it have all architectures armv7 i386 x86_64 arm64.

Anyone can help me? I also found someone also have this problem in the mail list. He seems not resolve it.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org