Question

Nowdays I met a strange link problem when I try to use libsndfile on iOS:

I've compiled libsndfile on MACOSX 10.6.8 and it passed all the checks. But when I added it to the Xcode and tried to compile it on iOS, I got these link warning and errors:

ld: warning: in /Users/chencyz/Desktop/Development/SDK/libsndfile/lib/libsndfile.a, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols:
  "_sf_close", referenced from:
      SndfileHandle::SNDFILE_ref::~SNDFILE_ref()in AudioReader.o
  "_sf_error", referenced from:
      SndfileHandle::error() const in AudioReader.o
  "_sf_open", referenced from:
      SndfileHandle::SndfileHandle(char const*, int, int, int, int)in AudioReader.o
  "_sf_read_float", referenced from:
      SndfileHandle::read(float*, long long)in AudioReader.o
ld: symbol(s) not found

AudioReader is just a simple class which uses the program API of libsndfile.

Does anyone knows something about this?

Was it helpful?

Solution

It seems you did not recompile the library for iOS, you seem to be trying to link against the i386 version of the library. The first line in the error message you pasted is pretty clear about it.

iOS runs on ARM processors, so you need to build the library for ARM.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top