Skip to content

Conversation

@coredumped
Copy link
Contributor

@coredumped coredumped commented Jun 2, 2017

Should fix #36
Provides sphinx binaries with bitcode support and also allows bitcode compilation for TLSphinx.
Includes a few utility scripts to rebuild sphinxbase and pocketsphinx when new versions are released by CMU's team.
Binaries provided are still pre5alpha, but including new releases should be a lot easier in the future.

…ld scripts tailored specifically for TLSphinx

---
## Manual Compilation
If possible please try automatic compilation when possible, manual compilation is not for the feint of heart yet it might help in scenarios where you want to build CMU Sphinx Base and Pocket Sphinx from their respective master branches.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a typo: feint should be faint

@BrunoBerisso
Copy link
Contributor

Thank you very much for this PR :) Really apreciaste your work.

I found something strange when checking the binaries here. There seems not to have the bit code included in the libraries. I'm running this tests (I test all the fat binaries, here only mention libsphinxbase.a for short):

$ file libsphinxbase.a
libsphinxbase.a: Mach-O universal binary with 5 architectures
libsphinxbase.a (for architecture armv7):	current ar archive random library
libsphinxbase.a (for architecture armv7s):	current ar archive random library
libsphinxbase.a (for architecture i386):	current ar archive random library
libsphinxbase.a (for architecture x86_64):	current ar archive random library
libsphinxbase.a (for architecture arm64):	current ar archive random library
$ otool -l libsphinxbase.s | grep bitcode
$ otool -l libsphinxbase.s | grep __LLVM

The calls to otool doesn't give any output so I try with this tool with more clear output:

$ ./ebcutil libsphinxbase.a
Error: No bitcode section in bio.o

Also the date of the fat library for pocketsphinx doesn't match the date for all the architectures here, maybe you forgot to rebuild the fat lib?

Thanks again!

@coredumped
Copy link
Contributor Author

Let me check what happened with the Fat one....

@coredumped
Copy link
Contributor Author

Ok, this is what I found... otool does not work recursively, that is... it will look for symbols in the fat binary itself but not in any embedded static libs thus it won't show bitcode information.
If you run:

for dir in * 
do 
 if [ -d $dir ]; then
  echo
  echo "${dir}:"
  otool -l ${dir}/libsphinxad.a | grep bitcode | head -1
  otool -l ${dir}/libsphinxad.a | grep __LLVM | head -1
  otool -l ${dir}/libsphinxbase.a | egrep bitcode | head -1
  otool -l ${dir}/libsphinxbase.a | egrep __LLVM | head -1
 fi
done

You'll get this output

arm64:
  sectname __bitcode
   segname __LLVM
  sectname __bitcode
   segname __LLVM

armv7:
  sectname __bitcode
   segname __LLVM
  sectname __bitcode
   segname __LLVM

armv7s:
  sectname __bitcode
   segname __LLVM
  sectname __bitcode
   segname __LLVM

i386:

x86_64:

The reason i386 and x86_64 does not show bitcode information is because it is till not supported for macOS/App Store apps.

My guess is that ebcutil shows no bitcode information on bio.o because it is testing the one in either i386 and x86_64 and is correctly stating that those do not have bitcode support.

The case for pocketsphinx's fat binary was that my script did not copied it due to a bug (actually a missing cp command), I'll be committing a fix shortly and also a new set binaries.

@coredumped
Copy link
Contributor Author

According to ebcutil...

You can also use ebcutil to check whether a given binary or library contains bitcode. It prints the first object encountered without bitcode and exits with a non-zero exit status.

Which matches with my previous comment.

…a fat binary into Sphinx/lib/pocketsphinx/libpocketsphinx.a
@BrunoBerisso BrunoBerisso merged commit d432586 into tryolabs:development Jun 2, 2017
@BrunoBerisso
Copy link
Contributor

Awesome! Thanks

@coredumped
Copy link
Contributor Author

My pleasure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants