public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* running .bat file in cygwin
@ 2012-07-11 16:26 emon
  2012-07-11 16:38 ` Adam Dinwoodie
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: emon @ 2012-07-11 16:26 UTC (permalink / raw)
  To: cygwin


Dear All,
              I am a newbie in cygwin.  However, I have used mingw so far,
but it is not supporting fork(), so I need to switch to cygwin.  I have
created a build.bat file in my mingw (programming language C):

gcc -o mask mask.c -pg -I/c/opencv/build/include  -lopencv_core231
-lopencv_highgui231 -lopencv_imgproc231 -L. -L/c/opencv/build/x86/mingw/lib

Can anyone suggest me how I can run this .bat file at cygwin or refer me to
a site.

Thanks for your help

Emon
-- 
View this message in context: http://old.nabble.com/running-.bat-file-in-cygwin-tp34146666p34146666.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: running .bat file in cygwin
  2012-07-11 16:26 running .bat file in cygwin emon
@ 2012-07-11 16:38 ` Adam Dinwoodie
  2012-07-11 16:39 ` Larry Hall (Cygwin)
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Adam Dinwoodie @ 2012-07-11 16:38 UTC (permalink / raw)
  To: cygwin

emon wrote:
>              I am a newbie in cygwin.  However, I have used mingw so far,
>but it is not supporting fork(), so I need to switch to cygwin.  I have
>created a build.bat file in my mingw (programming language C):
>
>gcc -o mask mask.c -pg -I/c/opencv/build/include  -lopencv_core231
>-lopencv_highgui231 -lopencv_imgproc231 -L. -L/c/opencv/build/x86/mingw/lib
>
>Can anyone suggest me how I can run this .bat file at cygwin or refer me to
>a site.

Use a shell script rather than a batch file. A search for "shell script" with
your favourite search engine should show up beginner's guides if you're
unfamiliar.

Adam

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: running .bat file in cygwin
  2012-07-11 16:26 running .bat file in cygwin emon
  2012-07-11 16:38 ` Adam Dinwoodie
@ 2012-07-11 16:39 ` Larry Hall (Cygwin)
  2012-07-11 17:05   ` emon
  2012-07-11 16:59 ` Greg Chicares
  2012-07-11 18:25 ` Earnie Boyd
  3 siblings, 1 reply; 11+ messages in thread
From: Larry Hall (Cygwin) @ 2012-07-11 16:39 UTC (permalink / raw)
  To: cygwin

On 7/11/2012 12:26 PM, emon wrote:
>
> Dear All,
>                I am a newbie in cygwin.  However, I have used mingw so far,
> but it is not supporting fork(), so I need to switch to cygwin.  I have
> created a build.bat file in my mingw (programming language C):
>
> gcc -o mask mask.c -pg -I/c/opencv/build/include  -lopencv_core231
> -lopencv_highgui231 -lopencv_imgproc231 -L. -L/c/opencv/build/x86/mingw/lib
>
> Can anyone suggest me how I can run this .bat file at cygwin or refer me to
> a site.

Are you implying that invoking it directly from the Cygwin Terminal doesn't
work for you?  Is 'build.bat' executable?

-- 
Larry

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: running .bat file in cygwin
  2012-07-11 16:26 running .bat file in cygwin emon
  2012-07-11 16:38 ` Adam Dinwoodie
  2012-07-11 16:39 ` Larry Hall (Cygwin)
@ 2012-07-11 16:59 ` Greg Chicares
  2012-07-11 18:25 ` Earnie Boyd
  3 siblings, 0 replies; 11+ messages in thread
From: Greg Chicares @ 2012-07-11 16:59 UTC (permalink / raw)
  To: cygwin

On 2012-07-11 16:26Z, emon wrote:
> 
> Can anyone suggest me how I can run this .bat file at cygwin or refer me to
> a site.

Since you've decided to start using Cygwin, the best advice
is probably to write it as a shell script instead. There are
many tutorials on the web.

But if you really want to use a batch file...make sure it's
executable, then just run it--for example:

/tmp[0]$cat >eraseme.bat <<\EOF
echo Hello from batch file
EOF
/tmp[0]$chmod +x eraseme.bat
/tmp[0]$./eraseme.bat

