# How to add secure download module

**URL:** <https://www.ruby-forum.com/t/how-to-add-secure-download-module/193835>\
**Category:** NGINX\
**Created:** [August 25, 2010, 10:51am UTC](https://www.ruby-forum.com/t/how-to-add-secure-download-module/193835 "2010-08-25T10:51:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [August 25, 2010, 10:51am UTC](https://www.ruby-forum.com/t/how-to-add-secure-download-module/193835/1 "2010-08-25T10:51:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [August 25, 2010, 11:04am UTC](https://www.ruby-forum.com/t/how-to-add-secure-download-module/193835/2 "2010-08-25T11:04:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [August 25, 2010, 11:14am UTC](https://www.ruby-forum.com/t/how-to-add-secure-download-module/193835/3 "2010-08-25T11:14:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [August 25, 2010, 11:47am UTC](https://www.ruby-forum.com/t/how-to-add-secure-download-module/193835/4 "2010-08-25T11:47:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [August 25, 2010, 11:26am UTC](https://www.ruby-forum.com/t/how-to-add-secure-download-module/193835/5 "2010-08-25T11:26:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [August 25, 2010, 11:53am UTC](https://www.ruby-forum.com/t/how-to-add-secure-download-module/193835/6 "2010-08-25T11:53:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [August 25, 2010, 6:21pm UTC](https://www.ruby-forum.com/t/how-to-add-secure-download-module/193835/7 "2010-08-25T18:21:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [August 26, 2010, 7:10am UTC](https://www.ruby-forum.com/t/how-to-add-secure-download-module/193835/8 "2010-08-26T07:10:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [August 25, 2010, 6:43pm UTC](https://www.ruby-forum.com/t/how-to-add-secure-download-module/193835/9 "2010-08-25T18:43:02Z")

</div>

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