Building newLISP 9.2 from source -- missing header files?

Started by GrammatonCleric, September 05, 2007, 10:13:53 AM

Previous topic - Next topic

GrammatonCleric

I've been trying to build newLISP 9.2 on WinXP Pro on top of the  MinGW/MSYS  runtime using the NetBeans 5.5.1 IDE c/c++ 'make configuration' support.  



When compiling nl_filesys.c, a number of header files cannot be found (sys/ipc.h, sys/sem.h, sys/mman.h, sys/ioctl.h, & sys/socket.h), as well as various complaints concerning the redefintion of `struct timezone' and conflicting types for 'gettimeofday'.



I just installed MinGw/MSYS this last week using the MinGW 5.1.3 installer which in turn installed the MinGW-3.13 runtime, gcc-core-3.4.5, gcc-g++-3.4.5, MSYS-1.0.10., w32api-3.1.0, binutils-2.16.91, and minggw-make-3.81.2.  I can't find any of the listed header files in any of the MinGW/MSYS directories.



What else do I need to do to make this work?

Lutz

#1
Those header files should never been asked for by the Netbeans IDE. In the source code of n-filesys.c they are conditionally included with:


#ifndef WIN_32
.....
#endif


look at the file: makefile_mingw to see how the make in Netbeans has to be configured. This is the relevant line from the makefile:


CFLAGS = -Wall -pedantic -Wno-long-long -c -O1 -g -DWIN_32

Lutz

GrammatonCleric

#2
Thanks Lutz,



I was thrown off when I saw the compile errors and the IDE had flagged those particular #include entires in nl_filesys.c .  However, I still got errors when I tried to 'mingw32-make -f Makefile mingw' from the MSYS command line.  I'm not entirely sure if I've got all that stuff (MSYS/MinGW) put together right.  I can't expect you to debug my MinGW installation, but I was wondering if you could point me to someplace where I can get good information on just how to set all that up.



Thnx,



GC

Lutz

#3
I think the packages installed are msys, gcc, bin-utils, make and API for MS-Windows.



also, I am doing:



make mingw



or



make -f makefile_ming



not!



make -f Makefile mingw





you get the files here: http://sourceforge.net/project/showfiles.php?group_id=2435">http://sourceforge.net/project/showfile ... up_id=2435">http://sourceforge.net/project/showfiles.php?group_id=2435



Lutz

Lutz

#4
...  I think this: MinGW-5.1.3.exe  (further down on the Sourceforge page) contains all you need, except msys



Lutz

Maurizio

#5
I too am unable to compile NewLisp under win 2k

this is what happens :

any suggestions ?

Regards

Maurizio





$ make mingw

make -f makefile_mingw

make[1]: Entering directory `/d/temp/newlisp-9.2.0'

/MinGW/bin/gcc -Wall -pedantic -Wno-long-long -c -O1 -g -DWIN_32 newlisp.c

/MinGW/bin/gcc -Wall -pedantic -Wno-long-long -c -O1 -g -DWIN_32 nl-symbol.c

/MinGW/bin/gcc -Wall -pedantic -Wno-long-long -c -O1 -g -DWIN_32 nl-math.c

/MinGW/bin/gcc -Wall -pedantic -Wno-long-long -c -O1 -g -DWIN_32 nl-list.c

/MinGW/bin/gcc -Wall -pedantic -Wno-long-long -c -O1 -g -DWIN_32 nl-liststr.c

/MinGW/bin/gcc -Wall -pedantic -Wno-long-long -c -O1 -g -DWIN_32 nl-string.c

/MinGW/bin/gcc -Wall -pedantic -Wno-long-long -c -O1 -g -DWIN_32 nl-filesys.c

nl-filesys.c:62: error: redefinition of `struct timezone'

nl-filesys.c:67: error: conflicting types for 'gettimeofday'

c:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/sys/time.h:40: error: previous declaration of 'gettimeofday' was here

nl-filesys.c:67: error: conflicting types for 'gettimeofday'

c:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/sys/time.h:40: error: previous declaration of 'gettimeofday' was here

nl-filesys.c: In function `mySleep':

nl-filesys.c:1824: warning: `_sleep' is deprecated (declared at c:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/stdlib.h:395)

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

make[1]: Leaving directory `/d/temp/newlisp-9.2.0'

