Porting newLISP (AIX)

Started by csstup, April 24, 2007, 11:09:33 AM

Previous topic - Next topic

csstup

Last couple days I went through a round of porting newLISP to AIX.   Is anyone interested in the changes, perhaps folding them into the release?



I had a couple comments about the code base with regards to porting, incase the developers are interested:



1. The use of #ifdefs for platforms is a bit overused.   While I'm not a big supporter of autoconf'ing everything, its general model of #ifdef'ing the capability/requirement, rather than the platform seems to work better for portable projects.  #ifdef _READLINE is okay, but #ifdef SOLARIS #else #ifdef OS2... is hard to manage when adding a new platform.



2. The usage of "opsys" in newlisp.c is restrictive.   Since this ID is referenced all over the tests as stuff like (if opsys<5 || opsys==9), many many changes would have to be made to support a new opsys code for AIX.  What ID do the developers recommend for AIX?  This could be reworked in a couple different ways.



For the most part however, the code is portable ANSI C that, with a few minor changes, compiles under both gcc and the native IBM compilers under AIX4.3 .3.    The qa-net test fails currently, I've not added debug code to see why as of yet.   And I'll be building/testing under AIX5.X later this week.



I'd be happy to publish/discuss my changes if there is interest from the community.    Thanks!

newdep

#1
Hi csstup,



Yes the If then else is not my game either ;-) quite a puzzle when more

OSes join the club indeed...



The qa test you should first just leave as they are, if it compiles without big

errors qa tests can be done ;-)



But I think Mr. Guru himself will certainly give you a reply..



Norman.
-- (define? (Cornflakes))

Lutz

#2
Hi csstup



'opsys' is referenced in the C source a few times, mainly to feed into the newLISP 'sys-info' call in nl-filesys.c. Later in the code it gets incremented by the bits for UTF-8 and mode and id the versin is a library.



In newLISP .lsp source a built-in variable exists, called: ostype to code platform specific newLISP (mostly necessary for Win32).



I suggest you add:



#ifdef AIX

int opsys = 10;

char ostype[]="AIX";

#endif



in newlisp.c and create a makefile_aix with -DAIX used in it. Then create a



#ifdef AIX

...

#endif



section in newlisp.h and use #ifdef AIX and #ifndef AIX throughout the C source code.



The current system is not perfect but has served well through the years. I agree that #ifdef <capability> is much better then #ifdef <platform> through out the code, but for the makefiles it is better to have -DAIX, -DSOLAIRS, -DLINUX etc. The best probably would be to have #ifdef <platform> only be used in newlisp.h to bracket a group of #define <cabalities> for each platform.



In part this has already happened (i.e. for vasprintf(), nanosleep() etc). If a specific other capability comes to your mind which could lead to take out more of #ifdef <platforms> throughout the C code let me know.



You will see that most platform dependent issues are in nl-filesys.c.



If you send me a package compiling on AIX based on the latest development release, I can modify/integrate your changes for the next development release. Just "#ifdef AIX" you stuff into it and I see how I can streamline things further if you haven't done already. I will then send you a package back to make sure things work on both side.



Over the years platforms have come and gone, it would be nice to have AIX among the standard makefiles as it probably will still be around for some time, and have it detected too in the 'build' and 'configure' scripts. These script use the UNIX utility uname to detect the platform.



Last not least very welcome to newLISP and thanks for participating in porting efforts ;-)



Lutz

csstup

#3
Quote from: "Lutz"
'opsys' is referenced in the C source a few times, mainly to feed into the newLISP 'sys-info' call in nl-filesys.c. Later in the code it gets incremented by the bits for UTF-8 and mode and id the versin is a library.



In newLISP .lsp source a built-in variable exists, called: ostype to code platform specific newLISP (mostly necessary for Win32).



I suggest you add:



#ifdef AIX

int opsys = 10;

char ostype[]="AIX";

#endif

I thought 10 would be the logical choice, but a bunch of the tests all compare for the sys-info return value(ie, opsys), which makes them fail in wierd ways when set to 10.  Perhaps using something like <15 for all Unix, 16-31 for Windows, etc, to not interfer with the flag usage of the variable as well.



