How to add secure download module

Hi,

I can’t compile Nginx with the secure download module. It keeps
complaining about a missing mhash.h file. How to I tell Nginx where to
find this mhash? Do I need to install mhash or just have the sources at
hand?

Thanks

hi

there are many ways to do this, in the end the gcc which is called by
make just has to find mhash’s header files and the shared library. if
you install the mhash and mhash-dev packages and your distribution
doesn’t set it up automatically so that gcc can find it, you can still
set CFLAGS to something like -I/path/to/headers and LDFLAGS to
-L/path/to/shared/library before you do the configure.

but in the most distribution i think you shouldn’t need to do this
after installing the mhash-dev or mhash-devel
package

mauro

I’m running OSX Leopard, and I’m trying to install all that through the
passenger installer.

Adding the -I/path and -L/path appear as invalid options for the
installer:

./configure: error: invalid option “-I/…/mhash-0.9.9.9/include”

Yeah I know one day I’ll correctly learn C.

Here is the error message even with the env vars set:

gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter
-Wunused-function -Wunused-variable -Wunused-value -Werror -g
-D_LARGEFILE_SOURCE -DBUILDING_NGINX -I src/core -I src/event -I
src/event/modules -I src/os/unix -I /path/pcre-8.10 -I objs -I src/http
-I src/http/modules -I src/mail -o
objs/addon/ngx_http_secure_download/ngx_http_secure_download_module.o
/path/ngx_http_secure_download/ngx_http_secure_download_module.c
/path/ngx_http_secure_download/ngx_http_secure_download_module.c:9:19:
error: mhash.h: No such file or directory

We can notice that the -I/usr/local/mhash-0.9.9.9/include hasn’t been
injected in the gcc command line, maybe the passenger install script
overrides them or doesn’t use them.

I have contacted the developer of the module and I’m waiting for his
reply.

these are not supposed to be parameters to the configure script. they
are parameters to gcc. so if you want that your make passes those to
gcc you need to set those two env variables before you execute the
configure like f.e.:

export CFLAGS="-I/usr/local/mhash-0.9.9.9/include"
export LDFLAGS="-L/usr/local/mhash-0.9.9.9/lib"

or you could also try to manually edit objs/Makefile after running
configure and add the two parameters like this:

3 CFLAGS = -I/usr/local/mhash-0.9.9.9/include
4 CPP = -I/usr/local/mhash-0.9.9.9/include
5 LINK = $(CC) -L/usr/local/mhash-0.9.9.9/lib

you just need to make sure that gcc has the -I parameter while
compilation and the -L parameter while linking

yes, seems that for some reason the configure which is run by
passenger doesn’t take your environment variables. i have never used
passenger before, but if there is some way for you to stop after the
configure and then later continue with the make you could maybe try to
hack the objs/Makefile inbetween.

mauro

By compiling Nginx manually (without support for passenger), I can go a
bit further, but I now hit a new problem:

error: mutils/mhash_config.h: No such file or directory

When I locate the missing file I see:

mhash-0.9.9.9/mhash-0.9.9/include/mutils/mhash_config.h

What is that? What’s that 0.9.9 folder doing here?

Does it mean I need to add an additional -I folder? How to do that with
my CLFAGS and LDFLAGS?

i guess the .in file is somwhere in the source of the library that you
downloaded, not in the directory where the headers got installed to,
right?

you first should know where the headers are installed to and then make
sure that gcc is getting a -I with this directory.

In my mhash folder I have mhash_config.h.in not mhash_config.h !?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs