title: Strange linking behaviour and undefined symbols
body: <p>I am linking an external library (via wierd process, mpicc + Cython + etc),
  but I have a weird behaviour of a linking procedure.</p>
  
  <p>There are two .o files, libpetsc4py.o and PETSc.o
  they are linked into a .so file PETSc.so</p>
  
  <p>One contains an undefined symbol <code>__pyx_tp_new_8petsc4py_5PETSc_Object</code></p>
  
  <pre><code>[zheltkov@compiler-2 src]$ nm libpetsc4py.o | grep __pyx_tp_new_8petsc4py_5PETSc_Object
                         U __pyx_tp_new_8petsc4py_5PETSc_Object
  </code></pre>
  
  <p>It is defined in another .o file:</p>
  
  <pre><code>[zheltkov@compiler-2 src]$ nm PETSc.o | grep __pyx_tp_new_8petsc4py_5PETSc_Object
  00000000001b92f0 t __pyx_tp_new_8petsc4py_5PETSc_Object
  </code></pre>
  
  <p>Then, then linking is done (the compile line is weird, sorry)</p>
  
  <pre><code>mpicc -pthread -fPIC -wd1572 -g -shared -fno-strict-aliasing -g -O2 -DNDEBUG -O2 -g
  build/temp.linux-x86_64-2.7/arch-linux2-c-debug/src/PETSc.o build/temp.linux-x86_64-
  2.7/arch-    linux2-c-debug/src/libpetsc4py.o -L/home/users/zheltkov/tmp/petsc-3.3/arch
  -linux2-c-debug/lib -L/home/users/zheltkov/ivan/soft/epd7.2/lib 
  -Wl,rpath,/home/users/zheltkov/tmp/petsc-3.3/arch-linux2-c-debug/lib 
  -Wl,-rpath,/home/users/zheltkov/ivan/soft/epd7.2/lib -lpetsc -lpython2.7 -o
  build/lib.linux-x86_64-2.7/petsc4py/lib/a    rch-linux2-c-debug/PETSc.so -lX11 -Wl,
  -rpath,/home/users/zheltkov/tmp/petsc-3.3/arch-linux2-c-debug/lib 
  -L/home/users/zheltkov/tmp/petsc-3.3/arch-linux2-c-debug/lib -lfftw3_mpi -lfftw3 -lHYPRE 
  -Wl,-rpath,/opt/intel/impi/4.1.0.030/intel64/lib 
  -L/opt/intel/impi/4.1.0.030/intel64/lib -Wl,
  -rpath,/opt/intel/composer_xe_2013.2.146/mkl/lib/intel64 
  -L/opt/intel/composer_xe_2013.2.146/mkl/lib/intel64 
  -Wl,-rpath,/opt/intel/composer_xe_2013.2.146/compiler/lib/intel64 
  -L/opt/intel/composer_xe_2013.2.146/compiler/lib/intel64 -Wl,
  -rpath,/usr/lib/gcc/x86_64-redhat-linux/4.4.6 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.6 
  -Wl,- rpath,/mnt/data/users/dm4/vol9/zheltkov/tmp/petsc-3.3/-Xlinker -lmpigc4 
  -Wl,-rpath,/opt/intel/mpi-rt/4.1 -lml -lpthread -Wl,-rpath,
  /opt/intel/composer_xe_2013/mkl/lib/intel64 
  -L/opt/intel/composer_xe_2013/mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread
  -lmkl_core -liomp5 -lifport -lifcore -lm -ldl -lmpigf -lmpi_dbg -lmpigi -lrt 
  -limf -lsvml -lirng -lipgo -ldecimal -lcilkrts -lstdc++     -lgcc_s -lirc -lirc_s
  </code></pre>
  
  <p>But finally, the resulting files has two symbols with the same name, one of them is undefined and everything does not work:</p>
  
  <pre><code>[zheltkov@compiler-2 arch-linux2-c-debug]$ nm PETSc.so | grep __pyx_tp_new_8petsc4py_5PETSc_Object
  0000000000200d20 t __pyx_tp_new_8petsc4py_5PETSc_Object
                   U __pyx_tp_new_8petsc4py_5PETSc_Object
  </code></pre>
  
  <p>What am I doing wrong? Why there are two symbols with the same name?</p>