For now I'm reusing 4, since its semi close to Solaris, and the tests will all run.  The tests were *key* to verifying the various porting issues I came across.


Quotein newlisp.c and create a makefile_aix with -DAIX used in it. Then create a



#ifdef AIX

...

#endif



section in newlisp.h and use #ifdef AIX and #ifndef AIX throughout the C source code.

Yep, already made a makefile_aix, changed makefile, build, etc.   _AIX is defined by default when compiling under AIX (both GCC and native compilers) so I always use that.


QuoteThe current system is not perfect but has served well through the years. I agree that #ifdef <capability> is much better then #ifdef <platform> through out the code, but for the makefiles it is better to have -DAIX, -DSOLAIRS, -DLINUX etc. The best probably would be to have #ifdef <platform> only be used in newlisp.h to bracket a group of #define <cabalities> for each platform.

Right, thats how I usually do it.  One .h that list all the capabilities based on the -DSOLARIS define at compile time, which then all other source is based on those caps/requirements.   Thats how autoconf's config.h works.


QuoteIf you send me a package compiling on AIX based on the latest development release, I can modify/integrate your changes for the next development release. Just "#ifdef AIX" you stuff into it and I see how I can streamline things further if you haven't done already. I will then send you a package back to make sure things work on both side.

Will do.  I'll get the prelim stuff packaged up shortly.  Its built against 9.1.1, is that okay?


QuoteOver the years platforms have come and gone, it would be nice to have AIX among the standard makefiles as it probably will still be around for some time, and have it detected too in the 'build' and 'configure' scripts. These script use the UNIX utility uname to detect the platform.

Already changed build to detect uname and use makefile_aix as required.


QuoteLast not least very welcome to newLISP and thanks for participating in porting efforts ;-)

Looking forward to helping out where I can.   Thanks for the reply!



Just FYI, build from xlc (native compiler):
bash-2.04# gmake
./build

Discovered AIX
        make -f makefile_aix
        xlc -c -g -O2 newlisp.c
     689  1500-010: (W) WARNING in main: Infinite loop.  Program may not stop.
        xlc -c -g -O2 nl-symbol.c
        xlc -c -g -O2 nl-math.c
        xlc -c -g -O2 nl-list.c
        xlc -c -g -O2 nl-liststr.c
        xlc -c -g -O2 nl-string.c
        xlc -c -g -O2 nl-filesys.c
        xlc -c -g -O2 nl-sock.c
        xlc -c -g -O2 nl-import.c
        xlc -c -g -O2 nl-xml.c
        xlc -c -g -O2 nl-web.c
        xlc -c -g -O2 nl-matrix.c
        xlc -c -g -O2 nl-debug.c
        xlc -c -g -O2 pcre.c
        xlc newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o  nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o pcre.o -lm -ldl -o newlisp


And from gcc:
bash-2.04# gmake
./build

Discovered AIX
        make -f makefile_aix
        gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 newlisp.c
        gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-symbol.c
        gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-math.c
        gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-list.c
        gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-liststr.c
        gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-string.c
        gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-filesys.c
        gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-sock.c
        gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-import.c
        gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-xml.c
        gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-web.c
        gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-matrix.c
        gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-debug.c
        gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 pcre.c
        gcc newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o  nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o pcre.o -lm -ldl -o newlisp

Both compile clean with no warnings after the changes.

Lutz

#4
Thanks Csstup, the compiles look nice. Either send me the package to lutz at nuevatec dot com as attachment or let me know in a private message on this board where I can retrieve it.



Lutz

nitralime

#5
After modifying newlisp.c and ... as described in this thread I have tried it but got some errors?

Is there some sort of howto compile or installation guide for AIX?

newdep

#6
Can you dump the compile output here and the make file you used?

Gives a little more insight ;-)
-- (define? (Cornflakes))

nitralime

#7
makefile_aix_utf8

###########################################################################################

# makefile for newLISP v. 10.x.x on AIX woth UTF-8 support

#

#



