title: Why does my .so have undefined symbols
body: <p>Im creating a runtime loaded shared object in linux that impliments some JSON using jannson.h.</p>
  
  <p>This is how I'm building the .so:</p>
  
  <pre><code>gcc -Wall -fPIC -c device_simulator_json.c
  
  gcc -shared -Wl,-soname,device_simulator_json.so.1 -o device_simulator_json.so.1.0 device_simulator_json.o
  </code></pre>
  
  <p>When my application tries to load the .so, I get an error indication:
      undefined symbol: json_object</p>
  
  <p>I'm guessing that my .so has to include in it the jansson object. But I'm not sure which one or how. I can see the following jansson objects in my /usr/local/lib:</p>
  
  <pre><code>./usr/local/lib/libjansson.so.4.7.0
  ./usr/local/lib/libjansson.so.4
  ./usr/local/lib/libjansson.a
  ./usr/local/lib/libjansson.so
  </code></pre>
  
  <p>Because the .so I'm building is dynamically loaded at runtime (using dlopen), doesn't the jansson object I use also have to be built with PIC.</p>
  
  <p>Thanks.</p>