C:\cygwin-1_7\tmp>echo Hello from batch file
Hello from batch file

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: running .bat file in cygwin
  2012-07-11 16:39 ` Larry Hall (Cygwin)
@ 2012-07-11 17:05   ` emon
  2012-07-11 17:54     ` Larry Hall (Cygwin)
  0 siblings, 1 reply; 11+ messages in thread
From: emon @ 2012-07-11 17:05 UTC (permalink / raw)
  To: cygwin


Dear Larry,
              When I use mingw terminal, build.bat would create a mask.exe. 
This is the executable file,mask.exe.  If I try the same way in cygwin, it
provides me the following error.
-bash:build.bat command not found.

By the by, my computer is installed both cygwin and mingw.

thanks for your respond.  I am sure there is a lacking in my background in
cygwin somewhere, if you may point that out, so I can seach read the proper
documentation.

Best

Larry Hall (Cygwin-X) wrote:
> 
> On 7/11/2012 12:26 PM, emon wrote:
>>
>> Dear All,
>>                I am a newbie in cygwin.  However, I have used mingw so
>> far,
>> but it is not supporting fork(), so I need to switch to cygwin.  I have
>> created a build.bat file in my mingw (programming language C):
>>
>> gcc -o mask mask.c -pg -I/c/opencv/build/include  -lopencv_core231
>> -lopencv_highgui231 -lopencv_imgproc231 -L.
>> -L/c/opencv/build/x86/mingw/lib
>>
>> Can anyone suggest me how I can run this .bat file at cygwin or refer me
>> to
>> a site.
> 
> Are you implying that invoking it directly from the Cygwin Terminal
> doesn't
> work for you?  Is 'build.bat' executable?
> 
> -- 
> Larry
> 
> _____________________________________________________________________
> 
> A: Yes.
>  > Q: Are you sure?
>  >> A: Because it reverses the logical flow of conversation.
>  >>> Q: Why is top posting annoying in email?
> 
> 
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/running-.bat-file-in-cygwin-tp34146666p34146901.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: running .bat file in cygwin
  2012-07-11 17:05   ` emon
@ 2012-07-11 17:54     ` Larry Hall (Cygwin)
  0 siblings, 0 replies; 11+ messages in thread
From: Larry Hall (Cygwin) @ 2012-07-11 17:54 UTC (permalink / raw)
  To: cygwin

On 7/11/2012 1:05 PM, emon wrote:
>
> Dear Larry,
>                When I use mingw terminal, build.bat would create a mask.exe.
> This is the executable file,mask.exe.  If I try the same way in cygwin, it
> provides me the following error.
> -bash:build.bat command not found.

As Greg points out in a subsequent message, you need to tell Cygwin where
to find "build.bat".  You'd need to do the same in Mingw but there you've
probably had its location in your path for a while so it's likely this
detail has slipped from your memory.

> By the by, my computer is installed both cygwin and mingw.
>
> thanks for your respond.  I am sure there is a lacking in my background in
> cygwin somewhere, if you may point that out, so I can seach read the proper
> documentation.

A good source of Cygwin-specific information is:

<http://cygwin.com/cygwin-ug-net.html>

Newbie guides for Linux are your best bet if you need help from ground zero.


-- 
Larry

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: running .bat file in cygwin
  2012-07-11 16:26 running .bat file in cygwin emon
                   ` (2 preceding siblings ...)
  2012-07-11 16:59 ` Greg Chicares
@ 2012-07-11 18:25 ` Earnie Boyd
  2012-07-11 19:33   ` emon
  2012-07-12 19:52   ` emon
  3 siblings, 2 replies; 11+ messages in thread
From: Earnie Boyd @ 2012-07-11 18:25 UTC (permalink / raw)
  To: cygwin

On Wed, Jul 11, 2012 at 12:26 PM, emon wrote:
>
> Dear All,
>               I am a newbie in cygwin.  However, I have used mingw so far,
> but it is not supporting fork(), so I need to switch to cygwin.  I have
> created a build.bat file in my mingw (programming language C):
>

Note, fork requires the cygwin1.dll file.  Are you prepared for that?

> gcc -o mask mask.c -pg -I/c/opencv/build/include  -lopencv_core231
> -lopencv_highgui231 -lopencv_imgproc231 -L. -L/c/opencv/build/x86/mingw/lib
>
> Can anyone suggest me how I can run this .bat file at cygwin or refer me to
> a site.

I've read all the other response, etc.  However, if you want to use
the .bat file you can do

cmd /c build.bat

take care that your PATH has all you need and note that /posix/paths
don't 't work with MinGW gcc.  But since you need fork() you'll need
to use the Cygwin GCC anyway.