OBJS = newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o

        nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o nl-utf8.o pcre.o





# use following for UTF-8 support and add nl-utf8.o to the OBJS line

CFLAGS = -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX



CC = gcc



default: $(OBJS)

        $(CC) $(OBJS) -lm -ldl -lrt -lnsl -o newlisp



.c.o:

        $(CC) $(CFLAGS) $<



$(OBJS): primes.h protos.h makefile_aix_utf8

###########################################################################################



I have added



#########################

#ifdef AIX

int opsys = 4;

char ostype[]="AIX";

#endif

#########################



to 'newlisp.c' and



########################

#ifdef AIX

#define OSTYPE "AIX"

#endif

########################



to 'newlisp.h' and



#######################

aix:

        gmake -f makefile_aix_utf8



#######################



to 'Makefile' and



######################

        AIX)

                echo  Discovered AIX:

                gmake aix

                exit

                ;;

######################



to 'build'.



I got the following link error message:



#############################################################################################

.............

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-import.c

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-xml.c

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-web.c

nl-web.c: In function 'getPutPostDeleteUrl':

nl-web.c:338: warning: implicit declaration of function 'alloca'

nl-web.c:338: warning: incompatible implicit declaration of built-in function 'alloca'

nl-web.c: In function 'handleHTTPcgi':

nl-web.c:1250: warning: incompatible implicit declaration of built-in function 'alloca'

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-matrix.c

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-debug.c

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-utf8.c

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX pcre.c

#gcc newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o nl-utf8.o pcre.o -lm -ldl -lrt -lsocket -lnsl -o newlisp

gcc newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o nl-utf8.o pcre.o -lm -ldl -lrt -lnsl -o newlisp

ld: 0711-317 ERROR: Undefined symbol: .vasprintf

ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

collect2: ld returned 8 exit status

gmake[2]: *** [default] Error 1

gmake[2]: Leaving directory `/tmp/newlisp-10.0.1'

gmake[1]: *** [aix] Error 2

gmake[1]: Leaving directory `/tmp/newlisp-10.0.1'

gmake: *** [default] Error 2

#############################################################################################



I have then tried it using AIX compiler xlc_r by changing 'makefile_aix_utf8' as follows:



#############################################################################################

# makefile for newLISP v. 10.x.x on AIX woth UTF-8 support

#

#



OBJS = newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o

        nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o nl-utf8.o pcre.o





# use following for UTF-8 support and add nl-utf8.o to the OBJS line

CFLAGS = -c -g -O2 -DSUPPORT_UTF8 -DAIX



CC = xlc_r



default: $(OBJS)

        $(CC) $(OBJS) -lm -ldl -lrt -lnsl -o newlisp



.c.o:

        $(CC) $(CFLAGS) $<



$(OBJS): primes.h protos.h makefile_aix_utf8

#############################################################################################



I get now



#############################################################################################

...............

xlc_r -c -g -O2 -DSUPPORT_UTF8 -DAIX nl-import.c

xlc_r -c -g -O2 -DSUPPORT_UTF8 -DAIX nl-xml.c

xlc_r -c -g -O2 -DSUPPORT_UTF8 -DAIX nl-web.c

"nl-web.c", line 338.10: 1506-068 (W) Operation between types "char*" and "int" is not allowed.

"nl-web.c", line 339.6: 1506-068 (W) Operation between types "char*" and "int" is not allowed.

"nl-web.c", line 340.7: 1506-068 (W) Operation between types "char*" and "int" is not allowed.

"nl-web.c", line 341.6: 1506-068 (W) Operation between types "char*" and "int" is not allowed.

"nl-web.c", line 1250.9: 1506-068 (W) Operation between types "char*" and "int" is not allowed.

xlc_r -c -g -O2 -DSUPPORT_UTF8 -DAIX nl-matrix.c

xlc_r -c -g -O2 -DSUPPORT_UTF8 -DAIX nl-debug.c

xlc_r -c -g -O2 -DSUPPORT_UTF8 -DAIX nl-utf8.c

xlc_r -c -g -O2 -DSUPPORT_UTF8 -DAIX pcre.c

#xlc_r newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o nl-utf8.o pcre.o -lm -ldl -lrt -lsocket -lnsl -o newlisp

xlc_r newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o nl-utf8.o pcre.o -lm -ldl -lrt -lnsl -o newlisp

ld: 0711-317 ERROR: Undefined symbol: .alloca

ld: 0711-317 ERROR: Undefined symbol: .vasprintf

ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

gmake[2]: *** [default] Error 8

gmake[2]: Leaving directory `/tmp/newlisp-10.0.1'

gmake[1]: *** [aix] Error 2

gmake[1]: Leaving directory `/tmp/newlisp-10.0.1'

gmake: *** [default] Error 2

#############################################################################################

Lutz

#8
Lets take it step by step:



(1) you should definitely stay with gcc not xlc_r



(2) in newlisp.h where you define AIX change to:



#ifdef AIX
#define OSTYPE "AIX"
#define SOLARIS         /* <-- this line added */
#endif


put this around line 39 after the #ifdef SOLARIS definition. This makes AIX a sub flavor of SOLARIS (System V, BSD derived)



(3) in newlisp.h after all the includes around line 115 before the #ifndef SOLARIS put:



#ifdef AIX
#define vasprintf my_vasprintf
#endif


After the compiling and linking well do a:



./newlisp qa-dot


inside the newlisp-10.0.1 directory. This is a basic test suite trying out most built-in functions. Most likely we will have problems with system level functions located in nl-filesys.c. If that goes well do a:



make test


in the same location. This runs a more comprehensive test suite.



ps: thanks to nodep for helping out here too.

Lutz

#9
... also please compile util/types.c and post the output:





> cd newlisp-10.0.1/util
 
> gcc types.c -o types

> ./types


It will probably give something like this:



type      bytes
---------------
char        1
char *      4
void *      4
short int   2
int         4
long        4
long int    4
long long   8
size_t      4
float       4
double      8
long double 16
wchar_t     4

format input              output
------------------------------------------------
%d     0xffffffff           -1
%u     0xffffffff           4294967295
%d     0x7fffffff           2147483647
%u     0x7fffffff           2147483647
%d     0x80000000           -2147483648
%u     0x80000000           2147483648
%d     0x7fffffffffffffffLL -1
%u     0x7fffffffffffffffLL 4294967295
%x     0xffffffffffffffffLL ffffffff
%X     0x7fffffffffffffffLL ffffffff
%X     0x8000000000000000LL 0
%llX   0xFFFFFFFFFFFFFFFFLL ffffffff
%llX   0x7FFFFFFFFFFFFFFFLL ffffffff
%llX   0x8000000000000000LL 0
%lld   0xffffffffffffffffLL -1
%llu   0xffffffffffffffffLL 18446744073709551615
%lld   0x7fffffffffffffffLL 9223372036854775807
%llu   0x7fffffffffffffffLL 9223372036854775807
%lld   0x8000000000000000LL -9223372036854775808
%llu   0x8000000000000000LL 9223372036854775808

CPU is little endian
The constant __LITTLE_ENDIAN__ is defined by the compiler


The only difference is probably, that your machine may be big endian.

nitralime

#10
Here is the relevant part pf my "newlisp.h" file:

