PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Error Compiling mod_inomads.c  (Read 5475 times)

clayton.fast

  • Member
  • **
  • Posts: 6
    • View Profile
Error Compiling mod_inomads.c
« on: October 21, 2018, 02:26:34 PM »
We are in the process of moving our applications from a local server to an Azure Centos v7.  We are using inomads.  We have installed PxPlus 2018 and it is working for our character based application.  We are attempting to replicate what was running on the local server.  There are 2 PxPlus installations on the server (one standard version and 1 Wayfarer version).

Can someone help us figure out what is going wrong?  Thanks.

When we attempt to compile the inomads module for apache (mod_inomads.c) with this command: apxs -i -a -c mod_inomads.c, we get the following errors:

/usr/lib64/apr-1/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/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1   -c -o mod_inomads.lo mod_inomads.c && touch mod_inomads.slo
mod_inomads.c:137:62: error: unknown type name 'BOOL'
 static struct SESSION *Session_Find(struct INOMADS *pNomads, BOOL bCreate);
                                                              ^
mod_inomads.c: In function 'Load_Config':
mod_inomads.c:287:4: warning: implicit declaration of function 'stricmp' [-Wimplicit-function-declaration]
    if (stricmp(szLine, "DIRECTORY") == 0)
    ^
mod_inomads.c: In function 'Load_session':
mod_inomads.c:626:2: error: unknown type name 'BOOL'
  BOOL   bUsedCookie; /* Indicates if cookie was used to get session ID */
  ^
mod_inomads.c:677:3: warning: implicit declaration of function 'Session_Find' [-Wimplicit-function-declaration]
   if (Session_Find(pNomads, FALSE) == NULL)
   ^
mod_inomads.c:677:36: warning: comparison between pointer and integer [enabled by default]
   if (Session_Find(pNomads, FALSE) == NULL)
                                    ^
mod_inomads.c: In function 'Spawn_ViaTcp':
mod_inomads.c:954:11: warning: assignment makes pointer from integer without a cast [enabled by default]
  pSession = Session_Find(pNomads, TRUE);
           ^
mod_inomads.c: At top level:
mod_inomads.c:1627:63: error: unknown type name 'BOOL'
 static struct SESSION * Session_Find(struct INOMADS *pNomads, BOOL bCreate)
                                                               ^
mod_inomads.c: In function 'Session_Free':
mod_inomads.c:1705:3: warning: format '%x' expects argument of type 'unsigned int', but argument 9 has type 'struct SESSION *' [-Wformat=]
   ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, Request->server, "Releasing SESSION %s entry at %8.8x", pNomads->szSession, pSession);
   ^
mod_inomads.c: In function 'FileIO_GetDir':
mod_inomads.c:1928:2: warning: implicit declaration of function 'max' [-Wimplicit-function-declaration]
  apr_table_setn(Request->headers_out, "Content-Range", apr_psprintf(TmpPool, "bytes 0-%d/%d", max(0,nBytes-1), nBytes));
 ^
mod_inomads.c: In function 'FileIO_GetFile':
mod_inomads.c:1979:2: warning: format '%d' expects argument of type 'int', but argument 3 has type 'apr_off_t' [-Wformat=]
  apr_table_setn(Request->headers_out, "Content-Range", apr_psprintf(TmpPool, "bytes %d-%d/%d", nOffset, nOffset+max(0,nLength-1), nFileSize));
  ^
mod_inomads.c:1979:2: warning: format '%d' expects argument of type 'int', but argument 4 has type 'apr_off_t' [-Wformat=]
mod_inomads.c:1979:2: warning: format '%d' expects argument of type 'int', but argument 5 has type 'apr_size_t' [-Wformat=]
mod_inomads.c: In function 'FileIO_Put':
mod_inomads.c:2021:2: warning: implicit declaration of function 'min' [-Wimplicit-function-declaration]
  { nRead = (long)min(sizeof(bfrTemp), nBytes-nOfsIn);
  ^
apxs:Error: Command failed with rc=65536

Mike King

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Error Compiling mod_inomads.c
« Reply #1 on: October 22, 2018, 10:57:56 AM »
Clay, the error appears to be that BOOL is not defined.

Please insert the lines in blue below around line 29 in mod_inomads.c

#include <unistd.h>

#if defined(BOOL)
#else
#define BOOL int
#endif


int MyMemicmp(const void *s1, const void *s2, size_t n)


You should then be able to re-compile.

Note: Due to some newer changes in the GCC compilers on Linux you will receive some warning messages but they will not prevent the logic fro compiling/working.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Mike King

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Error Compiling mod_inomads.c
« Reply #2 on: October 22, 2018, 11:28:42 AM »
To avoid any confusion I have attached an updated mod_inomads.c to this posting
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

clayton.fast

  • Member
  • **
  • Posts: 6
    • View Profile
Re: Error Compiling mod_inomads.c
« Reply #3 on: October 22, 2018, 08:51:18 PM »
Thanks, Mike.  I spent all day fixing problems.  I'll try your updated inomads module tomorrow and let you know the results.

clayton.fast

  • Member
  • **
  • Posts: 6
    • View Profile
Re: Error Compiling mod_inomads.c
« Reply #4 on: October 23, 2018, 08:14:16 AM »
Hi Mike,

I sent your response to my Linux consultant.  It is still failing.  Here's his email to me.
______________________

I added the lines in manually because the file he sent diffs quite a bit different. It compiled but apache won’t start and throws an error

The error:

httpd[24376]: httpd: Syntax error on line 360 of /etc/httpd/conf/httpd.conf: Cannot load /usr/lib64/httpd/modules/mod_inomads.so into server: /usr/lib64/httpd/modules/mod_inomads.so: undefined symbol: stricmp

 

 

Compiler Output:

 

]# apxs -i -a -c mod_inomads.c

