httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <oh...@cox.net>
Subject Re: How to compiling/link/use Apache module that uses shared library?
Date Thu, 21 Jun 2012 18:19:50 GMT

---- Sorin Manolache <sorinm@gmail.com> wrote: 
> On 2012-06-21 19:47, ohaya@cox.net wrote:
> 
> > I've tried using "-l" pointing directly to the .so, libobaccess.so, but when I do
that, it says it can't find the .so:
> >
> > [root@apachemodule build-mod_headers]# ./compile-mod-headers.sh
> > /apps/httpd2222/build/libtool --silent --mode=compile gcc -prefer-pic   -DLINUX=2
-D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/apps/httpd2222/include  -I/apps/httpd2222/include
  -I/apps/httpd2222/include   -c -o mod_headers.lo mod_headers.c && touch mod_headers.slo
> > /apps/httpd2222/build/libtool --silent --mode=link gcc -o mod_headers.la  -l/apps/netpoint/AccessServerSDK/oblix/lib/libobaccess.so
-rpath /apps/httpd2222/modules -module -avoid-version    mod_headers.lo
> > /usr/bin/ld: cannot find -l/apps/netpoint/AccessServerSDK/oblix/lib/libobaccess.so
> > collect2: ld returned 1 exit status
> > apxs:Error: Command failed with rc=65536
> 
> Try -lobaccess
> 
> S


Sorin,

I was able to get Apache to start, kind of, using the apxs I posted, but adding LoadFile directives
to the Apache httpd.conf, to load libobaccess.so.

Now, when I run "apachectl -t", it says "OK", but when I try to actually start Apache, I get
a segfault (see below).  The thing is, I have a bunch of printfs in almost every function
in mod_headers.c, so I could see what functions are being called, and it looks like the segfault
is occurring even before it gets to any of the code parts that I've tweaked (vs. original
mod_headers.c):


[root@apachemodule build-mod_headers]# /apps/httpd2222/bin/apachectl -k start -X
mod_headers-jl V0.09 - start calling OAM API
In register_hooks
In create_headers_dir_config
In create_headers_dir_config
In header_cmd
In header_inout_cmd
In parse_format_tag
In parse_misc_string
In create_headers_dir_config
In header_cmd
In header_inout_cmd
In parse_format_tag
In parse_misc_string
In header_post_config

I tried running strace, and got (the ending of the strace):


In register_hooks
In create_headers_dir_config
In create_headers_dir_config
In header_cmd
In header_inout_cmd
In parse_format_tag
In parse_misc_string
In create_headers_dir_config
In header_cmd
In header_inout_cmd
In parse_format_tag
In parse_misc_string
In header_post_config
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGINT, {0x432cc0, [], SA_RESTORER, 0x351432e300}, {SIG_DFL}, 8) = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGSEGV}], 0, NULL) = 11711
fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 5), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2a983bf000
open("/usr/share/locale/locale.alias", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2528, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2a983c0000
read(3, "# Locale name alias data base.\n#"..., 4096) = 2528
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0x2a983c0000, 4096)              = 0
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file
or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file
or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file
or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file
or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "/apps/httpd2222/bin/apachectl: l"..., 83/apps/httpd2222/bin/apachectl: line 78:
11711 Segmentation fault      $HTTPD $ARGV
) = 83
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
wait4(-1, 0x7fbfffed64, WNOHANG, NULL)  = -1 ECHILD (No child processes)
rt_sigreturn(0xffffffffffffffff)        = 0
rt_sigaction(SIGINT, {SIG_DFL}, {0x432cc0, [], SA_RESTORER, 0x351432e300}, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
read(255, "\nexit $ERROR\n\n", 3420)    = 14
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
exit_group(139)                         = ?


I'll try to do the apxs with -lobccess and post back...

Jim

Mime
View raw message