Problem building Mono with Cygwin. Input/Output redirection?

ajlennon's Avatar


18 Oct, 2014 09:57 PM


I am trying to configure Appveyor to build Mono on WIndows for CI purposes. (I like Appveyor very much, great work!)

The current iteration of the configuration file is in a fork of the Mono repo at present, here

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?


Skipping configure process.
Done running eglib/ ...
Running ./configure --enable-maintainer-mode --enable-compile-warnings --prefix=/cygdrive/c/monoinstall --with-preview=yes ...
./configure: line 571: 0: Bad file descriptor

The line in question is this -

test -n "$DJDIR" || exec 7<&0 </dev/null

If I work around that by setting DJDIR then I get the same error in libtool, related to this function, again redirecting I/O

func_lalib_unsafe_p ()
    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
        for lalib_p_l in 1 2 3 4
            read lalib_p_line
            case "$lalib_p_line" in
                \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
        exec 0<&5 5<&-
    test "$lalib_p" = yes

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.



  1. Support Staff 1 Posted by Feodor Fitsner on 19 Oct, 2014 12:55 AM

    Feodor Fitsner's Avatar

    Hi Alex,

    AppVeyor uses anonymous pipe to collect STDOUT and STDERR outputs from child process.

    As an idea you may try running that line as PowerShell and make it collecting output.

    In appveyor.yml prefix the line with ps:, for example:

      - ps: the command here

    Of course, you have to make sure the command plays well with PS.

    Let me know about the results.

  2. 2 Posted by ajlennon on 19 Oct, 2014 08:40 AM

    ajlennon's Avatar

    Hi Feodor,

    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: ?

    Thanks & Best Regards,


  3. 3 Posted by ajlennon on 19 Oct, 2014 09:02 AM

    ajlennon's Avatar

    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

    Regards, Alex

  4. 4 Posted by ajlennon on 19 Oct, 2014 11:56 AM

    ajlennon's Avatar

    I seem to get a different set of problems when using ps:

  5. 5 Posted by ajlennon on 19 Oct, 2014 02:32 PM

    ajlennon's Avatar

    I made some progress with this. The powershell wasn't helping so I reverted back to the default cmd usage.

    It appears that the stdin stream file descriptor is not as needed by autotools/configure.

    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.

    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.

    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.

    e.g. exec 0</dev/null; ./

    I am still working on this but it seems to solve the immediate problem.

  6. ajlennon closed this discussion on 20 Oct, 2014 02:27 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac