I try to aggregate multiple .a files into a single one. The command is the following:
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)
But the resulting library libnumpy.a is unusable. When trying to compile something with it, I get
libnumpy.a: could not read symbols: Archive has no index; run ranlib to add one
(I tried to run ranlib but it didn’t solve the problem)
When doing nm libnumpy.a I get
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
What’s wrong with this?
As @Mat mentioned: