KelvinJin/libsox-iOS

Unable to build libsox-iOS using steps defined in readme

AwaisFayyaz opened this issue · 5 comments

Hi,

First of all, thanks for the libSox.

I am trying to build it myself because the prebuilt version is not working correct with my objective c code. i filed an issue describing the problem that i am facing. That's why i am trying to build it myself.

I followed all steps one by one. i also switched to "sox-14.4.2"

But following error occurs.

Undefined symbols for architecture arm64:
  "_op_channel_count", referenced from:
      _startread in libsox.a(libsox_la-opus.o)
  "_op_free", referenced from:
      _stopread in libsox.a(libsox_la-opus.o)
  "_op_open_callbacks", referenced from:
      _startread in libsox.a(libsox_la-opus.o)
  "_op_pcm_seek", referenced from:
      _seek in libsox.a(libsox_la-opus.o)
  "_op_pcm_total", referenced from:
      _startread in libsox.a(libsox_la-opus.o)
  "_op_read", referenced from:
      _read_samples in libsox.a(libsox_la-opus.o)
  "_op_tags", referenced from:
      _startread in libsox.a(libsox_la-opus.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [sox] Error 1
make: *** [install-recursive] Error 1
cp: /Users/bugdevstudios/Documents/Development/Sox_Lib/sox-code/iOS-arm64/lib/libsox.a: No such file or directory
fatal error: /Users/bugdevstudios/Documents/Development/Software/Xcode/10.2/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't figure out the architecture type of: build/sox.h

Any help would be much appreciated.

Thank you very much!

Hey mate, have a look at this issue here #7. I believe the error is related to the opus lib.

Thanks for quick reply! Looking into issue #7

Hi,

Issue #7 suggested to remove opus. so i removed it and ran the script again. As a result, /build folder now include following files as seen below

  1. libsox-arm64.a
  2. libsox-armv7.a
  3. libsox-armv7s.a
  4. libsox-i386.a
  5. libsox-x86_64.a
  6. sox.h

Screenshot 2019-10-10 at 10 55 33 AM

However, output in terminal includes a following fatal error. What about It?
can't figure out the architecture type of: build/sox.h

cd /Users/bugdevstudios/Documents/Development/Sox_Lib/sox-code/iOS-arm64/share/man/man1 && rm -f play.1 && ln -s sox.1 play.1
cd /Users/bugdevstudios/Documents/Development/Sox_Lib/sox-code/iOS-arm64/share/man/man1 && rm -f rec.1 && ln -s sox.1 rec.1
cd /Users/bugdevstudios/Documents/Development/Sox_Lib/sox-code/iOS-arm64/share/man/man7 && rm -f soxeffect.7 && ln -s ../man1/sox.1 soxeffect.7
**fatal error:** /Users/bugdevstudios/Documents/Development/Software/Xcode/10.2/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't figure out the architecture type of: build/sox.h

And secondly, which of the .a file should i use in my mac application ?

Thanks Sir

So libo is meant to merge all the .a libraries into one universal .a file that you can import into your project to support both simulator and device (i guess in your case only the x86_64 version matters since you're using it on macOS. You can either simply use the x86_64 version by importing the .a and the header file into your project or you can run (assuming you're in the sox folder)

/Users/bugdevstudios/Documents/Development/Software/Xcode/10.2/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo build/*.a --output build/sox.a

Thanks Kelvin,

i used your command but the error was unknown flag: --output

I read man page of lipo and modified the script so now it executes properly and produces a sox.a file correctly.

The correct script will be

/Users/bugdevstudios/Documents/Development/Software/Xcode/10.2/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo build/*.a -create -output build/sox.a

Thats done. Thank you very much.

Now i may ask, who can help me regarding 'pad' command of sox ?

After building the libsox myself, the pad command behaviour is same. Not producing expected results. i think i am missing something regarding its usage.

Thanks.