####################################################################################

    +1  /* newlisp.h - header file for newLISP

    +2

    +3      Copyright (C) 2009 Lutz Mueller

    +4

    +5      This program is free software: you can redistribute it and/or modify

    +6      it under the terms of the GNU General Public License as published by

    +7      the Free Software Foundation, either version 3 of the License, or

    +8      (at your option) any later version.

    +9

   +10      This program is distributed in the hope that it will be useful,

   +11      but WITHOUT ANY WARRANTY; without even the implied warranty of

   +12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

   +13      GNU General Public License for more details.

   +14

   +15      You should have received a copy of the GNU General Public License

   +16      along with this program.  If not, see <http>.

   +17

   +18  */

   +19

   +20  #ifdef LINUX

   +21  #define OSTYPE "Linux"

   +22  #endif

   +23

   +24  #ifdef _BSD

   +25  #define OSTYPE "BSD"

   +26  #endif

   +27

   +28  #ifdef MAC_OSX

   +29  #define OSTYPE "OSX"

   +30  #endif

   +31

   +32  #ifdef SOLARIS

   +33  #ifdef TRU64

   +34  #define OSTYPE "Tru64Unix"

   +35  #else

   +36  #define OSTYPE "Solaris"

   +37  #endif

   +38  #endif

   +39

   +40  #ifdef AIX

   +41  #define OSTYPE "AIX"

   +42  #define SOLARIS

   +43  #endif

   +44

   +45  #ifdef WIN_32

   +46  #define OSTYPE "Win32"

   +47  #endif

   +48

   +49  #ifdef OS2

   +50  #define OSTYPE "OS/2"

   +51  #endif



   ..........



  +107  #include <unistd>

  +108  #include <sys>

  +109  #include <math>

  +110  #include <float>

  +111  #include <string>

  +112  #include <ctype>

  +113  #include <fcntl>

  +114  #include <stdarg>

  +115  #include <time>

  +116  #include <sys>

  +117  #include <sys>

  +118  #include <sys>

  +119

  +120  #ifdef AIX

  +121  #define vasprintf my_vasprintf

  +122  #endif

  +123

  +124  #ifndef SOLARIS

  +125  #ifndef _BSD

  +126  #ifndef MAC_OSX

  +127  #include <malloc>

  +128  #endif

  +129  #endif

  +130  #else

  +131  #include <alloca>

  +132  #endif

  +133

#######################################################################################



I get now the error message:



#gmake

./build



Discovered AIX:

gmake[1]: Entering directory `/tmp/newlisp-10.0.1'

gmake -f makefile_aix_utf8

gmake[2]: Entering directory `/tmp/newlisp-10.0.1'

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX newlisp.c

newlisp.c:78: error: redefinition of 'opsys'

newlisp.c:73: error: previous definition of 'opsys' was here

gmake[2]: *** [newlisp.o] Error 1

gmake[2]: Leaving directory `/tmp/newlisp-10.0.1'

gmake[1]: *** [aix] Error 2

gmake[1]: Leaving directory `/tmp/newlisp-10.0.1'

gmake: *** [default] Error 2

Lutz

#11
probably opsys is defined twice in newlisp.c. As of now AIX is a sub-flavor of SOLARIS, similar to TRU64. Change newlisp.c around line 68





#ifdef SOLARIS

int opsys 4

#endif



#ifdef TRU64

int opsys += 5;

#endif



#ifdef AIX

int opsys += 6;

#endif



As both, TRU64 and AIX are sub-flavors of SOLARIS, they will end up with numbers 9 and 10. Then test using the qa-files from 10.0.2, released later today, which elminate all references to opsys numbers from 'sys-info'. It would also help if you can give the output of types.c (see my last post).

nitralime

#12
After modifying "newlisp.c" as follows


################################
#ifdef SOLARIS
  #ifdef TRU64
    int opsys = 9;
  #endif
  #ifdef AIX
    int opsys = 10;
  #else
    int opsys = 4;
  #endif
#endif
#################################


I have managed to compile newlisp:-)

Here is the output of gmake:


#########################################################################################
$ gmake
./build

Discovered AIX:
gmake[1]: Entering directory `/tmp/newlisp-10.0.1'
gmake -f makefile_aix_utf8
gmake[2]: Entering directory `/tmp/newlisp-10.0.1'
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX newlisp.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-symbol.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-math.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-list.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-liststr.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-string.c
nl-string.c: In function 'p_search':
nl-string.c:135: warning: dereferencing type-punned pointer will break strict-aliasing rules
nl-string.c: In function 'p_pack':
nl-string.c:1619: warning: dereferencing type-punned pointer will break strict-aliasing rules
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-filesys.c
nl-filesys.c:28:1: warning: "FIONREAD" redefined
In file included from /usr/include/sys/stropts.h:33,
                 from /usr/include/stropts.h:30,
                 from nl-filesys.c:26:
