N
N
newaitix2014-01-17 21:12:16
Apache HTTP Server
newaitix, 2014-01-17 21:12:16

Why can't build apache module on ubuntu?

$sudo apt-get install apache2-prefork-dev
$cd /tmp
$sudo apxs -c mod_abcd.c
Result:

/usr/share/apr-1.0/build/libtool --silent --mode=compile --tag=disable-static i686-linux-gnu-gcc -std=gnu99 -prefer-pic -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wformat-security -D_FORTIFY_SOURCE=2 -fno-strict-aliasing  -D_FORTIFY_SOURCE=2   -DLINUX -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE  -pthread  -I/usr/include/apache2  -I/usr/include/apr-1.0   -I/usr/include/apr-1.0 -I/usr/include  -c -o mod_abcd.lo mod_abcd.c && touch mod_abcd.slo
/usr/share/apr-1.0/build/libtool --silent --mode=link --tag=disable-static i686-linux-gnu-gcc -std=gnu99 -Wl,--as-needed -Wl,-Bsymbolic-functions -Wl,-z,relro    -o mod_abcd.la  -rpath /usr/lib/apache2/modules -module -avoid-version    mod_abcd.lo

The file mod_mymod.so does not appear instead 3 files appear:
mod_abcd.la
mod_abcd.lo
mod_abcd.slo

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
unreturned, 2014-01-18
@newaitix

Did you look in the .libs/ directory?

[email protected]:/tmp/reailip2$ sudo apxs2 -c mod_realip2.c 
Use of uninitialized value $includedir in concatenation (.) or string at (eval 9) line 1.
/usr/share/apr-1.0/build/libtool --silent --mode=compile --tag=disable-static x86_64-linux-gnu-gcc -prefer-pic -DLINUX=2 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_REENTRANT -I/usr/include -I/usr/include/apr-1.0 -I/usr/include/openssl -I/usr/include/xmltok -pthread  -DLINUX=2 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_REENTRANT -I -I. -I/usr/include -I/usr/include/apr-1.0     -I/usr/include/apache2  -I/usr/include/apr-1.0   -I/usr/include/apr-1.0 -I/usr/include  -c -o mod_realip2.lo mod_realip2.c && touch mod_realip2.slo
/usr/share/apr-1.0/build/libtool --silent --mode=link --tag=disable-static x86_64-linux-gnu-gcc -Wl,--as-needed -Wl,-z,relro   -o mod_realip2.la  -rpath /usr/lib/apache2/modules -module -avoid-version    mod_realip2.lo
[email protected]:/tmp/reailip2$ ls -all
total 28
drwxr-xr-x 3 unreturned unreturned 4096 Jan 18 01:46 .
drwxrwxrwt 6 root       root       4096 Jan 18 01:46 ..
drwxr-xr-x 2 root       root       4096 Jan 18 01:46 .libs
-rw-r--r-- 1 unreturned unreturned 6243 Jan 18 01:46 mod_realip2.c
-rw-r--r-- 1 root       root        949 Jan 18 01:46 mod_realip2.la
-rw-r--r-- 1 root       root        291 Jan 18 01:46 mod_realip2.lo
-rw-r--r-- 1 root       root          0 Jan 18 01:46 mod_realip2.slo
[email protected]:/tmp/reailip2$ cd .libs/
[email protected]:/tmp/reailip2/.libs$ ls -all
total 36
drwxr-xr-x 2 root       root        4096 Jan 18 01:46 .
drwxr-xr-x 3 unreturned unreturned  4096 Jan 18 01:46 ..
lrwxrwxrwx 1 root       root          17 Jan 18 01:46 mod_realip2.la -> ../mod_realip2.la
-rw-r--r-- 1 root       root         950 Jan 18 01:46 mod_realip2.lai
-rw-r--r-- 1 root       root        6224 Jan 18 01:46 mod_realip2.o
-rwxr-xr-x 1 root       root       13556 Jan 18 01:46 mod_realip2.so
[email protected]:/tmp/reailip2/.libs$ cd ../

Also, you can immediately install the module by adding the -i flag
sudo apxs2 -c -i mod_realip2.c 
Use of uninitialized value $includedir in concatenation (.) or string at (eval 9) line 1.
/usr/share/apr-1.0/build/libtool --silent --mode=compile --tag=disable-static x86_64-linux-gnu-gcc -prefer-pic -DLINUX=2 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_REENTRANT -I/usr/include -I/usr/include/apr-1.0 -I/usr/include/openssl -I/usr/include/xmltok -pthread  -DLINUX=2 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_REENTRANT -I -I. -I/usr/include -I/usr/include/apr-1.0     -I/usr/include/apache2  -I/usr/include/apr-1.0   -I/usr/include/apr-1.0 -I/usr/include  -c -o mod_realip2.lo mod_realip2.c && touch mod_realip2.slo
/usr/share/apr-1.0/build/libtool --silent --mode=link --tag=disable-static x86_64-linux-gnu-gcc -Wl,--as-needed -Wl,-z,relro   -o mod_realip2.la  -rpath /usr/lib/apache2/modules -module -avoid-version    mod_realip2.lo
/usr/share/apache2/build/instdso.sh SH_LIBTOOL='/usr/share/apr-1.0/build/libtool' mod_realip2.la /usr/lib/apache2/modules
/usr/share/apr-1.0/build/libtool --mode=install cp mod_realip2.la /usr/lib/apache2/modules/
libtool: install: cp .libs/mod_realip2.so /usr/lib/apache2/modules/mod_realip2.so
libtool: install: cp .libs/mod_realip2.lai /usr/lib/apache2/modules/mod_realip2.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/lib/apache2/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib/apache2/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 644 /usr/lib/apache2/modules/mod_realip2.so

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question