You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2002/05/31 20:11:35 UTC

DO NOT REPLY [Bug 9548] New: - mod_jk.so will not compile under AIX 4.3.3

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9548>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9548

mod_jk.so will not compile under AIX 4.3.3

           Summary: mod_jk.so will not compile under AIX 4.3.3
           Product: Apache httpd-1.3
           Version: 1.3.23
          Platform: Other
        OS/Version: AIX
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Other mods
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: dfields326@netscape.net


mod_jk.so will not compile under AIX 4.3.3 without modifications

using mod_jk sources 
found in 
jakarta-tomcat-connectors-4.0.2-01-src.tar.gz
or tomcat 3.3a or tomcat 3.3.1 
sources will not compile without modifications

Using Apache 1.3.23  modfications that need 
to be made are the following
in the jk/native/common/jk_jni_worker.c
AIX xlC compiler 
requires explicit casts

putting these typedefs at the top of the file
/*
// 
  AIX 
REQUIRED EXPLLICT FUNCTION PTR CASTS
*/
typedef jint ( JNICALL 
*Tpfnjni_get_default_java_vm_init_args)(void *);
typedef jint ( JNICALL 
*Tpfnjni_create_java_vm)(JavaVM **, JNIEnv **, void *);
typedef jint ( JNICALL 
*Tpfnjni_get_created_java_vms)(JavaVM **, int, int *);


And using these function 
pointer types in function load_jvm_dll()
 Tpfnjni_get_default_java_vm_init_args
 
Tpfnjni_create_java_vm
 Tpfnjni_get_created_java_vms

eg) code snip
static int 
load_jvm_dll(jni_worker_t *p,
                        jk_logger_t *l)
{
#ifdef WIN32
    HINSTANCE hInst = 
LoadLibrary(p->jvm_dll_path);
    if(hInst) {
        (FARPROC)jni_create_java_vm =
            
GetProcAddress(hInst, "JNI_CreateJavaVM");

        (FARPROC)jni_get_created_java_vms =
            
GetProcAddress(hInst, "JNI_GetCreatedJavaVMs");

        
(FARPROC)jni_get_default_java_vm_init_args =
            GetProcAddress(hInst, 
"JNI_GetDefaultJavaVMInitArgs");

        jk_log(l, JK_LOG_DEBUG,
               "Loaded all JNI 
procs\n");

        if(jni_create_java_vm && jni_get_default_java_vm_init_args && 
jni_get_created_java_vms) {
            return JK_TRUE;
        }

        FreeLibrary(hInst);
    }
#elif 
defined(NETWARE)
    int javaNlmHandle = FindNLMHandle("JVM");
    if (0 == javaNlmHandle) {
        
/* if we didn't get a handle, try to load java and retry getting the */
        /* handle */
        
spawnlp(P_NOWAIT, "JVM.NLM", NULL);
        ThreadSwitchWithDelay();
        javaNlmHandle = 
FindNLMHandle("JVM");
        if (0 == javaNlmHandle)
            printf("Error loading Java.");

    }
    if 
(0 != javaNlmHandle) {
        jni_create_java_vm = ImportSymbol(GetNLMHandle(), 
"JNI_CreateJavaVM");
        jni_get_created_java_vms = ImportSymbol(GetNLMHandle(), 
"JNI_GetCreatedJavaVMs");
        jni_get_default_java_vm_init_args = 
ImportSymbol(GetNLMHandle(), "JNI_GetDefaultJavaVMInitArgs");
    }
    
if(jni_create_java_vm && jni_get_default_java_vm_init_args && 
jni_get_created_java_vms) {
        return JK_TRUE;
    }
#else
    void *handle;
    jk_log(l, 
JK_LOG_DEBUG,
           "Into load_jvm_dll, load %s\n", p->jvm_dll_path);

    handle = dlopen(p-
>jvm_dll_path, RTLD_NOW | RTLD_GLOBAL);

    if(!handle) {
        jk_log(l, JK_LOG_EMERG,
               
"Can't load native library %s : %s\n", p->jvm_dll_path,
               dlerror());
    } else {
         /* AIX 
REQUIRED EXPLLICT FUNCTION PTR CASTS */
        jni_create_java_vm = 
(Tpfnjni_create_java_vm)dlsym(handle, "JNI_CreateJavaVM");
        
jni_get_default_java_vm_init_args = 
(Tpfnjni_get_default_java_vm_init_args)dlsym(handle, 
"JNI_GetDefaultJavaVMInitArgs");
        jni_get_created_java_vms =  
(Tpfnjni_get_created_java_vms)dlsym(handle, "JNI_GetCreatedJavaVMs");

        
if(jni_create_java_vm && jni_get_default_java_vm_init_args &&
           
jni_get_created_java_vms) {
          jk_log(l, JK_LOG_DEBUG,
                   "In load_jvm_dll, symbols 
resolved, done\n");
            return JK_TRUE;
        }
       jk_log(l, JK_LOG_EMERG,
               "Can't resolve 
JNI_CreateJavaVM or JNI_GetDefaultJavaVMInitArgs\n");
        dlclose(handle);
    }
#endif
    
return JK_FALSE;
}



Also the apache13/bin/apxs script needed to be modified to link 
mod_jk.so
changing CFG_LDFLAGS_SHLIB

#modifed for AIX
my $CFG_LDFLAGS_SHLIB = q( -
bexpall -bM:SRE -bnoentry -bI:/services/apache/libexec/httpd.exp -lc -ldl); # substituted via 
Makefile.tmpl
#my $CFG_LDFLAGS_SHLIB = q(-H512 -T512 -bhalt:4 -bM:SRE -bnoentry -
bI:/services/apache/libexec/httpd.exp -lc); # substituted via Makefile.tmpl

after this 
change mod_jk.so seems to work for Apache 1.3 --> Tomcat 4.0.2

I am trying Apache 2.0.36 now and 
find that the only way I can get modules to load is to use the IBM xlc_r compiler and mod_jk.so in the 
jk/native/apache-2.0
does not link. 
Any body have a simular issues under AIX? 
Solutions?

build-unix.sh failes to link giving the following output 
:

/services/apache2/build/libtool --silent --mode=link xlc_r -o mod_jk.so -rpath 
/
services/apache2/modules -module -avoid-version -I../common -
I/services/apache2/
include/apr-util -I/usr/java130/include -
I/usr/java130/include/linux   mod_jk.lo
 jk_worker.lo jk_util.lo jk_uri_worker_map.lo 
jk_sockbuf.lo jk_pool.lo jk_nwmain
.lo jk_msg_buff.lo jk_md5.lo jk_map.lo 
jk_lb_worker.lo jk_jni_worker.lo jk_conte
xt.lo jk_connect.lo jk_ajp_common.lo 
jk_ajp14_worker.lo jk_ajp14.lo jk_ajp13_wor
ker.lo jk_ajp13.lo 
jk_ajp12_worker.lo
ld: 0711-317 ERROR: Undefined symbol: .main
ld: 0711-345 Use the -
bloadmap or -bnoquiet option to obtain more information.
apxs:Error: Command failed with 
rc=524288

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org