Bug 44384 - mod_ssl on MacOS X 10.5.1 does not work because of incorrect configure script
Summary: mod_ssl on MacOS X 10.5.1 does not work because of incorrect configure script
Status: ASSIGNED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Build (show other bugs)
Version: 2.2.8
Hardware: Macintosh other
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
: 45514 45758 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-02-09 07:47 UTC by Giuliano Gavazzi
Modified: 2008-09-24 01:32 UTC (History)
3 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Giuliano Gavazzi 2008-02-09 07:47:55 UTC
2.2.8 on Leopard (Mac OS X 10.5.1) can be built and installed, but if mod_ssl is included, it fails at 
runtime.
The failure is owed to missing symbols (_ssl_cmd_SSLCACertificateFile for example).

I traced this to the option -export-symbols-regex ssl_module set by configure.

If this is changed to -export-symbols-regex ".*[Ss][Ss][Ll].*" all the required symbols are exported.
The problem does not manifest itself on 10.4.x with the same export-symbols-regex ssl_module.
Comment 1 Joe Orton 2008-02-11 03:22:04 UTC
How does it fail, and what version of libtool is being used?
Comment 2 Giuliano Gavazzi 2008-02-11 04:49:24 UTC
(In reply to comment #1)
> How does it fail, and what version of libtool is being used?

in reverse order:

I use the builtin libtool, as you can see in the compilation line for mod_ssl

/usr/local/src/apache.org/httpd-2.2.8/srclib/apr/libtool --silent --mode=link gcc   -arch x86_64    -arch x86_64    -o 
mod_ssl.la -rpath /usr/local/apache2/modules -module -avoid-version  mod_ssl.lo ssl_engine_config.lo ssl_engine_dh.lo 
ssl_engine_init.lo ssl_engine_io.lo ssl_engine_kernel.lo ssl_engine_log.lo ssl_engine_mutex.lo ssl_engine_pphrase.lo 
ssl_engine_rand.lo ssl_engine_vars.lo ssl_expr.lo ssl_expr_eval.lo ssl_expr_parse.lo ssl_expr_scan.lo ssl_scache.lo 
ssl_scache_dbm.lo ssl_scache_shmcb.lo ssl_scache_dc.lo ssl_util.lo ssl_util_ssl.lo  -lssl -lcrypto -export-symbols-regex ssl_module

and at installation time:

Making install in ssl
/usr/local/src/apache.org/httpd-2.2.8/srclib/apr/libtool --silent --mode=install cp mod_ssl.la /usr/local/apache2/modules/
ranlib: file: /usr/local/apache2/modules/mod_ssl.a(ssl_scache_dc.o) has no symbols

and this is the failure:

 /usr/local/apache2/bin/apachectl configtest
httpd: Syntax error on line 85 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/mod_ssl.so into 
server: dlopen(/usr/local/apache2/modules/mod_ssl.so, 10): Symbol not found: _ssl_cmd_SSLCACertificateFile\n  Referenced from: 
/usr/local/apache2/modules/mod_ssl.so\n  Expected in: flat namespace\n

This is apparently a common problem with Leopard, and some suggest dropping the -export-symbols-regex option altogether, 
while I simply solved it by making it export the symbols that are not found.

In other words I (think I) simply make the symbols globally accessible (although it is mod_ssl itself that cannot find them..) so, for 
the non functioning mod_ssl:

nm /usr/local/apache2/modules/mod_ssl.so |grep _ssl_cmd_SSLCACertificateFile
00000000000030b0 t _ssl_cmd_SSLCACertificateFile

while for the working one:

nm /usr/local/apache2/modules/mod_ssl.so |grep _ssl_cmd_SSLCACertificateFile
00000000000030b0 T _ssl_cmd_SSLCACertificateFile

Comment 3 Joe Orton 2008-02-11 05:01:21 UTC
It shouldn't be necessary; it sounds like a libtool bug, I've reported it upstream.
Comment 4 Ralf Wildenhues 2008-02-11 05:04:06 UTC
Please run the "libtool --silent --mode=link" command without --silent
and post all output, thanks.
Comment 5 Giuliano Gavazzi 2008-02-11 06:44:07 UTC
(In reply to comment #4)
> Please run the "libtool --silent --mode=link" command without --silent

$ /usr/local/src/apache.org/httpd-2.2.8/srclib/apr/libtool  --mode=link gcc   -arch x86_64    -arch x86_64    -o mod_ssl.la -rpath /usr/local/apache2/modules -
module -avoid-version  mod_ssl.lo ssl_engine_config.lo ssl_engine_dh.lo ssl_engine_init.lo ssl_engine_io.lo ssl_engine_kernel.lo ssl_engine_log.lo ssl_engine_mutex.lo 
ssl_engine_pphrase.lo ssl_engine_rand.lo ssl_engine_vars.lo ssl_expr.lo ssl_expr_eval.lo ssl_expr_parse.lo ssl_expr_scan.lo ssl_scache.lo ssl_scache_dbm.lo 
ssl_scache_shmcb.lo ssl_scache_dc.lo ssl_util.lo ssl_util_ssl.lo  -lssl -lcrypto -export-symbols-regex ssl_module
rm -fr  .libs/mod_ssl.a .libs/mod_ssl.exp .libs/mod_ssl.la .libs/mod_ssl.lai .libs/mod_ssl.so
generating symbol list for `mod_ssl.la'
/usr/bin/nm -p  .libs/mod_ssl.o .libs/ssl_engine_config.o .libs/ssl_engine_dh.o .libs/ssl_engine_init.o .libs/ssl_engine_io.o .libs/ssl_engine_kernel.o .libs/ssl_engine_log.o 
.libs/ssl_engine_mutex.o .libs/ssl_engine_pphrase.o .libs/ssl_engine_rand.o .libs/ssl_engine_vars.o .libs/ssl_expr.o .libs/ssl_expr_eval.o .libs/ssl_expr_parse.o 
.libs/ssl_expr_scan.o .libs/ssl_scache.o .libs/ssl_scache_dbm.o .libs/ssl_scache_shmcb.o .libs/ssl_scache_dc.o .libs/ssl_util.o .libs/ssl_util_ssl.o  | sed -n -e 's/^.*[ 	
]\([BCDEGRST][BCDEGRST]*\)[ 	][ 	]*_\([_A-Za-z][_A-Za-z0-9]*\)$/\1 _\2 \2/p' | /usr/bin/sed 's/.* //' | sort | uniq > .libs/mod_ssl.exp
/usr/bin/nm: no name list
/usr/bin/grep -E -e "ssl_module" ".libs/mod_ssl.exp" > ".libs/mod_ssl.expT"
mv -f ".libs/mod_ssl.expT" ".libs/mod_ssl.exp"
sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < .libs/mod_ssl.exp > .libs/mod_ssl-symbols.expsym
gcc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/mod_ssl.so -bundle  .libs/mod_ssl.o .libs/ssl_engine_config.o .libs/ssl_engine_dh.o 
.libs/ssl_engine_init.o .libs/ssl_engine_io.o .libs/ssl_engine_kernel.o .libs/ssl_engine_log.o .libs/ssl_engine_mutex.o .libs/ssl_engine_pphrase.o .libs/ssl_engine_rand.o 
.libs/ssl_engine_vars.o .libs/ssl_expr.o .libs/ssl_expr_eval.o .libs/ssl_expr_parse.o .libs/ssl_expr_scan.o .libs/ssl_scache.o .libs/ssl_scache_dbm.o 
.libs/ssl_scache_shmcb.o .libs/ssl_scache_dc.o .libs/ssl_util.o .libs/ssl_util_ssl.o  -lssl -lcrypto -arch x86_64 -arch x86_64
nmedit -s .libs/mod_ssl-symbols.expsym .libs/mod_ssl.so
ar cru .libs/mod_ssl.a  mod_ssl.o ssl_engine_config.o ssl_engine_dh.o ssl_engine_init.o ssl_engine_io.o ssl_engine_kernel.o ssl_engine_log.o ssl_engine_mutex.o 
ssl_engine_pphrase.o ssl_engine_rand.o ssl_engine_vars.o ssl_expr.o ssl_expr_eval.o ssl_expr_parse.o ssl_expr_scan.o ssl_scache.o ssl_scache_dbm.o ssl_scache_shmcb.o 
ssl_scache_dc.o ssl_util.o ssl_util_ssl.o
ranlib: file: .libs/mod_ssl.a(ssl_scache_dc.o) has no symbols
ranlib .libs/mod_ssl.a
ranlib: file: .libs/mod_ssl.a(ssl_scache_dc.o) has no symbols
creating mod_ssl.la
(cd .libs && rm -f mod_ssl.la && ln -s ../mod_ssl.la mod_ssl.la)



Comment 6 Giuliano Gavazzi 2008-02-11 09:39:48 UTC
In response to Peter O'Gorman who posted to the list and is going to report here with the suggestion to 
try libtool 1.5.26:

it appears to work:

/usr/local/bin/libtool --version
ltmain.sh (GNU libtool) 1.5.26 (1.1220.2.492 2008/01/30 06:40:56)

I only did the step for mod_ssl

$ cd modules/mod_ssl

$ /usr/local/bin/libtool  --mode=link gcc   -arch x86_64    -arch x86_64    -o mod_ssl.la -rpath 
/usr/local/apache2/modules -module -avoid-version  mod_ssl.lo ssl_engine_config.lo 
ssl_engine_dh.lo ssl_engine_init.lo ssl_engine_io.lo ssl_engine_kernel.lo ssl_engine_log.lo 
ssl_engine_mutex.lo ssl_engine_pphrase.lo ssl_engine_rand.lo ssl_engine_vars.lo ssl_expr.lo 
ssl_expr_eval.lo ssl_expr_parse.lo ssl_expr_scan.lo ssl_scache.lo ssl_scache_dbm.lo 
ssl_scache_shmcb.lo ssl_scache_dc.lo ssl_util.lo ssl_util_ssl.lo  -lssl -lcrypto -export-symbols-regex 
ssl_module
rm -fr  .libs/mod_ssl.a .libs/mod_ssl.exp .libs/mod_ssl.la .libs/mod_ssl.lai .libs/mod_ssl.so
generating symbol list for `mod_ssl.la'
/usr/bin/nm -p  .libs/mod_ssl.o .libs/ssl_engine_config.o .libs/ssl_engine_dh.o .libs/ssl_engine_init.o 
.libs/ssl_engine_io.o .libs/ssl_engine_kernel.o .libs/ssl_engine_log.o .libs/ssl_engine_mutex.o 
.libs/ssl_engine_pphrase.o .libs/ssl_engine_rand.o .libs/ssl_engine_vars.o .libs/ssl_expr.o 
.libs/ssl_expr_eval.o .libs/ssl_expr_parse.o .libs/ssl_expr_scan.o .libs/ssl_scache.o 
.libs/ssl_scache_dbm.o .libs/ssl_scache_shmcb.o .libs/ssl_scache_dc.o .libs/ssl_util.o .libs/ssl_util_ssl.o  
| sed -n -e 's/^.*[ 	]\([BCDEGRST][BCDEGRST]*\)[ 	][ 	]*_\([_A-Za-z][_A-Za-z0-9]*\)$/\1 _\2 
\2/p' | /usr/bin/sed 's/.* //' | sort | uniq > .libs/mod_ssl.exp
/usr/bin/nm: no name list
/usr/bin/grep -E -e "ssl_module" ".libs/mod_ssl.exp" > ".libs/mod_ssl.expT"
mv -f ".libs/mod_ssl.expT" ".libs/mod_ssl.exp"
sed -e 's,^,_,' < .libs/mod_ssl.exp > .libs/mod_ssl-symbols.expsym
gcc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/mod_ssl.so -bundle  .libs/mod_ssl.o 
.libs/ssl_engine_config.o .libs/ssl_engine_dh.o .libs/ssl_engine_init.o .libs/ssl_engine_io.o 
.libs/ssl_engine_kernel.o .libs/ssl_engine_log.o .libs/ssl_engine_mutex.o .libs/ssl_engine_pphrase.o 
.libs/ssl_engine_rand.o .libs/ssl_engine_vars.o .libs/ssl_expr.o .libs/ssl_expr_eval.o 
.libs/ssl_expr_parse.o .libs/ssl_expr_scan.o .libs/ssl_scache.o .libs/ssl_scache_dbm.o 
.libs/ssl_scache_shmcb.o .libs/ssl_scache_dc.o .libs/ssl_util.o .libs/ssl_util_ssl.o  -lssl -lcrypto  -arch 
x86_64 -arch x86_64 -Wl,-exported_symbols_list,.libs/mod_ssl-symbols.expsym
dsymutil .libs/mod_ssl.so || :
warning: no debug map in executable (-arch x86_64)
ar cru .libs/mod_ssl.a  mod_ssl.o ssl_engine_config.o ssl_engine_dh.o ssl_engine_init.o ssl_engine_io.o 
ssl_engine_kernel.o ssl_engine_log.o ssl_engine_mutex.o ssl_engine_pphrase.o ssl_engine_rand.o 
ssl_engine_vars.o ssl_expr.o ssl_expr_eval.o ssl_expr_parse.o ssl_expr_scan.o ssl_scache.o 
ssl_scache_dbm.o ssl_scache_shmcb.o ssl_scache_dc.o ssl_util.o ssl_util_ssl.o
ranlib: file: .libs/mod_ssl.a(ssl_scache_dc.o) has no symbols
ranlib .libs/mod_ssl.a
ranlib: file: .libs/mod_ssl.a(ssl_scache_dc.o) has no symbols
creating mod_ssl.la
(cd .libs && rm -f mod_ssl.la && ln -s ../mod_ssl.la mod_ssl.la)

$ cd ../..
$ sudo make install

$ /usr/local/apache2/bin/apachectl configtest
Syntax OK

and the symbols are not all exported:

$ nm /usr/local/apache2/modules/mod_ssl.so |grep _ssl_cmd_SSLCACertificateFile00000000000036f0 
t _ssl_cmd_SSLCACertificateFile
Comment 7 Peter O'Gorman 2008-02-11 10:53:39 UTC
(In reply to comment #6)
> In response to Peter O'Gorman who posted to the list and is going to report
here with the suggestion to 
> try libtool 1.5.26:

I was not sure that it would work - glad that it did.

This was my mail to the list:
I have had other reports of this, and changed libtool in 1.5.26 and HEAD
to use ld's  -exported_symbols_list flag if it is available, instead of
a separate invocation of nmedit. In one case this fixed the problem.

I have not had time to reproduce on my own system to gather enough
information to file a bug with Apple - a trivial test case I tried a
month or two ago worked fine with nmedit being used to limit the
exported symbols.

I will try to find the time to investigate, in the meantime, either
remove the exported symbol limiting on darwin (ugh.) or try with latest
libtool-1.5.26.
Comment 8 Giuliano Gavazzi 2008-02-12 14:03:44 UTC
Final test with:

make clean

[...] ./configure [...]

ln -sf srclib/apr/libtool /usr/local/bin/libtool
(libtool 1.5.26)

make
sudo make install

and it works. This was tested with CFLAGS="-arch x86_64" LDFLAGS="-arch x86_64"  to create  64bit 
binaries.

Comment 9 Joe Orton 2008-08-06 07:59:58 UTC
*** Bug 45514 has been marked as a duplicate of this bug. ***
Comment 10 Joe Orton 2008-09-24 01:32:06 UTC
*** Bug 45758 has been marked as a duplicate of this bug. ***