title: How to add Shared libraries to the nginx source code to compile?
body: <p>I'm developing several modules on Nginx(Centos7.6,Nginx1.16), all of which rely on a local cached key-value pair library. It's libshmcache <a href="https://github.com/happyfish100/libshmcache" rel="nofollow noreferrer">key-value pair</a>
  , so I want to build it into Nginx, but I'm compiling it to use with an error: <strong>undefined reference to <code>shmcache_init_from_file_ex</code></strong>.   </p>
  
  <p>This is the command I used at compile time:</p>
  
  <pre><code>   ./configure --prefix=/root/test/nginx --user=www --group=www 
     --with-openssl=/root/test/openssl-1.0.2s 
     --with-http_ssl_module 
     --with-threads 
     --with-debug 
     --add-module=/root/test/nginx-libshmcache-test-module 
     --with-ld-opt="-L /root/libfastcommon/src/libfastcommon -L /root/libfastcommon/libshmcache/src/libshmcache" 
     --with-cc-opt="-I/usr/local/include"
  </code></pre>
  
  <p>The code for <strong>nginx-libshmcache-test-module</strong> is very simple, and it has no problems,This is its core code.  </p>
  
  <pre><code>#include "fastcommon/logger.h"
  #include "fastcommon/shared_func.h"
  #include "shmcache/shmcache.h"
  
  static ngx_http_module_t  ngx_libshmcache_test_module = {
      NULL,                                 
      ngx_libshmcache_test_func, //Call ngx_libshmcache_test_func function when the configuration file is loaded       
      NULL,                               
      NULL,                                 
      NULL,                               
      NULL,                  
      NULL,    
      NULL    
  };
  static ngx_int_t ngx_libshmcache_test_func(ngx_conf_t *cf)
  {
      int result;
      struct shmcache_context context;
      result = shmcache_init_from_file_ex(&amp;context,
          "/root/test/lib-cache/libshmcache/conf/libshmcache.conf", false, true))
      return NGX_OK;
  }
  </code></pre>
  
  <p>When I compiled according to the above command, the start-up of Nginx caused an error due to loading the ngx_libshmcache_test_func method, <strong>undefined reference</strong>, so this must be the problem of my compilation. What should I do?<br>
  Thank you</p>