title: Cython, OS X and link errors
body: <p>I've followed a simple tutorial on Cython with the following steps:</p>
  
  <ol>
  <li><p>Make a simple python file, testme.py:</p>
  
  <p>print( "Hello there!!" )</p></li>
  <li><p>Create a c file from that using cython:</p>
  
  <p>cython -a testme.py</p></li>
  <li><p>Compile the resulting testme.c file with gcc:</p>
  
  <p>gcc -Os -I /usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -o testme testme.c -lpthread -lm -lutil -ldl</p></li>
  </ol>
  
  <p>The result is quite a few lines like these:</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "_PyCode_New", referenced from:
        _inittestme in testme-4ef125.o
    "_PyDict_New", referenced from:
        _inittestme in testme-4ef125.o
    "_PyDict_SetItem", referenced from:
        _inittestme in testme-4ef125.o
    "_PyErr_Clear", referenced from:
        _inittestme in testme-4ef125.o
        _main in testme-4ef125.o
    "_PyErr_Occurred", referenced from:
        _inittestme in testme-4ef125.o
        _main in testme-4ef125.o
    "_PyErr_Print", referenced from:
        _main in testme-4ef125.o
    "_PyErr_SetString", referenced from:
        _inittestme in testme-4ef125.o
    "_PyErr_WarnEx", referenced from:
        _inittestme in testme-4ef125.o
    "_PyExc_ImportError", referenced from:
        _inittestme in testme-4ef125.o
    "_PyExc_RuntimeError", referenced from:
        _inittestme in testme-4ef125.o
  </code></pre>
  
  <p>Clearly, there's a missing link library.  I have the following </p>
  
  <pre><code>/usr/lib/libpython2.6.dylib -&gt; ../../System/Library/Frameworks/Python.framework/Versions/2.6/Python
  </code></pre>
  
  <p>but adding that to the gcc command gives me a XXX not found error:</p>
  
  <pre><code>gcc -Os -I /usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -o hello testme.c -l/usr/lib/libpython2.6.dylib -lpthread -lm -lutil -ldl
  ld: library not found for -l/usr/lib/libpython2.6.dylib
  </code></pre>
  
  <p>The path is correct.  The library is there.</p>
  
  <p>Any hints?</p>