newLISP Fan Club

Forum => So, what can you actually DO with newLISP? => Dragonfly => Topic started by: anta40 on February 21, 2013, 07:53:22 AM

Title: newlisp crashes
Post by: anta40 on February 21, 2013, 07:53:22 AM
I'm using:

- 32-bit Win 7

- newlisp v10.4.6

- apache 2.4.3 (//http)



And this is how I did the setup:

1. Put newlisp in C:newlisp

2. Put apache in C:apache24

3. Put the dragonfly framework in C:apache24htdocs.



I ran newlispServerWin.bat, and command prompt printed this:
QuoteIf all goes well visit http://localhost:8080 in your browser


Opened http://localhost:8080 on the browser, and newlisp crashed. Every time.



How to fix this?
Title: Re: newlisp crashes
Post by: Lutz on February 21, 2013, 11:12:49 AM
This bug was introduced in the Windows development version 10.4.6 and is not present in the stable release 10.4.5 and not present on non Windows versions.



If you can compile yourself you can do the following in version 10.4.6:



Replace in nl-web.c in line 1355:



#ifdef ANDROID
if(!isDir("/data/tmp"))
#else
if(!isDir("/tmp"))
#endif


replace with the following:



#ifdef ANDROID
if(isFile("/data/tmp", 0) != 0)
#else
if(isFile("/tmp", 0) != 0)
#endif


Else go back to 10.4.5 or wait for the next development version 10.4.7 installers next week.



Thanks for catching this bug!
Title: Re: newlisp crashes
Post by: anta40 on February 21, 2013, 08:45:22 PM
Hi Lutz,



Thanks for the hint.



I just tried to rebuild v10.4.6 (using gcc 4.7.2 from mingwbuilds (//http)). Got 2 errors.



The first one was:
Quote$ make -f makefile_mingw_utf8

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O1 -g -DSUPPORT_UTF8 -DWIN_32 newlisp.c

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O1 -g -DSUPPORT_UTF8 -DWIN_32 nl-symbol.c

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O1 -g -DSUPPORT_UTF8 -DWIN_32 nl-math.c

nl-math.c:64:5: warning: '_matherr' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O1 -g -DSUPPORT_UTF8 -DWIN_32 nl-list.c

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O1 -g -DSUPPORT_UTF8 -DWIN_32 nl-liststr.c

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O1 -g -DSUPPORT_UTF8 -DWIN_32 nl-string.c

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O1 -g -DSUPPORT_UTF8 -DWIN_32 nl-filesys.c

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O1 -g -DSUPPORT_UTF8 -DWIN_32 nl-sock.c

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O1 -g -DSUPPORT_UTF8 -DWIN_32 nl-import.c

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O1 -g -DSUPPORT_UTF8 -DWIN_32 nl-xml.c

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O1 -g -DSUPPORT_UTF8 -DWIN_32 nl-web.c

nl-web.c:1430:7: error: conflicting types for 'MEDIA_TYPE'

In file included from c:mingwbin../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/winscard.h:11:

0,

                 from c:mingwbin../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/windows.h:97,

                 from c:mingwbin../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/winsock2.h:23,



                 from nl-web.c:25:

c:mingwbin../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/winioctl.h:493:3: note: previous dec

laration of 'MEDIA_TYPE' was here

make: *** [nl-web.o] Error 1


So I applied this fix in nl-web.c in line 1426
typedef struct
    {
    char * extension;
    char * type;
    } T_MEDIA_TYPE;
   
T_MEDIA_TYPE mediaType[] = {


And the second error was:
Quote$ make -f makefile_mingw_utf8

gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O1 -g -DSUPPORT_UTF8 -DWIN_32 nl-math.c

nl-math.c:64:5: warning: '_matherr' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]

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-w

eb.o nl-matrix.o nl-debug.o pcre.o nl-utf8.o win32-util.o win32-path.o -lws2_32 -o newlisp.exe

c:/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/lib/../lib/libmingw32.a(lib32_libmingw32_a-m

err.o):merr.c:(.text+0x60): multiple definition of `_matherr'

nl-math.o:c:UsersCSL-NB-064Desktopnewlisp-10.4.6/nl-math.c:64: first defined here

collect2.exe: error: ld returned 1 exit status


Edited nl-math.c line 63 like this:

//#ifdef WIN_32
//int _matherr(struct _exception *e) {return 1;}
//#endif


After those 2 fixes, newlisp would compile, but behaved erroneously like this:
Quote
$ newlisp

newLISP v.10.4.6 on Win32 IPv4/6 UTF-8, execute 'newlisp -h' for options.



> (+ 10 20 30)



ERR: missing parenthesis : "...(+ 10 20 30                          "

> (exit)



ERR: missing parenthesis : "...(exit                                "


Err... I give up. Better wait for your next release :D
Title: Re: newlisp crashes
Post by: Lutz on February 22, 2013, 07:22:08 AM
My build system is based on http://www.mingw.org/



and http://www.mingw.org/wiki/InstallationHOWTOforMinGW



But I am still on gcc 4.4.0 the current version on that site seems to be gcc 4.6.2. Version changes on MinGW always require code changes, so I don't do it too often.
Title: Re: newlisp crashes
Post by: kosh on March 28, 2013, 08:06:02 PM
QuoteAfter those 2 fixes, newlisp would compile, but behaved erroneously like this:

$ newlisp

newLISP v.10.4.6 on Win32 IPv4/6 UTF-8, execute 'newlisp -h' for options.



> (+ 10 20 30)



ERR: missing parenthesis : "...(+ 10 20 30 "

> (exit)



ERR: missing parenthesis : "...(exit "


please try this

//http://newlispfanclub.alh.net/forum/viewtopic.php?f=9&t=4316