title: make: 'srtp2/srtp.h' file not found
body: <h2>What I'm trying to do</h2>
  <p>I'm trying to compile a C project on macOS using make</p>
  <h2>The Problem</h2>
  <p>make is failing to find srtp, even though it's installed via brew</p>
  <pre><code> 'srtp2/srtp.h' file not found
  #include &lt;srtp2/srtp.h&gt;
           ^~~~~~~~~~~~~~
  1 error generated.
  </code></pre>
  <h2>What I tried</h2>
  <p>homebrew says it's installed</p>
  <pre><code>Warning: srtp 2.4.2_1 is already installed and up-to-date.
  To reinstall 2.4.2_1, run:
    brew reinstall srtp
  </code></pre>
  <p>... and linked</p>
  <pre><code>▶ brew link srtp
  Warning: Already linked: /usr/local/Cellar/srtp/2.4.2_1
  To relink, run:
    brew unlink srtp &amp;&amp; brew link srtp
  </code></pre>
  <p>pkg-config can find it</p>
  <pre><code>pkg-config --cflags --libs libsrtp2
  
  -I/usr/local/Cellar/srtp/2.4.2_1/include -L/usr/local/Cellar/srtp/2.4.2_1/lib -lsrtp2
  </code></pre>
  <p>pkg config path seems fine</p>
  <pre><code>▶ echo $PKG_CONFIG_PATH
  /usr/local/lib/pkgconfig
  </code></pre>
  <p>path seems to contain the <code>.pc</code> file for srtp</p>
  <pre><code>▶ locate /usr/local/lib/pkgconfig/libsrtp
  /usr/local/lib/pkgconfig/libsrtp2.pc
  </code></pre>
  <p>the .pc files content</p>
  <pre><code>▶ cat /usr/local/lib/pkgconfig/libsrtp2.pc
  prefix=/usr/local/Cellar/srtp/2.4.2_1
  exec_prefix=/usr/local/Cellar/srtp/2.4.2_1
  libdir=${exec_prefix}/lib
  includedir=${prefix}/include
  
  Name: libsrtp2
  Version: 2.4.2
  Description: Library for SRTP (Secure Realtime Transport Protocol)
  
  Libs: -L${libdir} -lsrtp2
  Libs.private: -L/usr/local/Cellar/openssl@1.1/1.1.1l_1/lib -lcrypto
  Cflags: -I${includedir}
  </code></pre>
  <p>and the path in the <code>${prefix}/include</code> is also legit</p>
  <pre><code>▶ head /usr/local/Cellar/srtp/2.4.2_1/include/srtp2/srtp.h
  /*
   * srtp.h
   *
   * interface to libsrtp
   *
   * David A. McGrew
   * Cisco Systems, Inc.
   */
  /*
   *
  </code></pre>
  <h2>Question</h2>
  <p>How do I debug this and why is make not finding srtp?</p>
  <h2>EDIT</h2>
  <p>I changed my PKG_CONFIG in ./zshrc from</p>
  <pre><code>#export PKG_CONFIG_PATH=&quot;/usr/local/opt/openssl@1.1/lib/pkgconfig&quot;
  </code></pre>
  <p>to</p>
  <pre><code>#export PKG_CONFIG_PATH=&quot;/usr/local/lib/pkgconfig&quot;
  </code></pre>
  <p>because apparently I'm supposed to point at ALL <code>*.pc</code> files, not just one. This broke more stuff.
  Apparently, not linking directly to the .pc files makes stuff worse.</p>
  <p><code>make -d</code> is now giving me</p>
  <pre><code>Package 'openssl' has no Name: field
  In file included from ./src/hash/ov_hash.c:34:
  include/ov_hash.h:37:10: fatal error: 'openssl/evp.h' file not found
  #include &lt;openssl/evp.h&gt;
           ^~~~~~~~~~~~~~~
  </code></pre>
  <p>So, for some reason pkg config is unable to use the <code>*.pc</code> files in <code>/usr/local/lib/pkgconfig</code>.
  No clue why.</p>
  <h2>EDIT 2</h2>
  <pre><code>export PKG_CONFIG_PATH=&quot;/usr/local/lib/pkgconfig&quot;
  
  # openssl pkg config hacky shit that works but 
  # does the same thing the .pc file does that doesnt work
  export PKG_CONFIG_PATH=&quot;/usr/local/opt/openssl@1.1/lib/pkgconfig:$PKG_CONFIG_PATH&quot;
  # srtp still no dice
  export PKG_CONFIG_PATH=&quot;/usr/local/opt/srtp/lib/pkgconfig:$PKG_CONFIG_PATH&quot;
  # this doesnt work either
  export PKG_CONFIG_PATH=&quot;/usr/local/Cellar/srtp/2.4.2_1/include:$PKG_CONFIG_PATH&quot;
  </code></pre>
  <p>So apparently, if I add the openssl include manually to the <code>PKG_CONFIG_PATH</code> in <code>~/.zshrc</code> it finds openssl.
  So the problem is pkg-config itself, since it seems to have issues resolving or finding the <code>*.pc</code> files.</p>
  <p>HOWEVER: When I do the same thing with srtp, it still does not work.</p>