Private Void
Private Void

Reputation: 317

What is correct way to load zlib via LDFLAGS in a Makefile under LLVM?

my CFLAGS have

-I../../usr/local/sys/usr/include

which correctly loads zlib.h

LDFLAGS are

LDFLAGS = -L../../usr/local/sys/usr/lib -lxml2 -lzlib

But when linker tries to link following occures

1>   + Linking project files...
1>  ld: library not found for -lzlib
1>  collect2: ld returned 1 exit status
1>  make: *** [link] Error 1

What could be the problem?

Environment is iosdevenv under windows7 (so directory structure is different than on mac os)

Upvotes: 5

Views: 3647

Answers (2)

Private Void
Private Void

Reputation: 317

The solution is to use -lz flag instead of -lzlib.

Tested, project linked.

Upvotes: 5

Michael Dautermann
Michael Dautermann

Reputation: 89509

libz.dylib lives in /usr/lib of your iPhone SDK.

Figure out the proper path to libz.dylib and then change your "-L" path in LDFLAGS to match it.

On my machine it's /Application/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/lib/libz.dylib

Upvotes: 1

Related Questions