tag:help.appveyor.com,2012-11-13:/discussions/problems/912-problem-building-mono-with-cygwin-inputoutput-redirectionAppVeyor: Discussion 2018-10-19T08:16:48Ztag:help.appveyor.com,2012-11-13:Comment/349924122014-10-18T21:57:31Z2014-10-20T14:03:20ZProblem building Mono with Cygwin. Input/Output redirection?<div><p>Hi,</p>
<p>I am trying to configure Appveyor to build Mono on WIndows for
CI purposes. (I like Appveyor very much, great work!)</p>
<p>The current iteration of the configuration file is in a fork of
the Mono repo at present, here</p>
<p><a href=
"https://github.com/DynamicDevices/mono/blob/master/appveyor.yml">https://github.com/DynamicDevices/mono/blob/master/appveyor.yml</a></p>
<p>I keep on getting "bad file descriptor" errors during
configuration/build and it looks like it is related to Cygwin
trying to use exec to redirect I/O. I have tested this
independently on an Azure Windows Server 2012 VM so it is looking
to me as though it may be related to Appveyor configuration?</p>
<p>e.g.</p>
<p>Skipping configure process.<br>
Done running eglib/autogen.sh ...<br>
Running ./configure --enable-maintainer-mode
--enable-compile-warnings --prefix=/cygdrive/c/monoinstall
--with-preview=yes ...<br>
./configure: line 571: 0: Bad file descriptor</p>
<p>The line in question is this -</p>
<p>test -n "$DJDIR" || exec 7<&0 </dev/null</p>
<p>If I work around that by setting DJDIR then I get the same error
in libtool, related to this function, again redirecting I/O</p>
<p>func_lalib_unsafe_p ()<br>
{ lalib_p=no if test -f "$1" && test -r "$1" &&
exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read
lalib_p_line case "$lalib_p_line" in #\ Generated\ by\
<em>$PACKAGE</em> ) lalib_p=yes; break;; esac done exec 0<&5
5<&- fi test "$lalib_p" = yes }</p>
<p>Any thoughts or feedback you can provide on whether I might be
on the right track, and if so what Appveyor does with I/O would be
appreciated.</p>
<p>Thanks,</p>
<p>Alex</p></div>ajlennontag:help.appveyor.com,2012-11-13:Comment/349924122014-10-19T00:55:32Z2014-10-19T00:55:32ZProblem building Mono with Cygwin. Input/Output redirection?<div><p>Hi Alex,</p>
<p>AppVeyor uses anonymous pipe to collect STDOUT and STDERR
outputs from child process.</p>
<p>As an idea you may try running that line as PowerShell and make
it collecting output.</p>
<p>In <code>appveyor.yml</code> prefix the line with
<code>ps:</code>, for example:</p>
<pre>
<code>build_script:
- ps: the command here</code>
</pre>
<p>Of course, you have to make sure the command plays well with
PS.</p>
<p>Let me know about the results.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/349924122014-10-19T08:40:14Z2014-10-20T14:03:20ZProblem building Mono with Cygwin. Input/Output redirection?<div><p>Hi Feodor,</p>
<p>Thanks for coming back to me. I'm not entirely sure I follow
you, on use of PowerShell. It looked to me as though we were
already using PowerShell? What is happening if we don't prefix with
ps: ?</p>
<p>Thanks & Best Regards,</p>
<p>Alex</p></div>ajlennontag:help.appveyor.com,2012-11-13:Comment/349924122014-10-19T09:02:01Z2014-10-20T14:03:20ZProblem building Mono with Cygwin. Input/Output redirection?<div><p>Scratch that - I see it from the link below it seems to be
treated as a batch command. I will try ps: and see if I can come up
with a fix or a simple test</p>
<p><a href=
"http://www.appveyor.com/docs/build-configuration">http://www.appveyor.com/docs/build-configuration</a></p>
<p>Regards, Alex</p></div>ajlennontag:help.appveyor.com,2012-11-13:Comment/349924122014-10-19T11:56:51Z2014-10-20T14:03:20ZProblem building Mono with Cygwin. Input/Output redirection?<div><p>I seem to get a different set of problems when using ps:</p>
<p><a href=
"https://ci.appveyor.com/project/ajlennon/mono-817/build/1.0.49">https://ci.appveyor.com/project/ajlennon/mono-817/build/1.0.49</a></p></div>ajlennontag:help.appveyor.com,2012-11-13:Comment/349924122014-10-19T14:32:45Z2014-10-20T14:03:20ZProblem building Mono with Cygwin. Input/Output redirection?<div><p>I made some progress with this. The powershell wasn't helping so
I reverted back to the default cmd usage.</p>
<p>It appears that the stdin stream file descriptor is not as
needed by autotools/configure.</p>
<p>There appears to be a somewhat standard methodology during
configuration tests to redirect stdin/stdout and this is failing as
the stdin descriptor 0 is not valid.</p>
<p>I am not sure why this would be but I suspect it is something to
do with the piping you mentioned that Appveyor is doing, so I
suspect you may see this in future.</p>
<p>For now I seem to have been able to work around this by adding a
dummy opening of that file descriptor before running the
autotools/configure/make steps.</p>
<p>e.g. exec 0</dev/null; ./autogen.sh</p>
<p>I am still working on this but it seems to solve the immediate
problem.</p></div>ajlennon