make: *** [mingw] Error 2

m35

#6
When I first downloaded and installed mingw+w32api on my lappy some time ago, newlisp compiled flawlessly. A couple months later I downloaded it again and installed it on my desktop. When I compiled there, I received those errors with struct timezone and gettimeofday. I thought it odd that I didn't receive those errors on my laptop (and still don't). To fix the problem, I just went through every newlisp source file and removed those declarations and it compiled fine again.



I suspect either my laptop installation is funny, or mingw was updated since I installed it the first time.

GrammatonCleric

#7
Lutz, m35, & Maurizio,



Thanks guys.



Lutz, since I did use MinGw-5.1.3.exe to install MSYS-MinGW, I'll try what you said, as far as how I invoke make, apparently mingw32-make is considered somewhat deficient in function...





BTW, I noticed that Maurizio was getting exactly the same errors I am, so if all else fails, I suppose I can try his approach...



Thanks again,

GC

GrammatonCleric

#8
Hey all,



I can't help but think this must be some sort of configuration problem with how MSYS/MinGW is set up on my machine, as I have built newLISP before (newLISP 9.1.0 on openSUSE 10.2) without this kind of trouble, so, if I can figure out what the deal is, I'll let you know...



GC

GrammatonCleric

#9
m35,



I'm curious, what are the versions of make and gcc in your laptop MSYS/MinGW installation versus those in your more recent installation of MSYS/MinGW on your desktop, are they different?



My MSYS/MinGW installation uses the 3.79.1 make and the 3.4.5 version of gcc, does your 'lappy' use older or different versions of these tools?



Are there any other configuration files or differences in tool versions that you can see?



I spent some time looking at the newLISP files this morning, and you know, none of them actually include "time.h" that I could see, hence, the error:



nl-filesys.c:62: error: redefinition of `struct timezone'.

nl-filesys.c:67: error: conflicting types for 'gettimeofday'

c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/sys/time.h:40: error: previous declaration of 'gettimeofday' was here





This of course shouldn't happen normally, as no file should be included unless specifically called for, so it must be, I would think, a configuration error somewhere in MSYS/MinGW. If I can figure out why MSYS/MinGW is doing this, I'll let you know...



GC

m35

#10
Hmm, how odd. Finally compared the versions on my laptop and desktop, and they turned out to be exactly the same.



gcc 3.4.5 mingw special

ld 2.16.9 20060119

make 3.79.1

MSYS (uname -a) MINGW32_NT-5.1 <computer name> 1.0.10(0.46/3/2) 2004-03-15 07:17 <processor>

mingw runtime 3.12 (in _mingw.h)

w32api 3.9 (in w32api.h)



However, on my desktop I have FreePascal installed as well, and it has a different version of gcc in my PATH list. That may have something to do with it.



Another note that probably doesn't make any difference, but I rarely use MSYS when compiling newlisp (always compiled fine from cmd.exe).



I doubt this information is very helpful. I really should dig through and find why my laptop/desktop compile differently (won't be able to check for at least a week though).

GrammatonCleric

#11
Gentlemen,



Thanks for looking m35, turns out it doesn't really seem to be a MSYS/MinGW configuration problem after all.



I am somewhat embarrassed to admit it, but my initial examination of the newLISP files and whether they included time.h was somewhat cursory. time.h is actually included in four files in the newLISP file set: newlisp.h, nl-sock.c, nl-web.c, and win32-util.c.  So what I did was this.



Seeing as that the compile errors were coming from timezone and gettimeofday redefinitions in the source code and that newlisp.h includes time.h, I surrounded the offending timezone and gettimeofday declarations like so:


#ifndef WIN_32
struct timezone
{
int tz_minuteswest;
int tz_dsttime;
};

int gettimeofday( struct timeval *tp, struct timezone *tzp );
#endif


This enabled me to complie to newlisp.exe and run qa-dot successfully on WinXP SP2 using the Netbeans 5.5.1 IDE and the MSYS/MinGW toolset:





$ newlisp qa-dot



Testing built-in functions ...



...



ALL FUNCTIONS FINISHED SUCCESSFULL: C:msys1.0homedouglas polsonnewlisp-9.2.0newlisp.exe



total time: 9343







Make sense?



GC