newlisp crashes

A web framework in newLISP
Post Reply
anta40
Posts: 11
Joined: Wed Jan 30, 2008 4:57 pm
Location: Indonesia
Contact:

newlisp crashes

Post by anta40 »

I'm using:
- 32-bit Win 7
- newlisp v10.4.6
- apache 2.4.3

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:\apache24\htdocs.

I ran newlispServerWin.bat, and command prompt printed this:
If 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?

Lutz
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: newlisp crashes

Post by Lutz »

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:

Code: Select all

#ifdef ANDROID
if(!isDir("/data/tmp"))
#else
if(!isDir("/tmp"))
#endif
replace with the following:

Code: Select all

#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!

anta40
Posts: 11
Joined: Wed Jan 30, 2008 4:57 pm
Location: Indonesia
Contact:

Re: newlisp crashes

Post by anta40 »

Hi Lutz,

Thanks for the hint.

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

The first one was:
$ 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:\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/winscard.h:11:
0,
from c:\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/windows.h:97,
from c:\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/winsock2.h:23,

from nl-web.c:25:
c:\mingw\bin\../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

Code: Select all

typedef struct
    {
    char * extension;
    char * type;
    } T_MEDIA_TYPE;
    
T_MEDIA_TYPE mediaType[] = {
And the second error was:
$ 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:\Users\CSL-NB-064\Desktop\newlisp-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:

Code: Select all

//#ifdef WIN_32
//int _matherr(struct _exception *e) {return 1;}
//#endif
After 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 "
Err... I give up. Better wait for your next release :D

Lutz
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: newlisp crashes

Post by Lutz »

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.

kosh
Posts: 69
Joined: Sun Sep 13, 2009 5:38 am
Location: Japan
Contact:

Re: newlisp crashes

Post by kosh »

After 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/vie ... f=9&t=4316

Post Reply