1.7.5-1: execv fails in .exe compiled

Stephen Morton stephen.c.morton@gmail.com
Thu May 6 14:22:00 GMT 2010


We have a gcc 3.4.6 cross-compiler that is an essential part of our
development environment that does not work under cygwin 1.7
(+Win7-64). Somehow cc.exe is not able to execv cc1.exe.

I'm stumped and any insight you can give me would be much appreciated.

Note: the fact that the program that is failing is a compiler might
cause some confusion. The cygwin gcc is not failing. What's failing
(failing to execv a sub-program) is just a tool that I'm running that
just happens to be a compiler.

Situation:
=======
I'm experimenting converting our stable working WinXP + cygwin 1.3/1.5
environemnt (both in use, both work) to Win7 64-bit + cygwin1.7.

We have a gcc 3.4.6 cross-compiler that is an essential part of our
development environment that does not work under cygwin 1.7
(+Win7-64). Somehow cc.exe is not able to execv cc1.exe.

I have searched the mailing lists and the web, and have tried lots of
reasonable things, but am stumped. I'm not a Cygwin expert, but I'm
pretty computer- and linux/unix-literate.


Problem:
=======

When I try to run the GCC CC compiler (called "cc386" because it's for
generating Intel x86 output) it fails to exec cc1.exe as follows.

module~> /usr/local/companytools/gcc34/x86/cc386
-B/usr/local/companytools/gcc34/x86 module_cli.c
cc386: installation problem, cannot exec
`/usr/local/companytools/gcc34/x86/cc1.exe': No such file or directory

Steps to Debug:
=======
1. Verify that cc1.exe exists and is executable, and can be run on its
own. Verified.
2. Try again without the -B option but with cc1.exe in the path. Same error.
3. Try running "/usr/local/companytools/gcc34/x86/cc1.exe module_cli.c". Works.
4. Obtain full exact cc386 command line from working cygwin 1.5
machine and run it on 1.7. Fails in same way.
5. Obtain full exact cc1.exe (the sub-process) command line from
working cygwin 1.5 machine and run it on 1.7. It works. (Really just a
variation in #3.)
6. Recompile the compiler. Perhaps there's some dependency on an
earlier cygwin dll. Compiler intermediate self-compile fails in same
way. ("xgcc: installation problem, cannot exec
`/tmp/obj-x86-gcc34/gcc/cc1.exe': No such file or directory")
7. strace output:

   20   98793 [main] cc386 3512 proc_subproc: args: 4, 2677504
   18   98811 [main] cc386 3512 proc_subproc: wval->pid 2960, wval->options 0
   20   98831 [main] cc386 3512 checkstate: nprocs 1
   17   98848 [main] cc386 3512 stopped_or_terminated: considering pid 2960
   18   98866 [main] cc386 3512 checkstate: no matching terminated
children found
   16   98882 [main] cc386 3512 checkstate: returning -1
   18   98900 [main] cc386 3512 proc_subproc: only found non-terminated children
   16   98916 [main] cc386 3512 proc_subproc: finished processing
terminated/stopped child
   18   98934 [main] cc386 3512 proc_subproc: returning 1
14526  113310 [main] cc386 2960 wait_for_sigthread: process/signal
handling enabled, state 0x41
  201  113511 [main] cc386 2960 fork: 0 = fork()
   -1  113510 [sig] cc386 2960 wait_sig: entering ReadFile loop,
my_readsig 0x184, my_sendsig 0x188
  154  113664 [main] cc386 2960 spawnve: spawnve
(/usr/local/companytools/gcc34/x86/cc1.exe,
/usr/local/companytools/gcc34/x86/cc1.exe, 1042C9D8)
  362  114026 [main] cc386 2960 spawn_guts: spawn_guts (3,
/usr/local/companytools/gcc34/x86/cc1.exe)
  236  114262 [main] cc386 2960 perhaps_suffix: prog
'/usr/local/companytools/gcc34/x86/cc1.exe'
  169  114431 [main] cc386 2960 normalize_posix_path: src
/usr/local/companytools/gcc34/x86/cc1.exe
  162  114593 [main] cc386 2960 normalize_posix_path:
/usr/local/companytools/gcc34/x86/cc1.exe = normalize_posix_path
(/usr/local/companytools/gcc34/x86/cc1.exe)
  152  114745 [main] cc386 2960 mount_info::conv_to_win32_path:
conv_to_win32_path (/usr/local/companytools/gcc34/x86/cc1.exe)
  157  114902 [main] cc386 2960 set_flags: flags: binary (0x2)
--- Process 2960, exception C0000005 at 6110721F
  296  115198 [main] cc386 2960 exception::handle: In
cygwin_except_handler exc 0xC0000005 at 0x6110721F sp 0x28A2DC
  133  115331 [main] cc386 2960 exception::handle: In
cygwin_except_handler sig 11 at 0x6110721F
   90  115421 [main] cc386 2960 exception::handle: In
cygwin_except_handler calling 0x0
   32  115453 [main] cc386 2960 perhaps_suffix: buf (null), suffix
found '(null)'
   31  115484 [main] cc386 2960 __set_errno: int spawn_guts(const
char*, const char* const*, const char* const*, int, int, int):369 val
2
  126  115610 [main] cc386 2960 fhandler_tty_slave::write: tty0,
write(10429860, 5)
   21  115631 [main] cc386 2960 fhandler_tty_slave::write: (709): tty
output_mutex: waiting -1 ms
   19  115650 [main] cc386 2960 fhandler_tty_slave::write: (709): tty
output_mutex: acquired
   21  115671 [main] cc386 2960 fhandler_tty_slave::write: (752): tty
output_mutex released


8. The code that's failing is in gcc-3.4.6/libiberty/pex-unix.c

 int (*func)() = (flags & PEXECUTE_SEARCH ? execvp : execv);

 ... fork a child task ...

 (program is "/usr/local/companytools/gcc34/x86/cc1.exe")

     (*func) (program, argv);

     /* Should never reach here because have execv-ed program
        but it does. This does not mean that the child had a non-zero
        exit code, it means that the execv failed to work.
      */

     fprintf (stderr, "%s: ", this_pname);
     fprintf (stderr, install_error_msg, program);
     fprintf (stderr, " %s\n", errno, xstrerror (errno));
     exit (-1);

9. I have tried making a dummy program that's just a wrapper for the failing
  code and passing in all the same data as the failing case. And it
works. That really confuses me.

10. Have not yet tried a binary search of changed things. i.e. going
back to windows XP and installing cygwin 1.7.5-1 and seeing if that
works, then possibly going to Windows 7 *32-bit* with 1.7.5-1 and
seeing if that works. etc.

Cygcheck:
=======
(attached)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 201557 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20100506/850e151a/attachment.obj>
-------------- next part --------------
--
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


More information about the Cygwin mailing list