/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fe                                                                                                                                     xceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic  -DLINUX -D_REENTRANT -D_                                                                                                                                     GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1   -c -o mod_inomads.lo mod_inomads.c && to                                                                                                                                     uch mod_inomads.slo

mod_inomads.c: In function 'Load_Config':

mod_inomads.c:292:4: warning: implicit declaration of function 'stricmp' [-Wimplicit-function-declaration]

    if (stricmp(szLine, "DIRECTORY") == 0)

    ^

mod_inomads.c: In function 'Session_Find':

mod_inomads.c:1669:3: warning: format '%x' expects argument of type 'unsigned int', but argument 8 has type 'struct SESSIONS *'                                                                                                                                      [-Wformat=]

   ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, Request->server, "AlLocating SESSIONS table at %8.8x", pSessions);

   ^

mod_inomads.c:1681:3: warning: format '%x' expects argument of type 'unsigned int', but argument 9 has type 'struct SESSION *' [                                                                                                                                     -Wformat=]

   ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, Request->server, "Allocating SESSION %s entry at %8.8x", pNomads->szSessi                                                                                                                                     on, pSession);

   ^

mod_inomads.c:1689:2: warning: format '%x' expects argument of type 'unsigned int', but argument 9 has type 'struct SESSION *' [                                                                                                                                     -Wformat=]

  ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, Request->server, "Returning SESSION %s entry at %8.8x (socket=%8.8x)", pNo                                                                                                                                     mads->szSession, pSession, pSession->pSocket);

  ^

mod_inomads.c:1689:2: warning: format '%x' expects argument of type 'unsigned int', but argument 10 has type 'struct apr_socket_                                                                                                                                     t *' [-Wformat=]

mod_inomads.c: In function 'Session_Free':

mod_inomads.c:1710:3: warning: format '%x' expects argument of type 'unsigned int', but argument 9 has type 'struct SESSION *' [                                                                                                                                     -Wformat=]

   ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, Request->server, "Releasing SESSION %s entry at %8.8x", pNomads->szSessio                                                                                                                                     n, pSession);

   ^

mod_inomads.c: In function 'FileIO_GetDir':

mod_inomads.c:1933:2: warning: implicit declaration of function 'max' [-Wimplicit-function-declaration]

  apr_table_setn(Request->headers_out, "Content-Range", apr_psprintf(TmpPool, "bytes 0-%d/%d", max(0,nBytes-1), nBytes));

  ^

mod_inomads.c: In function 'FileIO_GetFile':

mod_inomads.c:1984:2: warning: format '%d' expects argument of type 'int', but argument 3 has type 'apr_off_t' [-Wformat=]

  apr_table_setn(Request->headers_out, "Content-Range", apr_psprintf(TmpPool, "bytes %d-%d/%d", nOffset, nOffset+max(0,nLength-1                                                                                                                                     ), nFileSize));

  ^

mod_inomads.c:1984:2: warning: format '%d' expects argument of type 'int', but argument 4 has type 'apr_off_t' [-Wformat=]

mod_inomads.c:1984:2: warning: format '%d' expects argument of type 'int', but argument 5 has type 'apr_size_t' [-Wformat=]

mod_inomads.c: In function 'FileIO_Put':

mod_inomads.c:2026:2: warning: implicit declaration of function 'min' [-Wimplicit-function-declaration]

  { nRead = (long)min(sizeof(bfrTemp), nBytes-nOfsIn);

  ^

/usr/lib64/apr-1/build/libtool --silent --mode=link gcc -std=gnu99 -Wl,-z,relro,-z,now   -o mod_inomads.la  -rpath /usr/lib64/ht                                                                                                                                     tpd/modules -module -avoid-version    mod_inomads.lo

/usr/lib64/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' mod_inomads.la /usr/lib64/httpd/modules

/usr/lib64/apr-1/build/libtool --mode=install install mod_inomads.la /usr/lib64/httpd/modules/

libtool: install: install .libs/mod_inomads.so /usr/lib64/httpd/modules/mod_inomads.so

libtool: install: install .libs/mod_inomads.lai /usr/lib64/httpd/modules/mod_inomads.la

libtool: install: install .libs/mod_inomads.a /usr/lib64/httpd/modules/mod_inomads.a

libtool: install: chmod 644 /usr/lib64/httpd/modules/mod_inomads.a

libtool: install: ranlib /usr/lib64/httpd/modules/mod_inomads.a

libtool: finish: PATH="/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/sbin" ldconfig -n /usr/lib64/httpd/modules

----------------------------------------------------------------------

Libraries have been installed in:

   /usr/lib64/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 /usr/lib64/httpd/modules/mod_inomads.so

[activating module `inomads' in /etc/httpd/conf/httpd.conf]

 

Mike King

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Error Compiling mod_inomads.c
« Reply #5 on: October 25, 2018, 11:30:04 AM »
I made some additional changes to the module and it now fully clean compiles on my Centos system (no warning)

I uploaded the new source to https://home.pvxplus.com/downloads/misc/mod_inomads.zip

Please give this one a try.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com