-- 
Earnie
-- https://sites.google.com/site/earnieboyd

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: running .bat file in cygwin
  2012-07-11 18:25 ` Earnie Boyd
@ 2012-07-11 19:33   ` emon
  2012-07-11 19:41     ` James Johnston
  2012-07-12  2:57     ` Earnie Boyd
  2012-07-12 19:52   ` emon
  1 sibling, 2 replies; 11+ messages in thread
From: emon @ 2012-07-11 19:33 UTC (permalink / raw)
  To: cygwin


"Note, fork requires the cygwin1.dll file.  Are you prepared for that?"

thanks for your response.  What got me notice is the above comment?  Would
you please elaborate on that?  The only reason I would be going through this
becuase i am working on parallel processing on my thesis. Currently, in my
code i have used thread with mingw environment.  But in one part of the code
requires to use separate image for each function calls (thread function). 
Unfortuanately, it is not working; it is taking the same image and
performing the calculation. 

I have the theorotical konwledge on fork() from the OS classes.  Do i need
to install any additional module to use fork() in my code?  Any
documentation you may recomend prior to using cygwin with fork()?  Or you
think it will be better to install linux in my laptop instead of using
cygwin? 



Earnie wrote:
> 
> On Wed, Jul 11, 2012 at 12:26 PM, emon wrote:
>>
>> Dear All,
>>               I am a newbie in cygwin.  However, I have used mingw so
>> far,
>> but it is not supporting fork(), so I need to switch to cygwin.  I have
>> created a build.bat file in my mingw (programming language C):
>>
> 
> Note, fork requires the cygwin1.dll file.  Are you prepared for that?
> 
>> gcc -o mask mask.c -pg -I/c/opencv/build/include  -lopencv_core231
>> -lopencv_highgui231 -lopencv_imgproc231 -L.
>> -L/c/opencv/build/x86/mingw/lib
>>
>> Can anyone suggest me how I can run this .bat file at cygwin or refer me
>> to
>> a site.
> 
> I've read all the other response, etc.  However, if you want to use
> the .bat file you can do
> 
> cmd /c build.bat
> 
> take care that your PATH has all you need and note that /posix/paths
> don't 't work with MinGW gcc.  But since you need fork() you'll need
> to use the Cygwin GCC anyway.
> 
> -- 
> Earnie
> -- https://sites.google.com/site/earnieboyd
> 
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/running-.bat-file-in-cygwin-tp34146666p34147664.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: running .bat file in cygwin
  2012-07-11 19:33   ` emon
@ 2012-07-11 19:41     ` James Johnston
  2012-07-12  2:57     ` Earnie Boyd
  1 sibling, 0 replies; 11+ messages in thread
From: James Johnston @ 2012-07-11 19:41 UTC (permalink / raw)
  To: cygwin

> -----Original Message-----
> Sent: Wednesday, July 11, 2012 19:34
> Subject: Re: running .bat file in cygwin
> 
> 
> "Note, fork requires the cygwin1.dll file.  Are you prepared for that?"
> 
> thanks for your response.  What got me notice is the above comment?
> Would you please elaborate on that?  The only reason I would be going
> through this becuase i am working on parallel processing on my thesis.
> Currently, in my code i have used thread with mingw environment.  But in
> one part of the code requires to use separate image for each function
calls
> (thread function).
> Unfortuanately, it is not working; it is taking the same image and
performing
> the calculation.
> 
> I have the theorotical konwledge on fork() from the OS classes.  Do i need
to
> install any additional module to use fork() in my code?  Any documentation
> you may recomend prior to using cygwin with fork()?  Or you think it will
be
> better to install linux in my laptop instead of using cygwin?

I think it would be better to not use fork().  What do you have to do with
fork() that you can't do some other way?


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: running .bat file in cygwin
  2012-07-11 19:33   ` emon
  2012-07-11 19:41     ` James Johnston
@ 2012-07-12  2:57     ` Earnie Boyd
  1 sibling, 0 replies; 11+ messages in thread
From: Earnie Boyd @ 2012-07-12  2:57 UTC (permalink / raw)
  To: cygwin

On Wed, Jul 11, 2012 at 3:33 PM, emon <temursalin@gmail.com> wrote:
>
> "Note, fork requires the cygwin1.dll file.  Are you prepared for that?"
>
> thanks for your response.  What got me notice is the above comment?  Would
> you please elaborate on that?  The only reason I would be going through this
> becuase i am working on parallel processing on my thesis. Currently, in my
> code i have used thread with mingw environment.  But in one part of the code
> requires to use separate image for each function calls (thread function).
> Unfortuanately, it is not working; it is taking the same image and
> performing the calculation.
>
> I have the theorotical konwledge on fork() from the OS classes.  Do i need
> to install any additional module to use fork() in my code?  Any
> documentation you may recomend prior to using cygwin with fork()?  Or you
> think it will be better to install linux in my laptop instead of using
> cygwin?

If you don't want to be encumbered by cygwin1.dll then look at the
MSDN for documentation related to CreateProcess().

-- 
Earnie
-- https://sites.google.com/site/earnieboyd

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: running .bat file in cygwin
  2012-07-11 18:25 ` Earnie Boyd
  2012-07-11 19:33   ` emon
@ 2012-07-12 19:52   ` emon
  1 sibling, 0 replies; 11+ messages in thread
From: emon @ 2012-07-12 19:52 UTC (permalink / raw)
  To: cygwin


