0

So I am trying to use a C library in a Objective-C, iPhone project. I am getting this linker error when I try to compile:

file was built for unsupported file format which is not the architecture being linked (i386)

I build this library using the standard

./configure make

Which architecture should I build this with to work with iPhone project? Thanks! Update

I updated the Makefile and added -arch i386 to the CFLAGS line. When I run make I now this get this error:

Compiling spammer.c gcc -o spammer spammer.o ../src/libircclient.a -lpthread ld: warning: in ../src/libircclient.a, file was built for unsupported file format which is not the architecture being linked (x86_64)

Does this mean I need to edit another makefile somewhere??

2 Answers 2

1

It likely was built for x86_64 which is the default. You need to modify the library so that it's compiled for i386 and will match your application.

Typically you do that by setting the CFLAGS environment variable to -arch i386 before running configure. Make sure to do a "make dist clean" first though. If that doesn't work, you can also hand-edit the Makefile after configure creates it and add -arch i386 to the CFLAGS= line.

Sign up to request clarification or add additional context in comments.

2 Comments

Try that as soon as I can. Thanks for the info!
Despite the error I get when building with this CFLAG -arch i386 set the library seems to link
0

This error:

Compiling spammer.c gcc -o spammer spammer.o ../src/libircclient.a -lpthread ld: warning: in ../src/libircclient.a, file was built for unsupported file format which is not the architecture being linked (x86_64)

Comes when building the examples and that's not really what you want right?

Do a make in the SRC folder and building with -arch i386 or -arch arvm7 will work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.