title: cannot find -lgnustl_static: Compiling Android SDL port with NDK r7
body: <p>I'm trying to build this port of libSDL for Android, using the new Android NDK r7 release:</p>
  
  <p><a href="https://github.com/pelya/commandergenius" rel="nofollow">https://github.com/pelya/commandergenius</a></p>
  
  <p>I know I am doing some things to some degree "unsupported": I am using cygwin&amp;windows despite that being mentioned in the README as no longer being supported.  That being said, I can hack out shell scripts and solve my problems as necessary and have it compiling but not linking.</p>
  
  <p>So anyways I have compiling working until the linking (sorry for large block, relevant part trimmed below):</p>
  
  <pre><code>/cygdrive/c/and/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-ar crs obj/local/armeabi/libflac.a ./obj/local/armeabi/objs-debug/flac/src/ogg_decoder_aspect.o ./obj/local/armeabi/objs-debug/flac/src/md5.o ./obj/local/armeabi/objs-debug/flac/src/stream_decoder.o ./obj/local/armeabi/objs-debug/flac/src/fixed.o ./obj/local/armeabi/objs-debug/flac/src/memory.o ./obj/local/armeabi/objs-debug/flac/src/stream_encoder.o ./obj/local/armeabi/objs-debug/flac/src/window.o ./obj/local/armeabi/objs-debug/flac/src/cpu.o ./obj/local/armeabi/objs-debug/flac/src/ogg_encoder_aspect.o ./obj/local/armeabi/objs-debug/flac/src/lpc.o ./obj/local/armeabi/objs-debug/flac/src/float.o ./obj/local/armeabi/objs-debug/flac/src/bitmath.o ./obj/local/armeabi/objs-debug/flac/src/metadata_object.o ./obj/local/armeabi/objs-debug/flac/src/ogg_helper.o ./obj/local/armeabi/objs-debug/flac/src/metadata_iterators.o ./obj/local/armeabi/objs-debug/flac/src/bitreader.o ./obj/local/armeabi/objs-debug/flac/src/bitwriter.o ./obj/local/armeabi/objs-debug/flac/src/stream_encoder_framing.o ./obj/local/armeabi/objs-debug/flac/src/crc.o ./obj/local/armeabi/objs-debug/flac/src/format.o ./obj/local/armeabi/objs-debug/flac/src/ogg_mapping.o
  C:/and/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld.exe: cannot find -lgnustl_static
  collect2: ld returned 1 exit status
  /cygdrive/c/and/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-ar crs obj/local/armeabi-v7a/libflac.a ./obj/local/armeabi-v7a/objs-debug/flac/src/ogg_decoder_aspect.o ./obj/local/armeabi-v7a/objs-debug/flac/src/md5.o ./obj/local/armeabi-v7a/objs-debug/flac/src/stream_decoder.o ./obj/local/armeabi-v7a/objs-debug/flac/src/fixed.o ./obj/local/armeabi-v7a/objs-debug/flac/src/memory.o ./obj/local/armeabi-v7a/objs-debug/flac/src/stream_encoder.o ./obj/local/armeabi-v7a/objs-debug/flac/src/window.o ./obj/local/armeabi-v7a/objs-debug/flac/src/cpu.o ./obj/local/armeabi-v7a/objs-debug/flac/src/ogg_encoder_aspect.o ./obj/local/armeabi-v7a/objs-debug/flac/src/lpc.o ./obj/local/armeabi-v7a/objs-debug/flac/src/float.o ./obj/local/armeabi-v7a/objs-debug/flac/src/bitmath.o ./obj/local/armeabi-v7a/objs-debug/flac/src/metadata_object.o ./obj/local/armeabi-v7a/objs-debug/flac/src/ogg_helper.o ./obj/local/armeabi-v7a/objs-debug/flac/src/metadata_iterators.o ./obj/local/armeabi-v7a/objs-debug/flac/src/bitreader.o ./obj/local/armeabi-v7a/objs-debug/flac/src/bitwriter.o ./obj/local/armeabi-v7a/objs-debug/flac/src/stream_encoder_framing.o ./obj/local/armeabi-v7a/objs-debug/flac/src/crc.o ./obj/local/armeabi-v7a/objs-debug/flac/src/format.o ./obj/local/armeabi-v7a/objs-debug/flac/src/ogg_mapping.o
  C:/and/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld.exe: cannot find -lgnustl_static
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>Relevant failure, if you can't parse that wall of text:</p>
  
  <pre><code>ld.exe: cannot find -lgnustl_static
  </code></pre>
  
  <p>Now, if I look at the Windows NDK release I find gnustl_* files here:</p>
  
  <p>under ./android-ndk-r7/sources:</p>
  
  <pre><code>./cxx-stl/gnu-libstdc++/libs/armeabi/libgnustl_shared.so
  ./cxx-stl/gnu-libstdc++/libs/armeabi/libgnustl_static.a
  ./cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libgnustl_shared.so
  ./cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libgnustl_static.a
  ./cxx-stl/gnu-libstdc++/libs/x86/libgnustl_shared.so
  ./cxx-stl/gnu-libstdc++/libs/x86/libgnustl_static.a
  </code></pre>
  
  <p>I looked also at the linux android NDK distribution and they are packaged the same (only have libgnustl files, built, under the sources directory).</p>
  
  <p><strong>So I have 3 questions:</strong></p>
  
  <ul>
  <li>why would we be using -l to link libgnustl_static when it's a .a
  file?  Shouldn't that be just including the .a file in the object
  list, or alternately be -lgnustl_shared?</li>
  <li>why are these files only under "sources"?  I would have expected them to be in the "toolchains" library NDK directory.  How does anyone ever link against libgnustl?</li>
  <li>Can I copy these files somewhere where they'll be seen by the linker?  Just adding their directory with -L hasn't seemed to work, and plus I need to get the right versions linked with the right build target (armeabi vs armeabi-v7 vs x86)</li>
  </ul>