Can you help me on this:

Need urgent help on thread: the goal here is the separtemask will take each
image and separate different contours and for each contour in the image it
will call handleobject thread. So every for loop will call the handeobject
thread. However, object index variable needs to be passed in each thread.
But only last value of objectndex is passed, this is becuase the speratemask
function loops and repalces the value of obj.objindx and only the last value
of obj.objindx is 
passed to all the threads. Is there anyway to pass each objectindex
value in handleobject. The code runs fine if we uncomment the
pthread_join(tid[objectIndex],NULL); but it will not give a parralel program

void separateMask(IplImage *maskImg)
{

for(r = contours; r != NULL; r = r->h_next){
cvSet(objectMaskImg, cvScalarAll(0), NULL);
CvScalar externalColor = cvScalarAll(0xff);
CvScalar holeColor = cvScalarAll(0x00);
int maxLevel = -1; 
int thinkness = CV_FILLED; 
int lineType = 8; /* 8-connected */
cvDrawContours(objectMaskImg, r, externalColor, holeColor, maxLevel,
thinkness, lineType, cvPoint(0,0));;
obj.objectMaskImg1[objectIndex]=(IplImage *) malloc(sizeof(IplImage));
obj.objectMaskImg1[objectIndex]=objectMaskImg;
obj.objindx=objectIndex;
obj.intensityOut1=intensityOut;
obj.tasOut1=tasOut;
pthread_create(&tid[objectIndex],NULL,handleObject,(void *)&obj);
//pthread_join(tid[objectIndex],NULL);
printf("objectindx %d\n",obj.objindx);
objectIndex++;

}
// cvReleaseImage(&objectMaskImg);
//cvReleaseMemStorage(&storage);
printf("Exitng Separatemask\n");

}


void* handleObject(void *arg)
{
int i, j;
handle *hndl;
hndl=(handle *) malloc(sizeof(handle));
hndl=(handle*)arg;
pthread_mutex_t lock=PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_lock(&lock);
IplImage *pImg;
float statistics_ratio[3][9];
pthread_t tid3;
tas3 tas2;
pImg = cvLoadImage("image.tif", CV_LOAD_IMAGE_ANYCOLOR |
CV_LOAD_IMAGE_ANYDEPTH);
if(pImg == NULL){
fprintf(stderr, "Fail to load image %s\n", "tiff file");
return ;
}
tas2.pImg1=pImg;
printf("tst%d\n",hndl->objindx);
tas2.x=hndl->objindx;
tas2.objectMaskImg1=hndl->objectMaskImg1[tas2.x];
tas2.statistics_ratio[3][9]=statistics_ratio[3][9];
double mean = average_intensity(pImg, tas2.objectMaskImg1); 
int total = total_white(pImg, tas2.objectMaskImg1);
pthread_mutex_unlock(&lock);

printf("Exiting handle object thread_id %d\n\n", pthread_self());
}


Earnie wrote:
> 
> On Wed, Jul 11, 2012 at 12:26 PM, emon wrote:
>>
>> Dear All,
>>               I am a newbie in cygwin.  However, I have used mingw so
>> far,
>> but it is not supporting fork(), so I need to switch to cygwin.  I have
>> created a build.bat file in my mingw (programming language C):
>>
> 
> Note, fork requires the cygwin1.dll file.  Are you prepared for that?
> 
>> gcc -o mask mask.c -pg -I/c/opencv/build/include  -lopencv_core231
>> -lopencv_highgui231 -lopencv_imgproc231 -L.
>> -L/c/opencv/build/x86/mingw/lib
>>
>> Can anyone suggest me how I can run this .bat file at cygwin or refer me
>> to
>> a site.
> 
> I've read all the other response, etc.  However, if you want to use
> the .bat file you can do
> 
> cmd /c build.bat
> 
> take care that your PATH has all you need and note that /posix/paths
> don't 't work with MinGW gcc.  But since you need fork() you'll need
> to use the Cygwin GCC anyway.
> 
> -- 
> Earnie
> -- https://sites.google.com/site/earnieboyd
> 
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/running-.bat-file-in-cygwin-tp34146666p34152926.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-07-12 19:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-11 16:26 running .bat file in cygwin emon
2012-07-11 16:38 ` Adam Dinwoodie
2012-07-11 16:39 ` Larry Hall (Cygwin)
2012-07-11 17:05   ` emon
2012-07-11 17:54     ` Larry Hall (Cygwin)
2012-07-11 16:59 ` Greg Chicares
2012-07-11 18:25 ` Earnie Boyd
2012-07-11 19:33   ` emon
2012-07-11 19:41     ` James Johnston
2012-07-12  2:57     ` Earnie Boyd
2012-07-12 19:52   ` emon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).