title: Aggregate static libraries
body: <p>I try to aggregate multiple .a files into a single one. The command is the following:</p>
  
  <pre><code>TARGET=libnumpy.a
  DIR=build/lib.linux-x86_64-2.6/numpy
  FILES=$(DIR)/core/_sort.a $(DIR)/core/multiarray.a $(DIR)/core/umath.a $(DIR)/core/scalarmath.a $(DIR)/core/umath_tests.a $(DIR)/core/multiarray_tests.a $(DIR)/lib/_compiled_base.a $(DIR)/numarray/_capi.a $(DIR)/fft/fftpack_lite.a $(DIR)/linalg/lapack_lite.a $(DIR)/random/mtrand.a
  
  all:
      ar cr $(TARGET) $(FILES)
  </code></pre>
  
  <p>But the resulting library libnumpy.a is unusable. When trying to compile something with it, I get</p>
  
  <pre><code>libnumpy.a: could not read symbols: Archive has no index; run ranlib to add one
  </code></pre>
  
  <p>(I tried to run ranlib but it didn't solve the problem)</p>
  
  <p>When doing nm libnumpy.a I get</p>
  
  <pre><code>nm: _sort.a: File format not recognized
  nm: multiarray.a: File format not recognized
  nm: umath.a: File format not recognized 
  nm: scalarmath.a: File format not recognized
  nm: umath_tests.a: File format not recognized
  nm: multiarray_tests.a: File format not recognized
  nm: _compiled_base.a: File format not recognized
  nm: _capi.a: File format not recognized
  nm: fftpack_lite.a: File format not recognized
  nm: lapack_lite.a: File format not recognized
  nm: mtrand.a: File format not recognized
  </code></pre>
  
  <p>What's wrong with this?</p>