Hello world module build trouble

Hello,

I am trying to build a simple nginx module to learn more about nginx’s
internals. I have copied several hello world examples into my own
module: http://pastebin.com/esHFtaMw

And the config file: http://pastebin.com/t1fpEPe6

I’ve downloaded nginx 1.7.8 onto a vanilla Ubuntu 14.04 install. I run
configure with the following:

[email protected]:/usr/local/src/nginx-1.7.8# ./configure --with-debug
–add-module=/usr/local/src/ngx_hello_dolly

I see that configure adds it in properly:

[… snip …]
adding module in /usr/local/src/ngx_hello_dolly

  • ngx_http_hello_dolly was configured
    [… snip …]

But when I run make I receive the following error:

objs/addon/ngx_hello_dolly/ngx_http_hello_dolly.o
objs/ngx_modules.o
-lpthread -lcrypt -lpcre -lcrypto -lcrypto -lz
objs/ngx_modules.o:(.data+0x110): undefined reference to
ngx_http_hello_dolly' collect2: error: ld returned 1 exit status make[1]: *** [objs/nginx] Error 1 make[1]: Leaving directory/usr/local/src/nginx-1.7.8’
make: *** [build] Error 2

Fule make output is at: http://pastebin.com/DD42e4N9

Can anyone point me in the direction of what I’m doing wrong? I don’t
understand why the build process errors out with undefined reference to
`ngx_http_hello_dolly’. Have I mistyped something in my module? I cannot
see any discrepancy between this and something such as
(http://blog.zhuzhaoyuan.com/2009/08/creating-a-hello-world-nginx-module/).
Much appreciated if anyone can point me in the right direction!

Hello.

Why don’t you apply a difference below?

— config.orig 2014-12-12 16:10:06.000000000 +0900
+++ config 2014-12-12 16:06:19.000000000 +0900
@@ -1,3 +1,3 @@
-ngx_addon_name=ngx_http_hello_dolly
-HTTP_MODULES="$HTTP_MODULES ngx_http_hello_dolly"
+ngx_addon_name=ngx_http_hello_dolly_module
+HTTP_MODULES="$HTTP_MODULES ngx_http_hello_dolly_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_hello_dolly.c"

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,255455,255456#msg-255456

Yep, I didn’t realize the _module suffix was required. It built
successfully, thank you!