Search code examples
c++cnginxcygwin

Nginx - nchan module in Cygwin


I am trying to compile Nginx with the nchan module in a Cygwin environment. I am able to compile Nginx and Nchan without problems (no compile-errors), and Nginx seems to work fine. The only problem is that the Nchan module requires the hiredis library. Without this it does not seem that nchan is able to store messages. Since I did not find a hiredis package in Cygwin I downloaded this one: https://github.com/echoma/hiredis.cygwin

Even if I compile and install that package the nchan module does not find the library when I configure Nginx before compiling it:

adding module in nchan
checking for hiredis ... not found
 + ngx_nchan_module was configured

The hiredis library seems to be installed since it is present in /usr/local/include

Without Hiredis it seems that nchan is worthless since no messages are stored.

Any tips or help would be highly appreciated!


Solution

  • If you check objs/autoconf.err you'll find something like this:

    checking for hiredis
    
    /usr/lib/gcc/i686-pc-cygwin/5.4.0/../../../../i686-pc-cygwin/bin/ld: cannot find -lhiredis
    collect2: error: ld returned 1 exit status
    

    This is because by default /usr/local/lib is not included in ld's library path. To fix this you can do:

    export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib/
    

    before running configure and make for Nginx.