help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird behavior on program execution with gmake (socket + pthreads)


From: Greg Chicares
Subject: Re: Weird behavior on program execution with gmake (socket + pthreads)
Date: Sat, 11 Sep 2010 22:01:37 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2

On 2010-09-11 21:06Z, Axel wrote:
[...]
> My program runs fine when I type "make run" (the binary is executed
> through the Makefile, see the attached file). When I run it by hand or
> using gdb (or with python popen4) the thread which manage the new
> connections (accept() on the main thread socket) cannot accept them
> (accept() returns -1 with errno to "Invalid argument"). I tried to put
> the thread code in the main and it worked whether I was using gmake or
> not.

The makefile says:

.PHONY: run
run: build
        @cd $(DEBUGDIR); ./$(EXEC)

debugrun: build
        @cd $(DEBUGDIR); gdb ./$(EXEC)

and it sounds like the first target works, the second fails, and it
also fails if you run the first target's recipe on the command line:

  # substituting variables in "cd $(DEBUGDIR); ./$(EXEC)":
  $cd build/debug; ./main

> So my conclusion is that gmake/my Makefile affects the program execution
> via permissions of the thread socket/ressource sharing or something like
> this. It maybe something else but I wasn't able to reproduce it anywhere
> but with gmake. I'm lost in an unknown land and looking for some help.

To verify what command 'make' is issuing, run 'make -d run' or at
least remove the '@' above. For the 'run' target, it should run this
command in a '/bin/sh' subshell:
  cd build/debug; ./main
which, however, fails if you paste it into your interactive shell.

Could the cause be something like an uninitialized pointer in 'main'?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]