httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wilson Cheung <wche...@ucsd.edu>
Subject [users@httpd] apache-1.3.33: mod_log_forensic module use of assert() vs. ap_assert() introduces __eprintf() gcc-ism?
Date Sun, 14 Nov 2004 01:23:34 GMT
apache-1.3.33: mod_log_forensic module use of assert() vs. ap_assert() introduces __eprintf()
gcc-ism?


Since the production introduction of the mod_log_forensic.so module
starting in apache-1.3.31, I've run into the following problem whenever
starting the Apache "httpd" process after freshly compiling it for
Solaris 8 UNIX (/etc/init.d/httpd is symbolically linked to the "apachectl"
script):

# uname -a
SunOS euclid 5.8 Generic_117350-12 sun4u sparc SUNW,Ultra-2

# gcc -v
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/specs
gcc version 2.95.3 20010315 (release)

# /etc/init.d/httpd startssl
Syntax error on line 235 of /usr/local/apache/conf/httpd.conf:
Cannot load /usr/local/apache/libexec/mod_log_forensic.so into server: ld.so.1: /usr/local/apache/bin/httpd:
fatal: relocation error: file /usr/local/apache/libexec/mod_log_forensic.so: symbol __eprintf:
referenced symbol not found
/etc/init.d/httpd startssl: httpd could not be started


Normally, I would just comment out the two lines in httpd.conf:

LoadModule log_forensic_module libexec/mod_log_forensic.so
AddModule mod_log_forensic.c


and continue on but since the problem still appears to be present in
in the recently-released apache 1.3.33, I took a closer look.


A Google search reveals that the issue with the "__eprintf: referenced
symbol not found" seems to be a common problem with some other software
when using gcc to compile code that has a "#include <assert.h>" line
and later calls the "assert()" function.  

There are various further detailed discussions about the compiler either
including the wrong assert.h header file (/usr/include/assert.h vs.
/usr/local/include/sparc-sun-solaris2.8/include/assert.h) and/or calling
the assert() function in the wrong library (system libraries vs. GCC
libraries).

The most commonly-proposed solution to this problem seems to be to just
force linking against the "libgcc.a" GCC library so that the correct
assert() function is called that includes the __eprintf() function.


However, I notice that src/include/httpd.conf specifically defines an
"ap_assert()" macro that seems to be used in other parts of the apache
code for assert()-type purposes.

If I just replace all the assert() calls in 
src/modules/standard/mod_log_forensic.c with ap_assert(), the code still
compiles OK and I don't get the above errors on starting httpd.

Adding a "ForensicLog logs/forensic_log" entry in httpd.conf then results
in working forensic logging.


# diff mod_log_forensic.c.orig mod_log_forensic.c
31d30
< #include <assert.h>
116c115
<         assert(q < e);
---
>         ap_assert(q < e);
118c117
<             assert(q+2 < e);
---
>             ap_assert(q+2 < e);
126c125
<     assert(q < e);
---
>     ap_assert(q < e);
215c214
<     assert(h.pos < h.end);
---
>     ap_assert(h.pos < h.end);


What's not clear to me is whether there's a better way of fixing this?

Thanks!

-- 
Wilson Cheung      UCSD Mathematics Department Computing Support (MCS)
wcheung@ucsd.edu   9500 Gilman Drive, Dept 0112, La Jolla, CA  92093-0112
                   mathhelp@math.ucsd.edu | (858) 534-2762 | AP&M 5712


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message