Bug 1180563 - httpd apxs cannot open config_vars.mk
Summary: httpd apxs cannot open config_vars.mk
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss Web Server 3
Classification: Retired
Component: httpd
Version: 3.0.0
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: DR01
: 3.0.0
Assignee: Weinan Li
QA Contact: Libor Fuka
URL:
Whiteboard:
Depends On:
Blocks: 1178630
TreeView+ depends on / blocked
 
Reported: 2015-01-09 13:06 UTC by Libor Fuka
Modified: 2020-03-27 18:34 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-27 18:34:13 UTC
Embargoed:


Attachments (Terms of Use)

Description Libor Fuka 2015-01-09 13:06:12 UTC
Description of problem:
sbin/apxs utility raises error:
     cannot open /usr/lib64/httpd/build/config_vars.mk: No such file or directory at /opt/ews/workspace/jws-3.0/httpd/sbin/apxs line 214.

Version-Release number of selected component (if applicable):
JWS3.0 DR0.2

Comment 1 Weinan Li 2015-01-11 02:49:19 UTC
Fix for el6:

[weli@dhcp-66-78-87 jws-compose]$ git diff HEAD^
diff --git a/jws-compose.spec b/jws-compose.spec
index d7bb179..c2c2c78 100644
--- a/jws-compose.spec
+++ b/jws-compose.spec
@@ -262,10 +262,24 @@ sed -i -e 's:my $installbuilddir = $libdir . "/%{httpd}/build";:my $installbuild
            -e 's:my $CFG_SYSCONFDIR = get_vars("sysconfdir");:my $CFG_SYSCONFDIR = "$ENV{EWS_HOME}/httpd/conf";:' \
            -e 's:my $includedir     = get_vars("includedir");:my $includedir     = "$ENV{EWS_HOME}/httpd/include";:' \
            -e 's:my $libexecdir     = get_vars("libexecdir");:my $libexecdir     = "$ENV{EWS_HOME}/httpd/modules";:' \
