Use HTSlib in Xcode

Recently I am going to use HTSlib to read variant file from gnomAD without decompress those extrodinary large files. After I installed the HTSlib, I tried the exmaple code fro GitHub site of HTSlib. There are many compiling errors.

First, Xcode cannot find the header files. The default installment directory of HTSlib for header and library files are “/usr/local/include”” and “/usr/local/lib” fox MacOS. The problem is Xcode does not include the two in its searching path. We have to include the two by ourselves:

  • Double-click the project in Xcode to open the Info window
  • Select “Building-Settings” tab
  • Under “Search Paths”“, add “/usr/local/include” in “Header Search Paths” and “/usr/local/lib” in “Library Search Paths”

After inlcuding the paths, another issue came out. I had some errors during compiling like

Undefined symbols for architecture x86_64:
hts***“, referenced from:
_main in *****.o

This is kind of link issue. Still under “Building-Settings” tab, add “-lhts” to “Other Linker Flags” in “Linking”.

Enjoy!

Avatar
Gang Peng
Associate Research Scientist in Biostatistics

My research interests include biostatistics, bioinformatics, and data mining.

comments powered by Disqus