Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <42575C87.78DBFA85@dessent.net> Date: Fri, 08 Apr 2005 21:39:35 -0700 From: Brian Dessent Organization: My own little world... MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Make, TMP=tmpnam => coredump References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Larry wrote: > I get the exact same results when I run those commands. > > Perhaps I had an error in my Makefile. Can you please try the following > Makefile that still generates the same error for me? Okay, I realized that I'd named one of the source files "tmpname.c" and not "tmpnam.c" in which case I get what you get. The reason is as I suspected the poor choice of the variable named TMP. Under windows this variable designates the directory in which programs are to create temporary files. gcc is one of these programs that needs to create temporary files. When you set TMP in the Makefile to "tmpnam" that tells gcc to try to store its temporary files in a directory "tmpnam" under the current directory. If there is an executable with the same name in the current directory it faults. You can reproduce this without 'make' as follows: $ ls -l total 16K -rw-r--r-- 1 brian None 53 Apr 8 21:18 Makefile -rw-r--r-- 1 brian None 67 Apr 8 17:12 program.c -rw-r--r-- 1 brian None 67 Apr 8 17:12 tmpnam.c -rwxr-xr-x 1 brian None 13K Apr 8 21:29 tmpnam.exe $ export TMP=tmpnam $ gcc program.c -o program Aborted (core dumped) This is arguably a gcc bug, but in reality you can't expect to use a variable named TMP like that under Windows because it has special meaning. The author of that book just demonstrated a good lesson in how not to write portable makefiles. Just a couple of pieces of advice about your makefile: CC and CFLAGS are for compiling C code, CXX and CXXFLAGS are for C++ code. Don't put g++ into CC unless you know what you're doing. Call gcc as gcc when compiling C code, call it as g++ when compiling C++. Oh and case matters, so no "cc". Also, under Cygwin "-lm" is not necessary, nor are -lsocket, -lpthread, and probably a couple of others. They are all provided by -lcygwin which is automatically added by the compiler. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/