delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/04/08/19:54:55

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Fri, 08 Apr 2005 16:52:27 -0700
From: "Larry" <larry AT eBizCreators DOT com>
Subject: Make, TMP=tmpnam => coredump
To: <cygwin AT cygwin DOT com>
Message-id: <PDEBLOPEKAOKEBIONCMIKEHNFAAA.larry@eBizCreators.com>
MIME-version: 1.0

Hello,

Using cygwin, I'm building the code from the book, Beginning Linux
Programming. I ran across a bug that chewed up a considerable amount of my
time. As a newbie, perhaps I'm doing something wrong. On the chance that
this is a bug, I hope I can save others from grief.

Chapter 4 of the book is where I discovered the problem. It turns out to be
inside the makefile.

Here's the Makefile:
------------
# Makefile for Beginning Linux Programming 3rd Edition
# Chapter 4

ARGS=args argopt longopt
ENV=environ showenv
TIME=envtime gmtime ctime strftime
TMP=tmpnam
USER=user
HOST=hostget
LOG=syslog logmask
RES=limits

CC = g++ -v
CFLAGS = -ggdb
LDFLAGS=-lm

ALL= $(ARGS) $(ENV) $(TIME) $(TMP) $(USER) $(HOST) $(LOG) $(RES)

all: $(ALL)

user: user
	g++ -v -ggdb  -lm  user.c   -o user

clean:
	@rm -f $(ALL) *~
------------

The problem I found is that the Makefile contains the statement
'TMP=tmpnam'. The build fails after the program builds a file $(TMP).
Apparently, the local tmpnam.exe file that gets built gets called when make
attempts to build the remaining files. (Is there a way to disable the pwd to
test this?) I've verified this problem on two out of three machines.

Does anybody know about this bug? Can someone please confirm what I'm
experiencing?

Here's a simple test to confirm:

Makefile
--------
TMP=tmpnam

all: $(TMP) program
    gcc -c program.c
--------------------------

create two identical files tmpnam.c and program.c with the following code:
--------------------------
#include <stdio.h>

int main()
{
    printf("Hello World!");
}
--------------------------

Type make. This is what I get:

C:\Temp\Chap04\>make
gcc     tmpnam.c   -o tmpnam
gcc     program.c   -o program
make: *** [program] Aborted (core dumped)

C:\Temp\Chap04\>ls
Makefile  gcc.exe.stackdump  program.c  tmpnam.c  tmpnam.exe

------------

Any ideas?

HTH someone else.


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019