Hi all,

Copy of:

generator under Cygwin fails with: Fatal error: exception 
Unix.Unix_error(Unix.EAGAIN, "fork", "") · Issue #45 · libguestfs/libguestfs
https://github.com/libguestfs/libguestfs/issues/45

... since I realised late I shouldn't post on GitHub issues.


I managed to pass the configure stage in Cygwin on windows 10 with:

    CFLAGS=-fPIC ./autogen.sh --disable-daemon --disable-appliance 
--with-distro=cygwin

... (and installing relevant Cygwin libraries), with version:

```
user@PC /cygdrive/c/src/libguestfs_git
$ git log --oneline -1
088b6d1c8 (HEAD -> master, origin/master, origin/HEAD) get-kernel: fallback to 
uncompressed vmlinux kernels
```
The setup at end of configure is this:

```
Thank you for downloading libguestfs 1.42.0

This is how we have configured the optional components for you today:

Daemon .............................. no
Appliance ........................... no
QEMU ................................ /cygdrive/c/bin/qemu/qemu-system-x86_64
guestfish and C-based virt tools .... yes
FUSE filesystem ..................... yes
Default backend ..................... direct
GNU gettext for i18n ................ yes
OCaml bindings ...................... yes
OCaml-based virt tools .............. yes
Perl bindings ....................... no
Perl-based virt tools ............... no
Python bindings ..................... yes
Ruby bindings ....................... no
Java bindings ....................... no
Haskell bindings .................... no
PHP bindings ........................ no
Erlang bindings ..................... no
Lua bindings ........................ no
Go bindings ......................... no
gobject bindings .................... yes
gobject introspection ............... yes
Vala bindings ....................... no
bash completion ..................... yes
Rust bindings ....................... no
```


After that, `make` fails with the following error, which I managed to 
reconstruct like this:

```
user@PC /cygdrive/c/src/libguestfs_git
$ make -C generator clean
make: Entering directory '/cygdrive/c/src/libguestfs_git/generator'
test -z "*~ *.bak *.orig *.rej *.cmi *.cmo *.cma *.cmx *.cmxa dll*.so *.a 
*.annot oUnit-*.cache oUnit-*.log *.1 *.3 *.5 *.8 stamp-*.pod bindtests.tmp 
stamp-generator generator" || rm -f *~ *.bak *.orig *.rej *.cmi *.cmo *.cma 
*.cmx *.cmxa dll*.so *.a *.annot oUnit-*.cache oUnit-*.log *.1 *.3 *.5 *.8 
stamp-*.pod bindtests.tmp stamp-generator generator
rm -rf .libs _libs
rm -f *.lo
make: Leaving directory '/cygdrive/c/src/libguestfs_git/generator'

user@PC /cygdrive/c/src/libguestfs_git
$ make -C generator
make: Entering directory '/cygdrive/c/src/libguestfs_git/generator'
  OCAMLCMI types.cmi
  OCAMLC   types.cmo
  OCAMLCMI memoized_cache.cmi
  OCAMLC   memoized_cache.cmo
  OCAMLCMI utils.cmi
  OCAMLC   utils.cmo
  OCAMLCMI proc_nr.cmi
  OCAMLC   proc_nr.cmo
  OCAMLCMI actions_augeas.cmi
  OCAMLC   actions_augeas.cmo
  OCAMLCMI actions_core.cmi
  OCAMLC   actions_core.cmo
  OCAMLCMI actions_core_deprecated.cmi
  OCAMLC   actions_core_deprecated.cmo
  OCAMLCMI actions_debug.cmi
  OCAMLC   actions_debug.cmo
  OCAMLCMI actions_hivex.cmi
  OCAMLC   actions_hivex.cmo
  OCAMLCMI actions_hivex_deprecated.cmi
  OCAMLC   actions_hivex_deprecated.cmo
  OCAMLCMI actions_inspection.cmi
  OCAMLC   actions_inspection.cmo
  OCAMLCMI actions_inspection_deprecated.cmi
  OCAMLC   actions_inspection_deprecated.cmo
  OCAMLCMI actions_internal_tests.cmi
  OCAMLC   actions_internal_tests.cmo
  OCAMLCMI actions_properties.cmi
  OCAMLC   actions_properties.cmo
  OCAMLCMI actions_properties_deprecated.cmi
  OCAMLC   actions_properties_deprecated.cmo
  OCAMLCMI actions_tsk.cmi
  OCAMLC   actions_tsk.cmo
  OCAMLCMI actions_yara.cmi
  OCAMLC   actions_yara.cmo
  OCAMLCMI actions.cmi
  OCAMLC   actions.cmo
  OCAMLCMI structs.cmi
  OCAMLC   structs.cmo
  OCAMLCMI fish_commands.cmi
  OCAMLC   fish_commands.cmo
  OCAMLCMI optgroups.cmi
  OCAMLC   optgroups.cmo
  OCAMLCMI prepopts.cmi
  OCAMLC   prepopts.cmo
  OCAMLCMI events.cmi
  OCAMLC   events.cmo
  OCAMLCMI pr.cmi
  OCAMLC   pr.cmo
  OCAMLCMI docstrings.cmi
  OCAMLC   docstrings.cmo
  OCAMLCMI authors.cmi
  OCAMLC   authors.cmo
  OCAMLCMI checks.cmi
  OCAMLC   checks.cmo
  OCAMLCMI c.cmi
  OCAMLC   c.cmo
  OCAMLCMI XDR.cmi
  OCAMLC   XDR.cmo
  OCAMLCMI daemon.cmi
  OCAMLC   daemon.cmo
  OCAMLCMI tests_c_api.cmi
  OCAMLC   tests_c_api.cmo
  OCAMLCMI fish.cmi
  OCAMLC   fish.cmo
  OCAMLCMI OCaml.cmi
  OCAMLC   OCaml.cmo
  OCAMLCMI perl.cmi
  OCAMLC   perl.cmo
  OCAMLCMI python.cmi
  OCAMLC   python.cmo
  OCAMLCMI ruby.cmi
  OCAMLC   ruby.cmo
  OCAMLCMI java.cmi
  OCAMLC   java.cmo
  OCAMLCMI haskell.cmi
  OCAMLC   haskell.cmo
  OCAMLCMI csharp.cmi
  OCAMLC   csharp.cmo
  OCAMLCMI php.cmi
  OCAMLC   php.cmo
  OCAMLCMI erlang.cmi
  OCAMLC   erlang.cmo
  OCAMLCMI lua.cmi
  OCAMLC   lua.cmo
  OCAMLCMI GObject.cmi
  OCAMLC   GObject.cmo
  OCAMLCMI golang.cmi
  OCAMLC   golang.cmo
  OCAMLCMI rust.cmi
  OCAMLC   rust.cmo
  OCAMLCMI bindtests.cmi
  OCAMLC   bindtests.cmo
  OCAMLCMI errnostring.cmi
  OCAMLC   errnostring.cmo
  OCAMLCMI customize.cmi
  OCAMLC   customize.cmo
  OCAMLCMI UEFI.cmi
  OCAMLC   UEFI.cmo
  OCAMLCMI main.cmi
  OCAMLC   main.cmo
make -C ../common/mlstdutils mlstdutils.cma
make[1]: Entering directory '/cygdrive/c/src/libguestfs_git/common/mlstdutils'
make[1]: 'mlstdutils.cma' is up to date.
make[1]: Leaving directory '/cygdrive/c/src/libguestfs_git/common/mlstdutils'
ocamlfind ocamlc -g -annot -safe-string -warn-error CDEFLMPSUVYZX+52-3 -ccopt 
'-fPIC -fno-strict-overflow -Wno-strict-overflow' \
    -package unix,str -I . -I . -I ../common/mlstdutils -I ../common/mlstdutils 
-linkpkg mlstdutils.cma \
    types.cmo memoized_cache.cmo utils.cmo proc_nr.cmo actions_augeas.cmo 
actions_core.cmo actions_core_deprecated.cmo actions_debug.cmo 
actions_hivex.cmo actions_hivex_deprecated.cmo actions_inspection.cmo 
actions_inspection_deprecated.cmo actions_internal_tests.cmo 
actions_properties.cmo actions_properties_deprecated.cmo actions_tsk.cmo 
actions_yara.cmo actions.cmo structs.cmo fish_commands.cmo optgroups.cmo 
prepopts.cmo events.cmo pr.cmo docstrings.cmo authors.cmo checks.cmo c.cmo 
XDR.cmo daemon.cmo tests_c_api.cmo fish.cmo OCaml.cmo perl.cmo python.cmo 
ruby.cmo java.cmo haskell.cmo csharp.cmo php.cmo erlang.cmo lua.cmo GObject.cmo 
golang.cmo rust.cmo bindtests.cmo errnostring.cmo customize.cmo UEFI.cmo 
main.cmo -o generator
mkdir -p ../perl/lib/Sys
mkdir -p ../ruby/ext/guestfs
mkdir -p ../java/com/redhat/et/libguestfs
mkdir -p ../csharp
mkdir -p ../gobject/src
mkdir -p ../gobject/include
mkdir -p ../gobject/include/guestfs-gobject
cd .. && /cygdrive/c/src/libguestfs_git/generator/generator
      0 [main] generator 3260 dofork: child -1 - forked process 14884 died 
unexpectedly, retry 0, exit code 0xC0000142, errno 11
Fatal error: exception Unix.Unix_error(Unix.EAGAIN, "fork", "")
make: *** [Makefile:2244: stamp-generator] Error 2
make: Leaving directory '/cygdrive/c/src/libguestfs_git/generator'
```

For some reason, even if there is `-g` in `OCAML_FLAGS = -g -annot 
-safe-string`, also `ocamldebug` fails to reveal anything (although, 
admittedly, this is first time in my life I've ever run `ocamldebug`, or had 
anything to do with OCaml):

```
$ ocamldebug -cd generator generator
        OCaml Debugger version 4.04.2

(ocd) step
Loading program...       0 [main] ocamldebug 4271 dofork: child -1 - forked 
process 1276 died unexpectedly, retry 0, exit code 0xC0000142, errno 11
Unix error: 'fork' failed: Resource temporarily unavailable
(ocd) q
``` 

However, gdb reveals some threads are started before the crash:

```
$ gdb --args generator/generator
GNU gdb (GDB) (Cygwin 8.2.1-1) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from generator/generator...(no debugging symbols found)...done.
(gdb) r
Starting program: /cygdrive/d/src/libguestfs_git/generator/generator
[New Thread 3712.0x1b8c]
[New Thread 3712.0x2744]
[New Thread 3712.0x1b20]
[New Thread 3712.0x30d4]
[New Thread 3712.0x33b8]
      0 [main] generator 4275 dofork: child -1 - forked process 13456 died 
unexpectedly, retry 0, exit code 0xC0000142, errno 11
Fatal error: exception Unix.Unix_error(Unix.EAGAIN, "fork", "")
[Thread 3712.0x33b8 exited with code 2]
[Thread 3712.0x1b20 exited with code 2]
[Thread 3712.0x2744 exited with code 2]
[Inferior 1 (process 3712) exited with code 02]
(gdb) q
```

Any suggestions if I can get generator running on Cygwin?


_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to