Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

libiconv not linking to iOS project

I'm trying to compile MailCore into an iOS app I'm making, and the linker keeps complaining that libiconv isn't linked in. At least that's what I think it's complaining about. This is what it spits out:

Undefined symbols for architecture i386:
  "_iconv", referenced from:
      _mail_iconv in libmailcore.a(charconv.o)
  "_iconv_open", referenced from:
      _charconv in libmailcore.a(charconv.o)
      _charconv_buffer in libmailcore.a(charconv.o)
  "_iconv_close", referenced from:
      _charconv in libmailcore.a(charconv.o)
      _charconv_buffer in libmailcore.a(charconv.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

(This is building for the simulator. Building for my iPhone gives the same error, but s/i386/armv7/).

I've tried adding libiconv.dylib to "Link Binary with Libraries", but it doesn't change the errors at all.

Any idea what could be wrong here? I've been trying to Google this error, but I can't find any information about how to link in libiconv. Since it's part of the iOS SDK, you would think I shouldn't need to compile it myself?

like image 534
sarahhodne Avatar asked Sep 18 '11 22:09

sarahhodne


2 Answers

You need add libiconv.dylib via "add framework". SRC is available from this discussion.

like image 121
shuiyouren Avatar answered Dec 21 '22 05:12

shuiyouren


As extra confirmation that the lib is included in your target, select the lib in the file list in the left pane of Xcode (assuming you've added it to your Target / Project, you should see the framework listed under frameworks), and show the Assistant Editor view on the right pane (View -> Assistant Editor -> Show Assistant Editor).

Then, with the relevant lib selected on the left, you will see 'Target Membership' for that lib shown as a list of checkboxes on the right.

You should see App Target Listed, and the checkbox should be checked for that target.

You could try unchecking and rechecking it, to nudge it into your project?

like image 42
Snips Avatar answered Dec 21 '22 05:12

Snips