title: "undefined reference" error from static lib of external parquet project
body: <p>I want to link expernal 'parquet' project ( <a href="https://github.com/apache/arrow/tree/master/cpp" rel="nofollow noreferrer">https://github.com/apache/arrow/tree/master/cpp</a> ) as part of my current project on Linux. </p>
  
  <p>For this purposes I ran cmake of parquet with such parameters </p>
  
  <pre><code>cd build_parquet
  cmake -DCMAKE_BUILD_TYPE=Release -DARROW_PARQUET=ON  \
   -DBoost_NO_BOOST_CMAKE=TRUE -DBoost_NO_SYSTEM_PATHS=TRUE -DBOOST_ROOT=${BOOST_BUILD_DIR}/include  -DBOOST_LIBRARYDIR=${BOOST_BUILD_DIR}/lib/boost -DARROW_BOOST_USE_SHARED=OFF -DBOOST_INCLUDEDIR=${BOOST_BUILD_DIR}/include/boost ..
  
  cmake --build . --config Release
  </code></pre>
  
  <p>// There are a lot of dependencies except boost, but only boost required to be installed on system, since other could be downloaded and installed by cmake script </p>
  
  <p>Project successfully compiled. I got executable which could launch, generated static libs libarrow.a, libparquet.a, shared libraries libarrow.so, libparquet.so</p>
  
  <p>In my main project I want to use such libraries and I use such commands in cmake to find them</p>
  
  <pre><code>find_path(PARQUET_INCLUDE_DIR NAMES arrow/api.h PATHS ${PARQUET_DIR}/src)
  
  find_library(PARQUET_LIBRARY_RELEASE NAMES parquet.a
                PATHS build_parquet/release/Release/ )
  
  find_library(ARROW_LIBRARY_RELEASE NAMES arrow.a
               PATHS build_parquet/release/Release/ )
  
  set(PARQUET_LIBRARIES_RELEASE ${PARQUET_LIBRARY_RELEASE} ${ARROW_LIBRARY_RELEASE} )
  
  include(FindPackageHandleStandardArgs)
  find_package_handle_standard_args(Parquet DEFAULT_MSG PARQUET_INCLUDE_DIR
                                    ${PARQUET_LIBRARIES_RELEASE } )
  
  </code></pre>
  
  <p>That's work okay, libraries and includes are found.</p>
  
  <p>Then I link this libraries to my project </p>
  
  <pre><code>target_link_libraries(${myExe} ${PARQUET_LIBRARIES_RELEASE} ${mySomeOtherLibraries} )
  </code></pre>
  
  <p>after this I got enormous amount of linker errors such that</p>
  
  <pre><code>libparquet.a(column_writer.cc.o): In function `apache::thrift::transport::TMemoryBuffer::~TMemoryBuffer()':
  column_writer.cc:(.text._ZN6apache6thrift9transport13TMemoryBufferD0Ev[_ZN6apache6thrift9transport13TMemoryBufferD5Ev]+0x3): undefined reference to `vtable for apache::thrift::transport::TMemoryBuffer'
  .....
  </code></pre>
  
  <p>so that's what I don't understand much, why lib compiled well in parquet project itself but has a lot of unresolved now, when I use it to link in my own project? Moreover I compiled project for windows and when I did the same things, but with arrow.lib and parquet.lib (instead of libparquet.a and libarrow.a ) things worked fine! I was needed only to put arrow.dll, parquet.dll to executables to run project. But in Linux I've already crashed my head</p>
  
  <p>So, why it doesn't work, what I should do to finally link the project with library ? </p>
  
  <p><strong>Update</strong></p>
  
  <p>I found the problem, I had to link libraries with adding .so files (not only .a files) like this</p>
  
  <pre><code>
  find_library(PARQUET_LIBRARY_RELEASE NAMES parquet.so parquet.a
               PATHS build_parquet/release/Release/ )
  
  find_library(ARROW_LIBRARY_RELEASE NAMES arrow.so arrow.a
              PATHS build_parquet/release/Release/ )
  
  set(PARQUET_LIBRARIES_RELEASE ${PARQUET_LIBRARY_RELEASE} ${ARROW_LIBRARY_RELEASE} )
  
  </code></pre>
  
  <p>Project is builded. So now the question is, why I need to add .so files to linker (in Windows only static .lib are enough), is it always a case when I build project in Linux ? Is order of linkage important ( .so files first and .a files next ? )</p>