-           -e 's:my $apr_config = get_vars("APR_CONFIG");:my $apr_config = "$ENV{EWS_HOME}/httpd/bin/%{apr}-1-config";:' \
-           -e 's:my $apu_config = get_vars("APU_CONFIG");:my $apu_config = "$ENV{EWS_HOME}/httpd/bin/%{apu}-1-config";:' \
-           -e 's:my $sbindir        = get_vars("sbindir");:my $sbindir        = "$ENV{EWS_HOME}/httpd/sbin";:' httpd/sbin/apxs \
-           -e "s:my \$installbuilddir = \$libdir \. \"/httpd/build\":my \$installbuilddir = \"$ENV{EWS_HOME}/lib/build\":"
+           -e 's:$apr_config = .*:$apr_config = "$ENV{EWS_HOME}/httpd/bin/%{apr}-1-config";:' \
+           -e 's:$apu_config = .*:$apu_config = "$ENV{EWS_HOME}/httpd/bin/%{apu}-1-config";:' \
+           -e 's:my $sbindir        = get_vars("sbindir");:my $sbindir        = "$ENV{EWS_HOME}/httpd/sbin";:' \
+           -e 's:$installbuilddir = .*:$installbuilddir = "$ENV{EWS_HOME}/lib/build";:' \
+           httpd/sbin/apxs
+
+%if "%{?rhel}" == "6"
+# copy libtool
+cp %{_libdir}/apr%{jws3}-1/build/libtool httpd/lib/build
+# copy apr and apu headers
+cp %{_includedir}/apr%{jws3}-1/* httpd/include
+# modify apxs
+sed -i -e 's:my $installbuilddir = .*:my $installbuilddir = "$ENV{EWS_HOME}/httpd/lib/build";:' \
+    -e 's:$libtool = .*:$libtool = "$ENV{EWS_HOME}/httpd/lib/build/libtool";:' \
+    -e 's:$apr_includedir = .*:$apr_includedir = "";:' \
+    -e 's:$apu_includedir = .*:$apu_includedir = "";:' \
+    httpd/sbin/apxs
+%endif

 cp %{_bindir}/ab%{httpdSuffix} httpd/sbin/
 cp %{_bindir}/dbmmanage%{httpdSuffix} httpd/sbin/

Comment 2 Weinan Li 2015-01-13 14:22:43 UTC
Though we don't ship apr and apr-util in el7, we should symlink the base rhel libraries into same position like httpd-el6 to provide a uniform environment to customers(Like we did in JBoss EWS 2.1.0).

Here is the fix for el7 and minor fix on el6:

[weli@localhost jws-compose]$ git diff
diff --git a/jws-compose.spec b/jws-compose.spec
index acc125f..e5812a6 100644
--- a/jws-compose.spec
+++ b/jws-compose.spec
@@ -266,7 +266,10 @@ sed -i -e 's:my $installbuilddir = $libdir . "/%{httpd}/build";:my $installbuild
            -e 's:$apr_config = .*:$apr_config = "$ENV{EWS_HOME}/httpd/bin/%{apr}-1-config";:' \
            -e 's:$apu_config = .*:$apu_config = "$ENV{EWS_HOME}/httpd/bin/%{apu}-1-config";:' \
            -e 's:my $sbindir        = get_vars("sbindir");:my $sbindir        = "$ENV{EWS_HOME}/httpd/sbin";:' \
-           -e 's:$installbuilddir = .*:$installbuilddir = "$ENV{EWS_HOME}/lib/build";:' \
+           -e 's:$installbuilddir = .*:$installbuilddir = "$ENV{EWS_HOME}/httpd/lib/build";:' \
+           -e 's:$libtool = .*:$libtool = "$ENV{EWS_HOME}/httpd/lib/build/libtool";:' \
+           -e 's:$apr_includedir = .*:$apr_includedir = "";:' \
+           -e 's:$apu_includedir = .*:$apu_includedir = "";:' \
            httpd/sbin/apxs
 
 
@@ -275,12 +278,13 @@ sed -i -e 's:my $installbuilddir = $libdir . "/%{httpd}/build";:my $installbuild
 cp %{_libdir}/apr%{jws3}-1/build/libtool httpd/lib/build
 # copy apr and apu headers
 cp %{_includedir}/apr%{jws3}-1/* httpd/include
-# modify apxs
-sed -i -e 's:my $installbuilddir = .*:my $installbuilddir = "$ENV{EWS_HOME}/httpd/lib/build";:' \
-    -e 's:$libtool = .*:$libtool = "$ENV{EWS_HOME}/httpd/lib/build/libtool";:' \
-    -e 's:$apr_includedir = .*:$apr_includedir = "";:' \
-    -e 's:$apu_includedir = .*:$apu_includedir = "";:' \
-    httpd/sbin/apxs
+%else
+# symlink libtool
+ln -s %{_libdir}/apr-1/build/libtool httpd/lib/build
+# symlink apr and apu headers
+for f in $(ls %{_includedir}/apr-1/*); do
+    ln -s $f httpd/include/
+done
 %endif
 
 cp %{_bindir}/ab%{httpdSuffix} httpd/sbin/
@@ -386,7 +390,11 @@ cp %{_bindir}/%{apr}-1-config httpd/bin/
 cp %{_bindir}/%{apu}-1-config httpd/bin/
 %else
 ln -s %{_libdir}/lib%{apr}* httpd/lib/
-ln -s %{_libdir}/%{aprutil}-1/* httpd/lib/
+
+for f in $(ls %{_libdir}/%{aprutil}-1/*); do
+    ln -s $f httpd/lib/
+done
+
 ln -s %{_bindir}/%{apr}-1-config httpd/bin/
 ln -s %{_bindir}/%{apu}-1-config httpd/bin/
 %endif


The extracted httpd symlinks are:

finishing deferred symbolic links:
  jws-3.0/httpd/bin/apu-1-config -> /usr/bin/apu-1-config
  jws-3.0/httpd/bin/apr-1-config -> /usr/bin/apr-1-config
  jws-3.0/httpd/include/apr_reslist.h -> /usr/include/apr-1/apr_reslist.h
  jws-3.0/httpd/include/apr_ring.h -> /usr/include/apr-1/apr_ring.h
  jws-3.0/httpd/include/apr_dso.h -> /usr/include/apr-1/apr_dso.h
  jws-3.0/httpd/include/apu_errno.h -> /usr/include/apr-1/apu_errno.h
  jws-3.0/httpd/include/apr_uri.h -> /usr/include/apr-1/apr_uri.h
  jws-3.0/httpd/include/apr_allocator.h -> /usr/include/apr-1/apr_allocator.h
  jws-3.0/httpd/include/apr_sdbm.h -> /usr/include/apr-1/apr_sdbm.h
  jws-3.0/httpd/include/apr_md5.h -> /usr/include/apr-1/apr_md5.h
  jws-3.0/httpd/include/apr_ldap_init.h -> /usr/include/apr-1/apr_ldap_init.h
  jws-3.0/httpd/include/apr_base64.h -> /usr/include/apr-1/apr_base64.h
  jws-3.0/httpd/include/apr_uuid.h -> /usr/include/apr-1/apr_uuid.h
  jws-3.0/httpd/include/apr_pools.h -> /usr/include/apr-1/apr_pools.h
  jws-3.0/httpd/include/apr_rmm.h -> /usr/include/apr-1/apr_rmm.h
  jws-3.0/httpd/include/apr_optional.h -> /usr/include/apr-1/apr_optional.h
  jws-3.0/httpd/include/apr_file_io.h -> /usr/include/apr-1/apr_file_io.h
  jws-3.0/httpd/include/apr_thread_cond.h -> /usr/include/apr-1/apr_thread_cond.h
  jws-3.0/httpd/include/apr_getopt.h -> /usr/include/apr-1/apr_getopt.h
  jws-3.0/httpd/include/apr_poll.h -> /usr/include/apr-1/apr_poll.h
  jws-3.0/httpd/include/apr_ldap_url.h -> /usr/include/apr-1/apr_ldap_url.h
  jws-3.0/httpd/include/apr_signal.h -> /usr/include/apr-1/apr_signal.h
  jws-3.0/httpd/include/apr_user.h -> /usr/include/apr-1/apr_user.h
  jws-3.0/httpd/include/apr_sha1.h -> /usr/include/apr-1/apr_sha1.h
  jws-3.0/httpd/include/apr_strmatch.h -> /usr/include/apr-1/apr_strmatch.h
  jws-3.0/httpd/include/apr_md4.h -> /usr/include/apr-1/apr_md4.h
  jws-3.0/httpd/include/apr_lib.h -> /usr/include/apr-1/apr_lib.h
  jws-3.0/httpd/include/apr.h -> /usr/include/apr-1/apr.h
  jws-3.0/httpd/include/apr_fnmatch.h -> /usr/include/apr-1/apr_fnmatch.h
  jws-3.0/httpd/include/apr_version.h -> /usr/include/apr-1/apr_version.h
  jws-3.0/httpd/include/apr_hooks.h -> /usr/include/apr-1/apr_hooks.h
  jws-3.0/httpd/include/apr_atomic.h -> /usr/include/apr-1/apr_atomic.h
  jws-3.0/httpd/include/apr_optional_hooks.h -> /usr/include/apr-1/apr_optional_hooks.h
  jws-3.0/httpd/include/apr_portable.h -> /usr/include/apr-1/apr_portable.h
  jws-3.0/httpd/include/apr_xml.h -> /usr/include/apr-1/apr_xml.h
  jws-3.0/httpd/include/apr_env.h -> /usr/include/apr-1/apr_env.h
  jws-3.0/httpd/include/apr_support.h -> /usr/include/apr-1/apr_support.h
  jws-3.0/httpd/include/apr_want.h -> /usr/include/apr-1/apr_want.h
  jws-3.0/httpd/include/apr_mmap.h -> /usr/include/apr-1/apr_mmap.h
  jws-3.0/httpd/include/apr_thread_mutex.h -> /usr/include/apr-1/apr_thread_mutex.h
  jws-3.0/httpd/include/apr_ldap.h -> /usr/include/apr-1/apr_ldap.h
  jws-3.0/httpd/include/apr_xlate.h -> /usr/include/apr-1/apr_xlate.h
  jws-3.0/httpd/include/apr_thread_pool.h -> /usr/include/apr-1/apr_thread_pool.h
  jws-3.0/httpd/include/apr_thread_rwlock.h -> /usr/include/apr-1/apr_thread_rwlock.h
  jws-3.0/httpd/include/apr_ldap_rebind.h -> /usr/include/apr-1/apr_ldap_rebind.h
  jws-3.0/httpd/include/apr_ldap_option.h -> /usr/include/apr-1/apr_ldap_option.h
  jws-3.0/httpd/include/apr-x86_64.h -> /usr/include/apr-1/apr-x86_64.h
  jws-3.0/httpd/include/apr_queue.h -> /usr/include/apr-1/apr_queue.h
  jws-3.0/httpd/include/apr_dbd.h -> /usr/include/apr-1/apr_dbd.h
  jws-3.0/httpd/include/apr_dbm.h -> /usr/include/apr-1/apr_dbm.h
  jws-3.0/httpd/include/apr_hash.h -> /usr/include/apr-1/apr_hash.h
  jws-3.0/httpd/include/apr_errno.h -> /usr/include/apr-1/apr_errno.h
  jws-3.0/httpd/include/apu.h -> /usr/include/apr-1/apu.h
  jws-3.0/httpd/include/apu_version.h -> /usr/include/apr-1/apu_version.h
  jws-3.0/httpd/include/apr_thread_proc.h -> /usr/include/apr-1/apr_thread_proc.h
  jws-3.0/httpd/include/apr_general.h -> /usr/include/apr-1/apr_general.h
  jws-3.0/httpd/include/apr_memcache.h -> /usr/include/apr-1/apr_memcache.h
  jws-3.0/httpd/include/apr_random.h -> /usr/include/apr-1/apr_random.h
  jws-3.0/httpd/include/apr_tables.h -> /usr/include/apr-1/apr_tables.h
  jws-3.0/httpd/include/apr_anylock.h -> /usr/include/apr-1/apr_anylock.h
  jws-3.0/httpd/include/apr_proc_mutex.h -> /usr/include/apr-1/apr_proc_mutex.h
  jws-3.0/httpd/include/apr_shm.h -> /usr/include/apr-1/apr_shm.h
  jws-3.0/httpd/include/apr_time.h -> /usr/include/apr-1/apr_time.h
  jws-3.0/httpd/include/apu_want.h -> /usr/include/apr-1/apu_want.h
  jws-3.0/httpd/include/apr_network_io.h -> /usr/include/apr-1/apr_network_io.h
  jws-3.0/httpd/include/apr_crypto.h -> /usr/include/apr-1/apr_crypto.h
  jws-3.0/httpd/include/apr_date.h -> /usr/include/apr-1/apr_date.h
  jws-3.0/httpd/include/apr_buckets.h -> /usr/include/apr-1/apr_buckets.h
  jws-3.0/httpd/include/apr_global_mutex.h -> /usr/include/apr-1/apr_global_mutex.h
  jws-3.0/httpd/include/apr_file_info.h -> /usr/include/apr-1/apr_file_info.h
  jws-3.0/httpd/include/apr_inherit.h -> /usr/include/apr-1/apr_inherit.h
  jws-3.0/httpd/include/apr_strings.h -> /usr/include/apr-1/apr_strings.h
  jws-3.0/httpd/lib/libaprutil-1.la -> /usr/lib64/libaprutil-1.la
  jws-3.0/httpd/lib/libapr-1.so.0 -> /usr/lib64/libapr-1.so.0
  jws-3.0/httpd/lib/libaprutil-1.so.0.5.2 -> /usr/lib64/libaprutil-1.so.0.5.2
  jws-3.0/httpd/lib/libapr-1.la -> /usr/lib64/libapr-1.la
  jws-3.0/httpd/lib/libapr-1.so -> /usr/lib64/libapr-1.so
  jws-3.0/httpd/lib/libaprutil-1.so -> /usr/lib64/libaprutil-1.so
  jws-3.0/httpd/lib/build/libtool -> /usr/lib64/apr-1/build/libtool
  jws-3.0/httpd/lib/libapr-1.so.0.4.8 -> /usr/lib64/libapr-1.so.0.4.8
  jws-3.0/httpd/lib/libaprutil-1.so.0 -> /usr/lib64/libaprutil-1.so.0

Here is the verification of el7:

[weli@localhost work]$ pwd
/home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/work
[weli@localhost work]$ cat module_foo.c
#include <stdio.h>
#include "apr_hash.h"
#include "ap_config.h"
#include "ap_provider.h"
#include "httpd.h"
#include "http_core.h"
#include "http_config.h"
#include "http_log.h"
#include "http_protocol.h"
#include "http_request.h"


static int foo_handler(request_rec *r) {
  if (!r->handler || strcmp(r->handler, "foo-handler")) return (DECLINED);

  ap_set_content_type(r, "text/html");
  ap_rprintf(r, "Hello, martian!");

  return OK;
}

static void foo_hooks(apr_pool_t *pool) {
  ap_hook_handler(foo_handler, NULL, NULL, APR_HOOK_MIDDLE);
}

module AP_MODULE_DECLARE_DATA foo_module = {
  STANDARD20_MODULE_STUFF,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
    foo_hooks
};
[weli@localhost work]$ 

---

[weli@localhost work]$ EWS_HOME=/home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0 ../sbin/apxs -a -i -c module_foo.c 
/home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/lib/build/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic  -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/include    -c -o module_foo.lo module_foo.c && touch module_foo.slo
/home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/lib/build/libtool --silent --mode=link gcc -std=gnu99 -Wl,-z,relro,-z,now   -o module_foo.la  -rpath /home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/modules -module -avoid-version    module_foo.lo
/home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/lib/build/instdso.sh SH_LIBTOOL='/home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/lib/build/libtool' module_foo.la /home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/modules
/home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/lib/build/libtool --mode=install install module_foo.la /home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/modules/
libtool: install: install .libs/module_foo.so /home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/modules/module_foo.so
libtool: install: install .libs/module_foo.lai /home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/modules/module_foo.la
libtool: install: install .libs/module_foo.a /home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/modules/module_foo.a
libtool: install: chmod 644 /home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/modules/module_foo.a
libtool: install: ranlib /home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/modules/module_foo.a
libtool: finish: PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/weli/.rvm/bin:/home/weli/.rvm/bin:/home/weli/.local/bin:/home/weli/bin:/home/weli/.rvm/bin:/sbin" ldconfig -n /home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/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 755 /home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/modules/module_foo.so
[activating module `foo' in /home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd/conf/httpd.conf]
[weli@localhost work]$

Comment 3 Weinan Li 2015-01-13 14:31:37 UTC
verification in el6:

[weli@dhcp-66-78-87 httpd]$ grep 'ENV{EWS_HOME}' sbin/apxs
my $installbuilddir = "$ENV{EWS_HOME}/httpd/lib/build";
my $prefix        = "$ENV{EWS_HOME}/httpd";
my $localstatedir  = "$ENV{EWS_HOME}/httpd";
my $CFG_SYSCONFDIR = "$ENV{EWS_HOME}/httpd/conf";
my $includedir     = "$ENV{EWS_HOME}/httpd/include";
my $libexecdir     = "$ENV{EWS_HOME}/httpd/modules";
my $sbindir        = "$ENV{EWS_HOME}/httpd/sbin";
my $apr_config = "$ENV{EWS_HOME}/httpd/bin/apr-jws3-1-config";
my $apu_config = "$ENV{EWS_HOME}/httpd/bin/apu-jws3-1-config";
    $apu_config = "$ENV{EWS_HOME}/httpd/bin/apu-jws3-1-config";
my $libtool = "$ENV{EWS_HOME}/httpd/lib/build/libtool";
[weli@dhcp-66-78-87 httpd]$ pwd
/home/weli/rpmbuild/RPMS/x86_64/usr/share/java/jbossas-fordev/jws-3.0/httpd
[weli@dhcp-66-78-87 httpd]$ ls bin
apr-jws3-1-config  apu-jws3-1-config

Comment 4 Libor Fuka 2015-02-02 09:30:08 UTC
We still have a problem with apxs on RHEL6 (i386 and x86_64).
When i try:
lfuka@dhcp-4-207:/opt/EWS/3.0.0/jws-3.0/httpd/sbin$ ./apxs -q CC
Use of uninitialized value $ENV{"EWS_HOME"} in concatenation (.) or string at ./apxs line 38.
cannot open /httpd/lib/build/config_vars.mk: Adresář nebo soubor neexistuje at ./apxs line 214.
lfuka@dhcp-4-207:/opt/EWS/3.0.0/jws-3.0/httpd/sbin$

Comment 5 Libor Fuka 2015-02-02 09:32:15 UTC
Environmental variable EWS_HOME needs to be set.

Comment 6 Libor Fuka 2015-02-04 08:01:10 UTC
Verified with DR2 RHEL6 RHEL7 zips


Note You need to log in before you can comment on or make changes to this bug.