title: undefined reference - portaudio
body: <p>An issue I am having with this cmake list, is that I am getting error message  <code>error: undefined reference to 'Pa_GetVersion'</code>
  for this piece of code:</p>
  <p>record.cpp:</p>
  <pre><code>#include &quot;record.h&quot;
  
  record::record()
  {
      std::cout &lt;&lt; &quot;Record Created!&quot; &lt;&lt; std::endl;
  }
  
  void record::example()
  {
      std::cout &lt;&lt; &quot;In example!&quot; &lt;&lt; std::endl;
      std::cout &lt;&lt; Pa_GetVersion();
  }
  </code></pre>
  <p>record.h</p>
  <pre><code>#ifndef RECORD_H
  #define RECORD_H
  #include &lt;iostream&gt;
  #include &quot;portaudio.h&quot;
  class record
  {
  public:
      record();
      void example();
  };
  
  #endif // RECORD_H
  </code></pre>
  <p>main.cpp:</p>
  <pre><code>#include &lt;iostream&gt;
  #include &quot;record.h&quot;
  
  using namespace std;
  
  int main()
  {
      record test;
      test.example();
  
      cout &lt;&lt; &quot;Hello World!&quot; &lt;&lt; endl;
      return 0;
  }
  </code></pre>
  <p>CMakeLists.txt:</p>
  <pre class="lang-cmake prettyprint-override"><code>project(audio)
  cmake_minimum_required(VERSION 3.2.2)
  #include externalproject {portaudio} if lib/portaudio don't exist.
  INCLUDE(ExternalProject)
  ExternalProject_Add(project_portaudio
      GIT_REPOSITORY      https://git.assembla.com/portaudio.git
      PREFIX              lib/portaudio
      UPDATE_COMMAND      &quot;&quot;
      CONFIGURE_COMMAND   &lt;SOURCE_DIR&gt;/configure
      BUILD_IN_SOURCE     1
      BUILD_COMMAND       make
      INSTALL_COMMAND     sudo make install
  )
  ExternalProject_Get_Property(project_portaudio BINARY_DIR)
  ExternalProject_Get_Property(project_portaudio SOURCE_DIR)
  
  SET(portaudio_lib_dir &quot;${BINARY_DIR}/lib/.libs&quot;)
  SET(portaudio_inc_dir &quot;${SOURCE_DIR}/include&quot;)
  
  
  #IF(CMAKE_SYSTEM_NAME STREQUAL &quot;Linux&quot;)
  #   SET(EXTRA_LIBS rt m asound  pthread)
  #ENDIF(CMAKE_SYSTEM_NAME STREQUAL &quot;Linux&quot;)
  
  #Add the files in the source list
  aux_source_directory(. SRC_LIST)
  
  #Add portaudio library
  ADD_LIBRARY(portaudio STATIC IMPORTED)
  SET_PROPERTY(TARGET portaudio PROPERTY IMPORTED_LOCATION &quot;${portaudio_lib_dir}/libportaudio.a&quot;)
  add_executable(${PROJECT_NAME} ${SRC_LIST} ${portaudio_inc_dir})
  
  #What to compile before target!
  add_dependencies(${PROJECT_NAME}  project_portaudio)
  
  #What libraries to link to the target!
  TARGET_LINK_LIBRARIES(${PROJECT_NAME} portaudio)
  project(audio)
  cmake_minimum_required(VERSION 3.2.2)
  #include externalproject {portaudio} if lib/portaudio don't exist.
  INCLUDE(ExternalProject)
  ExternalProject_Add(project_portaudio
      GIT_REPOSITORY      https://git.assembla.com/portaudio.git
      PREFIX              lib/portaudio
      UPDATE_COMMAND      &quot;&quot;
      CONFIGURE_COMMAND   &lt;SOURCE_DIR&gt;/configure
      BUILD_IN_SOURCE     1
      BUILD_COMMAND       make
      INSTALL_COMMAND     sudo make install
  )
  ExternalProject_Get_Property(project_portaudio BINARY_DIR)
  ExternalProject_Get_Property(project_portaudio SOURCE_DIR)
  
  SET(portaudio_lib_dir &quot;${BINARY_DIR}/lib/.libs&quot;)
  SET(portaudio_inc_dir &quot;${SOURCE_DIR}/include&quot;)
  
  
  #IF(CMAKE_SYSTEM_NAME STREQUAL &quot;Linux&quot;)
  #   SET(EXTRA_LIBS rt m asound  pthread)
  #ENDIF(CMAKE_SYSTEM_NAME STREQUAL &quot;Linux&quot;)
  
  #Add the files in the source list
  aux_source_directory(. SRC_LIST)
  
  #Add portaudio library
  ADD_LIBRARY(portaudio STATIC IMPORTED)
  SET_PROPERTY(TARGET portaudio PROPERTY IMPORTED_LOCATION &quot;${portaudio_lib_dir}/libportaudio.a&quot;)
  add_executable(${PROJECT_NAME} ${SRC_LIST} ${portaudio_inc_dir})
  
  #What to compile before target!
  add_dependencies(${PROJECT_NAME}  project_portaudio)
  
  #What libraries to link to the target!
  TARGET_LINK_LIBRARIES(${PROJECT_NAME} portaudio)
  </code></pre>
  <p>which code wise should not be possible as the files needed exist.. and in the CMakeList added... So I don't see the problem.</p>
  <p><strong>Update</strong></p>
  <p>Changed some things,  the new error I am getting is:</p>
  <pre><code>lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_linux_alsa.o): In function `PaAlsaStream_WaitForFrames':
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:3792: undefined reference to `pthread_testcancel'
  lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_linux_alsa.o): In function `CallbackThreadFunc':
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:4197: undefined reference to `__pthread_register_cancel'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:4202: undefined reference to `pthread_testcancel'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:4240: undefined reference to `pthread_testcancel'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:4365: undefined reference to `__pthread_unregister_cancel'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:4365: undefined reference to `__pthread_unregister_cancel'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:4365: undefined reference to `__pthread_unregister_cancel'
  lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_linux_alsa.o): In function `PaAlsa_LoadLibrary':
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:380: undefined reference to `snd_pcm_open'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:381: undefined reference to `snd_pcm_close'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:382: undefined reference to `snd_pcm_nonblock'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:383: undefined reference to `snd_pcm_frames_to_bytes'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:384: undefined reference to `snd_pcm_prepare'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:385: undefined reference to `snd_pcm_start'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:386: undefined reference to `snd_pcm_resume'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:387: undefined reference to `snd_pcm_wait'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:388: undefined reference to `snd_pcm_state'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:389: undefined reference to `snd_pcm_avail_update'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:390: undefined reference to `snd_pcm_areas_silence'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:391: undefined reference to `snd_pcm_mmap_begin'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:392: undefined reference to `snd_pcm_mmap_commit'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:393: undefined reference to `snd_pcm_readi'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:394: undefined reference to `snd_pcm_readn'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:395: undefined reference to `snd_pcm_writei'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:396: undefined reference to `snd_pcm_writen'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:397: undefined reference to `snd_pcm_drain'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:398: undefined reference to `snd_pcm_recover'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:399: undefined reference to `snd_pcm_drop'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:400: undefined reference to `snd_pcm_area_copy'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:401: undefined reference to `snd_pcm_poll_descriptors'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:402: undefined reference to `snd_pcm_poll_descriptors_count'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:403: undefined reference to `snd_pcm_poll_descriptors_revents'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:404: undefined reference to `snd_pcm_format_size'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:405: undefined reference to `snd_pcm_link'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:406: undefined reference to `snd_pcm_delay'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:408: undefined reference to `snd_pcm_hw_params_sizeof'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:409: undefined reference to `snd_pcm_hw_params_malloc'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:410: undefined reference to `snd_pcm_hw_params_free'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:411: undefined reference to `snd_pcm_hw_params_any'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:412: undefined reference to `snd_pcm_hw_params_set_access'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:413: undefined reference to `snd_pcm_hw_params_set_format'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:414: undefined reference to `snd_pcm_hw_params_set_channels'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:416: undefined reference to `snd_pcm_hw_params_set_rate_near'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:417: undefined reference to `snd_pcm_hw_params_set_rate'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:418: undefined reference to `snd_pcm_hw_params_set_rate_resample'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:420: undefined reference to `snd_pcm_hw_params_set_buffer_size'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:421: undefined reference to `snd_pcm_hw_params_set_buffer_size_near'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:422: undefined reference to `snd_pcm_hw_params_set_buffer_size_min'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:424: undefined reference to `snd_pcm_hw_params_set_period_size_near'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:425: undefined reference to `snd_pcm_hw_params_set_periods_integer'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:426: undefined reference to `snd_pcm_hw_params_set_periods_min'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:428: undefined reference to `snd_pcm_hw_params_get_buffer_size'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:433: undefined reference to `snd_pcm_hw_params_get_channels_min'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:434: undefined reference to `snd_pcm_hw_params_get_channels_max'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:436: undefined reference to `snd_pcm_hw_params_test_period_size'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:437: undefined reference to `snd_pcm_hw_params_test_format'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:438: undefined reference to `snd_pcm_hw_params_test_access'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:439: undefined reference to `snd_pcm_hw_params_dump'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:440: undefined reference to `snd_pcm_hw_params'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:442: undefined reference to `snd_pcm_hw_params_get_periods_min'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:443: undefined reference to `snd_pcm_hw_params_get_periods_max'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:444: undefined reference to `snd_pcm_hw_params_set_period_size'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:445: undefined reference to `snd_pcm_hw_params_get_period_size_min'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:446: undefined reference to `snd_pcm_hw_params_get_period_size_max'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:447: undefined reference to `snd_pcm_hw_params_get_buffer_size_max'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:448: undefined reference to `snd_pcm_hw_params_get_rate_min'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:449: undefined reference to `snd_pcm_hw_params_get_rate_max'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:450: undefined reference to `snd_pcm_hw_params_get_rate_numden'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:452: undefined reference to `snd_pcm_sw_params_sizeof'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:453: undefined reference to `snd_pcm_sw_params_malloc'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:454: undefined reference to `snd_pcm_sw_params_current'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:455: undefined reference to `snd_pcm_sw_params_set_avail_min'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:456: undefined reference to `snd_pcm_sw_params'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:457: undefined reference to `snd_pcm_sw_params_free'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:458: undefined reference to `snd_pcm_sw_params_set_start_threshold'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:459: undefined reference to `snd_pcm_sw_params_set_stop_threshold'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:460: undefined reference to `snd_pcm_sw_params_get_boundary'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:461: undefined reference to `snd_pcm_sw_params_set_silence_threshold'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:462: undefined reference to `snd_pcm_sw_params_set_silence_size'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:463: undefined reference to `snd_pcm_sw_params_set_xfer_align'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:464: undefined reference to `snd_pcm_sw_params_set_tstamp_mode'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:466: undefined reference to `snd_pcm_info'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:467: undefined reference to `snd_pcm_info_sizeof'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:468: undefined reference to `snd_pcm_info_malloc'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:469: undefined reference to `snd_pcm_info_free'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:470: undefined reference to `snd_pcm_info_set_device'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:471: undefined reference to `snd_pcm_info_set_subdevice'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:472: undefined reference to `snd_pcm_info_set_stream'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:473: undefined reference to `snd_pcm_info_get_name'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:474: undefined reference to `snd_pcm_info_get_card'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:476: undefined reference to `snd_ctl_pcm_next_device'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:477: undefined reference to `snd_ctl_pcm_info'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:478: undefined reference to `snd_ctl_open'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:479: undefined reference to `snd_ctl_close'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:480: undefined reference to `snd_ctl_card_info_malloc'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:481: undefined reference to `snd_ctl_card_info_free'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:482: undefined reference to `snd_ctl_card_info'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:483: undefined reference to `snd_ctl_card_info_sizeof'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:484: undefined reference to `snd_ctl_card_info_get_name'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:486: undefined reference to `snd_config'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:487: undefined reference to `snd_config_update'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:488: undefined reference to `snd_config_search'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:489: undefined reference to `snd_config_iterator_entry'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:490: undefined reference to `snd_config_iterator_first'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:491: undefined reference to `snd_config_iterator_end'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:492: undefined reference to `snd_config_iterator_next'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:493: undefined reference to `snd_config_get_string'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:494: undefined reference to `snd_config_get_id'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:495: undefined reference to `snd_config_update_free_global'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:497: undefined reference to `snd_pcm_status'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:498: undefined reference to `snd_pcm_status_sizeof'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:499: undefined reference to `snd_pcm_status_get_tstamp'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:500: undefined reference to `snd_pcm_status_get_state'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:501: undefined reference to `snd_pcm_status_get_trigger_tstamp'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:502: undefined reference to `snd_pcm_status_get_delay'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:504: undefined reference to `snd_card_next'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:505: undefined reference to `snd_asoundlib_version'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:506: undefined reference to `snd_strerror'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:507: undefined reference to `snd_output_stdio_attach'
  lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_oss.o): In function `PaOSS_AudioThreadProc':
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:1620: undefined reference to `__pthread_register_cancel'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:1641: undefined reference to `pthread_testcancel'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:1676: undefined reference to `pthread_testcancel'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:1759: undefined reference to `sem_post'
  lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_oss.o): In function `PaOssStream_WaitForFrames':
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:1336: undefined reference to `pthread_testcancel'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:1370: undefined reference to `pthread_testcancel'
  lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_oss.o): In function `PaOSS_AudioThreadProc':
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:1770: undefined reference to `__pthread_unregister_cancel'
  lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_oss.o): In function `StartStream':
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:1813: undefined reference to `sem_wait'
  lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_oss.o): In function `PaOssStream_Terminate':
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:920: undefined reference to `sem_destroy'
  lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_oss.o): In function `PaOssStream_Initialize':
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:902: undefined reference to `sem_init'
  lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_util.o): In function `PaUtil_StartThreading':
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/os/unix/pa_unix_util.c:184: undefined reference to `pthread_create'
  lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_util.o): In function `PaUtil_CancelThreading':
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/os/unix/pa_unix_util.c:205: undefined reference to `pthread_join'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/os/unix/pa_unix_util.c:203: undefined reference to `pthread_cancel'
  lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_util.o): In function `PaUnixThread_Terminate':
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/os/unix/pa_unix_util.c:441: undefined reference to `pthread_join'
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/os/unix/pa_unix_util.c:437: undefined reference to `pthread_cancel'
  lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_util.o): In function `PaUnixThread_New':
  /home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/os/unix/pa_unix_util.c:305: undefined reference to `pthread_create'
  collect2: error: ld returned 1 exit status
  make[2]: *** [audio] Error 1
  make[1]: *** [CMakeFiles/audio.dir/all] Error 2
  make: *** [all] Error 2
  </code></pre>