title: sparse - Fixing build warnings
body: <p>I'm compiling the <a href="https://sparse.wiki.kernel.org/index.php/Main_Page" rel="nofollow noreferrer">sparse</a> - linux kernel checking tool.</p>
  
  <p>But it throws the following warning:</p>
  
  <blockquote>
    <p>lovegcy@knltest-VirtualBox:~/git_root/sparse$ make<br>
         GEN      version.h<br>
    <strong>/bin/sh: 1: llvm-config: not found</strong><br>
    <strong>Makefile:63: Your system does not have libxml, disabling c2xml<br>
    Makefile:75: Your system does not have libgtk2, disabling test-inspect<br>
    Makefile:79: Your system does not have llvm, disabling sparse-llvm</strong><br>
         CC       test-lexing.o<br>
         CC       target.o<br>
         CC       parse.o<br>
         CC       tokenize.o<br>
         CC       pre-process.o<br>
         CC       symbol.o<br>
         CC       lib.o<br>
         CC       scope.o<br>
         CC       expression.o<br>
         CC       show-parse.o<br>
         CC       evaluate.o<br>
         CC       expand.o<br>
         CC       inline.o<br>
         CC       linearize.o<br>
         CC       char.o<br>
         CC       sort.o<br>
         CC       allocate.o<br>
         CC       compat-linux.o<br>
         CC       ptrlist.o<br>
         CC       flow.o<br>
         CC       cse.o<br>
         CC       simplify.o<br>
         CC       memops.o<br>
         CC       liveness.o<br>
         CC       storage.o<br>
         CC       unssa.o<br>
         CC       dissect.o<br>
         AR       libsparse.a<br>
         LINK     test-lexing<br>
         CC       test-parsing.o<br>
         LINK     test-parsing<br>
         CC       obfuscate.o<br>
         LINK     obfuscate<br>
         CC       compile.o<br>
         CC       compile-i386.o<br>
    compile-i386.c: In function ‘emit_insn_atom’:<br>
    <strong>compile-i386.c:719:7: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]</strong><br>
         LINK     compile<br>
         CC       graph.o<br>
         LINK     graph<br>
         CC       sparse.o<br>
         LINK     sparse<br>
         CC       test-linearize.o<br>
         LINK     test-linearize<br>
         CC       example.o<br>
         LINK     example<br>
         CC       test-unssa.o<br>
         LINK     test-unssa<br>
         CC       test-dissect.o<br>
         LINK     test-dissect<br>
         CC       ctags.o<br>
         LINK     ctags<br>
         GEN      sparse.pc  </p>
  </blockquote>
  
  <p>Fix the following<br>
  Makefile:63: Your system does not have libxml, disabling c2xml<br>
  Makefile:75: Your system does not have libgtk2, disabling test-inspect  </p>
  
  <p><strong>by:</strong>   </p>
  
  <pre><code>$ sudo apt-get install libxml2-dev libgtk2.0-dev
  </code></pre>
  
  <p>For  </p>
  
  <blockquote>
    <p>/bin/sh: 1: llvm-config: not found<br>
    Makefile:79: Your system does not have llvm, disabling sparse-llvm  </p>
  </blockquote>
  
  <p>the llvm-3.2-dev is installed, but it is still there.</p>
  
  <p>I still donot know how to fix the following warning too:  </p>
  
  <blockquote>
    <p>compile-i386.c: In function ‘emit_insn_atom’:<br>
    compile-i386.c:719:7: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]  </p>
  </blockquote>
  
  <p>Could anyone give some suggestions?</p>
  
  <p>Thank you very much!</p>
  
  <hr>
  
  <p><strong>Update</strong> : Following  <a href="https://stackoverflow.com/a/18139577/319204">TheCodeArtist's suggestion</a>, here is the build error log after llvm installed.</p>
  
  <pre><code>lovegcy@knltest-VirtualBox:~/git_root/sparse$ make
  CC test-lexing.o
  CC target.o
  CC parse.o
  CC tokenize.o
  CC pre-process.o
  CC symbol.o
  CC lib.o
  CC scope.o
  CC expression.o
  CC show-parse.o
  CC evaluate.o
  CC expand.o
  CC inline.o
  CC linearize.o
  CC char.o
  CC sort.o
  CC allocate.o
  CC compat-linux.o
  CC ptrlist.o
  CC flow.o
  CC cse.o
  CC simplify.o
  CC memops.o
  CC liveness.o
  CC storage.o
  CC unssa.o
  CC dissect.o
  AR libsparse.a
  LINK test-lexing
  CC test-parsing.o
  LINK test-parsing
  CC obfuscate.o
  LINK obfuscate
  CC compile.o
  CC compile-i386.o
  compile-i386.c: In function ‘emit_insn_atom’:
  compile-i386.c:719:7: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
  LINK compile
  CC graph.o
  LINK graph
  CC sparse.o
  LINK sparse
  CC test-linearize.o
  LINK test-linearize
  CC example.o
  LINK example
  CC test-unssa.o
  LINK test-unssa
  CC test-dissect.o
  LINK test-dissect
  CC ctags.o
  LINK ctags
  CC c2xml.o
  LINK c2xml
  CC test-inspect.o
  CC ast-model.o
  CC ast-view.o
  CC ast-inspect.o
  LINK test-inspect
  CC sparse-llvm.o
  LINK sparse-llvm
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(Signals.o): In function PrintStackTrace(void*)':
  (.text+0x74): undefined reference todladdr'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(Signals.o): In function PrintStackTrace(void*)':
  (.text+0x1fe): undefined reference todladdr'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(Mutex.o): In function llvm::sys::MutexImpl::MutexImpl(bool)':
  (.text+0x58): undefined reference topthread_mutexattr_init'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(Mutex.o): In function llvm::sys::MutexImpl::MutexImpl(bool)':
  (.text+0x64): undefined reference topthread_mutexattr_settype'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(Mutex.o): In function llvm::sys::MutexImpl::MutexImpl(bool)':
  (.text+0x74): undefined reference topthread_mutexattr_setpshared'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(Mutex.o): In function llvm::sys::MutexImpl::MutexImpl(bool)':
  (.text+0x88): undefined reference topthread_mutexattr_destroy'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(Mutex.o): In function llvm::sys::MutexImpl::tryacquire()':
  (.text+0x179): undefined reference topthread_mutex_trylock'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(RWMutex.o): In function llvm::sys::RWMutexImpl::RWMutexImpl()':
  (.text+0x3e): undefined reference topthread_rwlock_init'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(RWMutex.o): In function llvm::sys::RWMutexImpl::~RWMutexImpl()':
  (.text+0x80): undefined reference topthread_rwlock_destroy'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(RWMutex.o): In function llvm::sys::RWMutexImpl::reader_acquire()':
  (.text+0xb9): undefined reference topthread_rwlock_rdlock'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(RWMutex.o): In function llvm::sys::RWMutexImpl::reader_release()':
  (.text+0xe9): undefined reference topthread_rwlock_unlock'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(RWMutex.o): In function llvm::sys::RWMutexImpl::writer_acquire()':
  (.text+0x119): undefined reference topthread_rwlock_wrlock'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(RWMutex.o): In function llvm::sys::RWMutexImpl::writer_release()':
  (.text+0x149): undefined reference topthread_rwlock_unlock'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(ThreadLocal.o): In function llvm::sys::ThreadLocalImpl::~ThreadLocalImpl()':
  (.text+0x25): undefined reference topthread_key_delete'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(ThreadLocal.o): In function llvm::sys::ThreadLocalImpl::ThreadLocalImpl()':
  (.text+0xae): undefined reference topthread_key_create'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(ThreadLocal.o): In function llvm::sys::ThreadLocalImpl::setInstance(void const*)':
  (.text+0xe2): undefined reference topthread_setspecific'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(ThreadLocal.o): In function llvm::sys::ThreadLocalImpl::getInstance()':
  (.text+0x10a): undefined reference topthread_getspecific'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(Threading.o): In function llvm::llvm_execute_on_thread(void (*)(void*), void*, unsigned int)':
  (.text+0x1c2): undefined reference topthread_create'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(Threading.o): In function llvm::llvm_execute_on_thread(void (*)(void*), void*, unsigned int)':
  (.text+0x1da): undefined reference topthread_join'
  /usr/lib/llvm-3.2/lib/libLLVMSupport.a(Threading.o): In function llvm::llvm_execute_on_thread(void (*)(void*), void*, unsigned int)':
  (.text+0x20c): undefined reference topthread_attr_setstacksize'
  collect2: error: ld returned 1 exit status
  make: * [sparse-llvm] Error 1 
  </code></pre>