-
-
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 |
If I leave away the ".lib" at the end of the files it works with mingw.
LIBS= -llibapr-1 -llibaprutil-1 -llibhttpd -lmsvcrt-ruby18
It does find the libraries but I get other errors because the linkage between the .o files and the .c files does not work.
These are the errors I get once it finds the libraries:
See all the imp_ errors. I guess this must be due to the linking of the .c to the .o files.
C:\Users\zdavatz\software\mod_ruby>make
gcc -shared -o mod_ruby.so apache_cookie.o apache_multipart_buffer.o apache_request.o apachelib.o array_header.o bucket.o connection.o cookie.o error.o mod_ruby
.o multival.o paramtable.o request.o ruby_config.o ruby_shared_stub.o server.o table.o upload.o uri.o -L"C:\Apache2.2\lib" -L"C:\Ruby-1.8.6-oniguruma\lib" -llib
apr-1 -llibaprutil-1 -llibhttpd -lmsvcrt-ruby18
apache_request.o:apache_request.c:(.text+0x1815): undefined reference to `_imp__apr_month_snames'
apache_request.o:apache_request.c:(.text+0x1831): undefined reference to `_imp__apr_day_snames'
apachelib.o:apachelib.c:(.text+0x33a): undefined reference to `_imp__ap_server_root'
bucket.o:bucket.c:(.text+0x111): undefined reference to `_imp__apr_bucket_type_flush'
bucket.o:bucket.c:(.text+0x156): undefined reference to `_imp__apr_bucket_type_eos'
bucket.o:bucket.c:(.text+0x19b): undefined reference to `_imp__apr_bucket_type_file'
bucket.o:bucket.c:(.text+0x1e0): undefined reference to `_imp__apr_bucket_type_pipe'
bucket.o:bucket.c:(.text+0x225): undefined reference to `_imp__apr_bucket_type_socket'
bucket.o:bucket.c:(.text+0x26a): undefined reference to `_imp__apr_bucket_type_heap'
bucket.o:bucket.c:(.text+0x2af): undefined reference to `_imp__apr_bucket_type_transient'
bucket.o:bucket.c:(.text+0x2f4): undefined reference to `_imp__apr_bucket_type_immortal'
bucket.o:bucket.c:(.text+0x339): undefined reference to `_imp__apr_bucket_type_mmap'
bucket.o:bucket.c:(.text+0x37e): undefined reference to `_imp__apr_bucket_type_pool'
mod_ruby.o:mod_ruby.c:(.text+0xcca): undefined reference to `_imp__ap_real_exit_code'
mod_ruby.o:mod_ruby.c:(.text+0xcf3): undefined reference to `_imp__ap_real_exit_code'
mod_ruby.o:mod_ruby.c:(.text+0xcfa): undefined reference to `_imp__ap_real_exit_code'
mod_ruby.o:mod_ruby.c:(.text+0xd03): undefined reference to `_imp__ap_real_exit_code'
request.o:request.c:(.text+0x30fc): undefined reference to `_imp__core_module'
request.o:request.c:(.text+0x3164): undefined reference to `_imp__core_module'
request.o:request.c:(.text+0x31b4): undefined reference to `_imp__core_module'
request.o:request.c:(.text+0x31ec): undefined reference to `_imp__core_module'
request.o:request.c:(.text+0x3254): undefined reference to `_imp__core_module'
request.o:request.c:(.text+0x32a4): more undefined references to `_imp__core_module' follow
ruby_config.o:ruby_config.c:(.text+0x9c8): undefined reference to `_imp__ap_real_exit_code'
ruby_config.o:ruby_config.c:(.text+0x9f1): undefined reference to `_imp__ap_real_exit_code'
ruby_config.o:ruby_config.c:(.text+0x9f8): undefined reference to `_imp__ap_real_exit_code'
ruby_config.o:ruby_config.c:(.text+0xa01): undefined reference to `_imp__ap_real_exit_code'
server.o:server.c:(.text+0x875): undefined reference to `_imp__core_module'
collect2: ld returned 1 exit status
make: *** [mod_ruby.so] Error 1
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
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.
Would you try to specify the library file directly.
LIBS= c:/Apache2.2/lib/libapr-1.lib c:/Apache2.2/lib/llibaprutil-1.lib c:/Apache2.2/lib/libhttpd.lib -lmsvcrt-ruby18