Skip to content

Instantly share code, notes, and snippets.

@mattn
Created January 31, 2011 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/804475 to your computer and use it in GitHub Desktop.
Save mattn/804475 to your computer and use it in GitHub Desktop.
APACHE_ROOT=C:\Program Files\Apache Software Foundation\Apache2.2
RUBY_ROOT=C:\Ruby
SRCS = \
apache_cookie.c \
apache_multipart_buffer.c \
apache_request.c \
apachelib.c \
array_header.c \
bucket.c \
connection.c \
cookie.c \
error.c \
mod_ruby.c \
multival.c \
paramtable.c \
request.c \
ruby_config.c \
ruby_shared_stub.c \
server.c \
table.c \
upload.c \
uri.c
OBJS = $(SRCS:.c=.o)
CFLAGS=-I"$(APACHE_ROOT)\include" -I"$(RUBY_ROOT)\lib\ruby\1.8\i386-mswin32" -DWIN32
LDFLAGS=-L"$(APACHE_ROOT)\lib" -L"$(RUBY_ROOT)\lib"
LIBS= -llibapr-1.lib -llibaprutil-1.lib -llibhttpd.lib -lmsvcrt-ruby18.lib
.SUFFIXES: .c .o
all : mod_ruby.so
.c.o:
gcc -c $(CFLAGS) -o $@ $<
mod_ruby.so : $(OBJS)
gcc -shared -o $@ $(OBJS) $(LDFLAGS) $(LIBS)
clean :
-@rm -f *.o *.so
@zdavatz
Copy link

zdavatz commented Feb 2, 2011

With these

LIBS= C:/Apache2.2/lib/libapr-1.lib C:/Apache2.2/lib/libaprutil-1.lib C:/Apache2.2/lib/libhttpd.lib -lmsvcrt-ruby18

I get the same error as above, that is a lot of "undefined reference to" errors. These must be connected to some linkage problem between the .o and the .c files.

i.e.: mod_ruby.o:mod_ruby.c:(.text+0xcf3): undefined reference to

@zdavatz
Copy link

zdavatz commented Feb 2, 2011

Your nmake links against the DLL of Apache, correct? The DLLs of Apache on Windows are all placed in the bin Directory of Apache so I guess MinGW has to link against those DLLs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment