Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "is a dynamic library, not added to the static library" warning?

I just upgraded to Xcode 5.1, and all of a sudden there is a new warning:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/usr/lib/libz.dylib is a dynamic library, not added to the static library

The target which generates this warning is the cocos2d-iphone v2 static library (rather than use cocos2d templates, I create a static library). To create the static library all I did was add the cocos2d project to my workspace, have my project link to the libraries that cocos2d links to, and thats it. This all worked fine prior to this update, but now there is a warning.

How do I fix this ? I do not want to mess with the cocos2d project, because there are some projects in which I use the cocos2d template and not the static library.

like image 419
Rahul Iyer Avatar asked Mar 22 '14 02:03

Rahul Iyer


Video Answer


1 Answers

Static library targets can not link against dylibs. Previously this was simply ignored. You need to remove said dylib from the static library target and, if necessary, add it to each target that is building the actual app.

Look into the Link Binary with Libraries Build Phase. Knowing cocos2d there's probably an Other Linker Flag "-lz" that you need to remove from Build Settings of the cocos2d target.

like image 154
LearnCocos2D Avatar answered Nov 09 '22 18:11

LearnCocos2D