/usr/include/sys/ioctl.h:356:1: warning: this is the location of the previous definition
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-sock.c
nl-sock.c:64:1: warning: "FIONREAD" redefined
In file included from nl-sock.c:47:
/usr/include/sys/ioctl.h:356:1: warning: this is the location of the previous definition
nl-sock.c: In function 'ping':
nl-sock.c:2053: warning: passing argument 6 of 'nrecvfrom' from incompatible pointer type
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-import.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-xml.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-web.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-matrix.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-debug.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX nl-utf8.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUPPORT_UTF8 -DAIX pcre.c
#gcc newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o nl-utf8.o pcre.o -lm -ldl -lrt -lsocket -lnsl -o newlisp
gcc newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o nl-utf8.o pcre.o -lm  -ldl -lrt -lnsl -o newlisp
gmake[2]: Leaving directory `/tmp/newlisp-10.0.1'
gmake[1]: Leaving directory `/tmp/newlisp-10.0.1'
#########################################################################################


And here is the output of "types":


#######################################################
$ cd util
$ gcc types.c -o types
$./types

type      bytes
---------------
char        1
char *      4
void *      4
short int   2
int         4
long        4
long int    4
long long   8
size_t      4
float       4
double      8
long double 8
wchar_t     2

format input              output
------------------------------------------------
%d     0xffffffff           -1
%u     0xffffffff           4294967295
%d     0x7fffffff           2147483647
%u     0x7fffffff           2147483647
%d     0x80000000           -2147483648
%u     0x80000000           2147483648
%d     0x7fffffffffffffffLL 2147483647
%u     0x7fffffffffffffffLL 2147483647
%x     0xffffffffffffffffLL ffffffff
%X     0x7fffffffffffffffLL 7fffffff
%X     0x8000000000000000LL 80000000
%llX   0xFFFFFFFFFFFFFFFFLL ffffffff
%llX   0x7FFFFFFFFFFFFFFFLL 7fffffff
%llX   0x8000000000000000LL 80000000
%lld   0xffffffffffffffffLL -1
%llu   0xffffffffffffffffLL 18446744073709551615
%lld   0x7fffffffffffffffLL 9223372036854775807
%llu   0x7fffffffffffffffLL 9223372036854775807
%lld   0x8000000000000000LL -9223372036854775808
%llu   0x8000000000000000LL 9223372036854775808

CPU is big endian
The constant __BIG_ENDIAN__ is defined by the compiler
#######################################################


What should the following command do on AIX?


#######################################################
./newlisp qa-dot

Testing built-in functions ...
---------- testing UDP Win32 and OS/2 -------------
waiting ...
sending ...
receiving ...
msg:("HELLO" "127.0.0.1" 42935)
deleting semaphore:true
------------------------------------------
  -> share
#######################################################


It is hanging here!!

Lutz

#13
The types output looks fine, as we don't care about the 'long double' type.



(1) add -fno-strict-aliasing to the make file as done in makefile_solaris



(2) in nl-filesys.c change:



#ifdef SOLARIS
#include <stropts>
#ifndef TRU64
#define FIONREAD I_NREAD
#endif
#endif


to



#ifdef SOLARIS
#include <stropts>
#if !defined  (TRU64) || (AIX)
#define FIONREAD I_NREAD
#endif
#endif


For the other warnings I would have to see the header files on your machine in /usr/include/. Some of the functions may have different call-type patterns. If we are lucky it can just be re-mended with a type-cast. The fact that these are only warnings means that we are probably Ok.



In qa-dot replace the definition of test-share with:



(define (test-share) true)


And you make have to do the same with (test-semaphore). One or both of newLISP 'share' and 'semaphore' functions do not work.



This effectively skips the test. We would have to consult the manpages for mmap() and munmap() to find out how memory sharing is done on your system and the same is true for the semaphore() call.

Lutz

#14
I just see on the snippet, where its hanging on 'share' qa-dot seems to think its in Win32 or OS2. Make sure you are using qa-dot from 10.0.2. After doing the changes in my last post and using 10.0.2-qa-dot, perhaps it will pass 'share' and 'semaphore'.