title: Build smplayer to LLVM IR and run by lli
body: <p>In ubuntu-14.10_amd64,I compiler smplayer-14.9.0.6690 by clang/llvm-3.4.
  I changed the Makefile in src, like:</p>
  
  <pre><code>CC=clang 
  CXX=clang
  CFLAGS = -emit-llvm ...
  CXXFLAGS = -emit-llvm ...
  LINK = llvm-link
  TARGET = smplayer.bc
  </code></pre>
  
  <p>...</p>
  
  <p>At last I got <code>smplayer.bc</code>. Then I used</p>
  
  <pre><code>$ llvm-dis smplayer.bc -o smplayer.ll 
  $ lli -load=... -load=......  smplayer.ll 
  </code></pre>
  
  <p>But it got an error:</p>
  
  <pre><code>LLVM ERROR: Program used external function '__dso_handle' which could not be resolved!
  </code></pre>
  
  <p>Then I used clang to build bc to native executable like this:</p>
  
  <pre><code>$ clang smplayer.bc -v -o smplayer.na -m64 -L/usr/lib/x86_64-linux-gnu -lz -lQtDBus -lQtScript -lQtXml -lQtGui -lQtNetwork -lQtCore -lpthread
  </code></pre>
  
  <p>The error is:</p>
  
  <pre><code>/usr/bin/ld: /tmp/smplayer-7c5fc5.o: undefined reference to symbol '__cxa_pure_virtual@@CXXABI_1.3'
  /usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
  </code></pre>