title: Static library built for archive which is not the architecture being linked (x86_64)
body: <p>I am experiencing what seems to be the same problem when I try to compile two different programs. Each of them creates first a static library and then the main application linking that library. I am working on Mac OS Mavericks with gcc 4.7.2. </p>
  
  <p><strong>Program 1</strong></p>
  
  <p>This is what is happening when I run <code>make</code>:</p>
  
  <p>First, the library <code>libfeat.a</code> is created, but I get a warning:</p>
  
  <pre><code>ar rc ../lib/libfeat.a imgfeatures.o utils.o sift.o kdtree.o minpq.o xform.o
  ranlib  ../lib/libfeat.a
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: warning for library: ../lib/libfeat.a the table of contents is empty (no object file members in the library define global symbols)
  </code></pre>
  
  <p>Then, when compiling the application, it says that it cannot use the library because it wasn't built for the same architecture (x86_64):</p>
  
  <pre><code>gcc -O3 -I../include `pkg-config --cflags opencv` `pkg-config --cflags gtk+-3.0` `pkg-config --cflags gsl` siftfeat.c -o ../bin/siftfeat -L../lib -lfeat `pkg-config --libs opencv` `pkg-config --libs gtk+-3.0` `pkg-config --libs gsl`
  ld: warning: ignoring file ../lib/libfeat.a, file was built for archive which is not the architecture being linked (x86_64): ../lib/libfeat.a
  </code></pre>
  
  <p>If I run <code>lipo</code>, I get this:</p>
  
  <pre><code>$ lipo -info ../lib/libfeat.a 
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: archive with no architecture specification: ../lib/libfeat.a (can't determine architecture for it)
  </code></pre>
  
  <p><strong>Program 2</strong></p>
  
  <p>I am experiencing the same problem with a different program that does the same: creating a library first and using it later. </p>
  
  <p>This is the output when creating the lib:</p>
  
  <pre><code>ar crv libsba.v1.5.a sba_levmar.o sba_levmar_wrap.o sba_lapack.o sba_crsm.o sba_chkjac.o
  r - sba_levmar.o
  r - sba_levmar_wrap.o
  r - sba_lapack.o
  r - sba_crsm.o
  r - sba_chkjac.o
  ranlib libsba.v1.5.a
  </code></pre>
  
  <p>This is the application:</p>
  
  <pre><code>c++ -o bundler -O3 -Wall -fpermissive  -I../lib/imagelib -I../lib/sfm-driver -I../lib/matrix -I../lib/5point -I../lib/sba-1.5 -I../lib/ann_1.1_char/include  -L../lib -L../lib/ann_1.1_char/lib \
      -D__NO_UI__ -D__BUNDLER__ -D__BUNDLER_DISTR__ BaseApp.o BundlerApp.o keys.o Register.o Epipolar.o Bundle.o BundleFast.o MatchTracks.o Camera.o Geometry.o ImageData.o SifterUtil.o BaseGeometry.o BundlerGeometry.o BoundingBox.o BundleAdd.o ComputeTracks.o BruteForceSearch.o BundleIO.o ProcessBundle.o BundleTwo.o Decompose.o RelativePose.o Distortion.o TwoFrameModel.o LoadJPEG.o -limage -lsfmdrv -lsba.v1.5 -lmatrix -lz -llapack -lblas -lcblas -lminpack -lm -l5point -ljpeg -lANN_char -lgfortran
  ld: warning: ld: warning: ignoring file ../lib/libsba.v1.5.a, file was built for archive which is not the architecture being linked (x86_64)
  </code></pre>
  
  <p>In this case, <code>lipo</code> does tell me that the architecture of the library is x86_64:</p>
  
  <pre><code>$ lipo -info lib/libsba.v1.5.a 
  input file lib/libsba.v1.5.a is not a fat file
  Non-fat file: lib/libsba.v1.5.a is architecture: x86_64
  </code></pre>
  
  <p>What's going on?</p>