revery-ui/revery

OSX High Sierra: esy bootstrap failing, `../boot/ocamlrun: Permission denied`

dropofwill opened this issue · 5 comments

Trying to build oni2 / revery-ui / revery-quick-start

System:

  • Operating System: OSX High Sierra (10.13.6)
  • Revery Version: #3c23304 (what quick start is pinned to currently)
  • OCaml version: ocaml-4.8.1000-426898cd (looks like what esy is pulling)
  • Native, Bytecode, or JS build: native
  • libtool version: 2.4.6_1
  • cclang version: 10.0.0 (clang-1000.10.44.4), from xcode command line tools

Link to github repo:

Steps to reproduce:

  • Delete ~/.esy and _esy
  • esy install
  • esy bootstrap

Actual Result:

error: build failed with exit code: 1
  build log:
    # esy-build-package: building: ocaml@4.8.1000
    # esy-build-package: pwd: /Users/wpaul/.esy/3/b/ocaml-4.8.1000-426898cd
    # esy-build-package: running: './esy-configure' '--disable-cfi' '--prefix' '/Users/wpaul/.esy/3___________________________________________________________________/s/ocaml-4.8.1000-426898cd'
    [esy-configure] Detected OSX / Linux environment
    configure: Configuring OCaml version 4.08.1
    checking build system type... x86_64-apple-darwin17.7.0
    checking host system type... x86_64-apple-darwin17.7.0
    checking target system type... x86_64-apple-darwin17.7.0
    checking for ld... ld
    checking how to print strings... printf
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking for a sed that does not truncate output... /usr/local/bin/gsed
    checking for grep that handles long lines and -e... /usr/bin/grep
    checking for egrep... /usr/bin/grep -E
    checking for fgrep... /usr/bin/grep -F
    checking for ld used by gcc... ld
    checking if the linker (ld) is GNU ld... no
    checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
    checking the name lister (/usr/bin/nm -B) interface... BSD nm
    checking whether ln -s works... yes
    checking the maximum length of command line arguments... 196608
    checking how to convert x86_64-apple-darwin17.7.0 file names to x86_64-apple-darwin17.7.0 format... func_convert_file_noop
    checking how to convert x86_64-apple-darwin17.7.0 file names to toolchain format... func_convert_file_noop
    checking for ld option to reload object files... -r
    checking for objdump... objdump
    checking how to recognize dependent libraries... pass_all
    checking for dlltool... no
    checking how to associate runtime and link libraries... printf %s\n
    checking for ar... ar
    checking for archiver @FILE support... no
    checking for strip... strip
    checking for ranlib... ranlib
    checking for gawk... gawk
    checking command to parse /usr/bin/nm -B output from gcc object... ok
    checking for sysroot... no
    checking for a working dd... /bin/dd
    checking how to truncate binary pipes... /bin/dd bs=4096 count=1
    checking for mt... no
    checking if : is a manifest tool... no
    checking for dsymutil... dsymutil
    checking for nmedit... nmedit
    checking for lipo... lipo
    checking for otool... otool
    checking for otool64... no
    checking for -single_module linker flag... yes
    checking for -exported_symbols_list linker flag... yes
    checking for -force_load linker flag... yes
    checking how to run the C preprocessor... gcc -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking for dlfcn.h... yes
    checking for objdir... .libs
    checking if gcc supports -fno-rtti -fno-exceptions... yes
    checking for gcc option to produce PIC... -fno-common -DPIC
    checking if gcc PIC flag -fno-common -DPIC works... yes
    checking if gcc static flag -static works... no
    checking if gcc supports -c -o file.o... yes
    checking if gcc supports -c -o file.o... (cached) yes
    checking whether the gcc linker (ld) supports shared libraries... yes
    checking dynamic linker characteristics... darwin17.7.0 dyld
    checking how to hardcode library paths into programs... immediate
    checking whether stripping libraries is possible... yes
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... yes
    checking whether to build static libraries... yes
    checking whether #! works in shell scripts... yes
    checking C compiler vendor... clang-10-0
    checking for a BSD-compatible install... /usr/local/bin/ginstall -c
    checking for cos in -lm... yes
    checking math.h usability... yes
    checking math.h presence... yes
    checking for math.h... yes
    checking for unistd.h... (cached) yes
    checking for stdint.h... (cached) yes
    checking sys/shm.h usability... yes
    checking sys/shm.h presence... yes
    checking for sys/shm.h... yes
    checking for dirent.h... yes
    checking for sys/select.h... yes
    checking for off_t... yes
    checking size of int... 4
    checking size of long... 8
    checking size of long *... 8
    checking size of short... 2
    checking size of long long... 8
    configure: Target is a 64 bits architecture
    checking whether byte ordering is bigendian... no
    checking alignment of double... 8
    checking alignment of long... 8
    checking whether the C compiler supports -fno-tree-vrp... no
    checking for ld... ld
    configure: checking semantics of signal handlers
    checking for sigaction... yes
    checking for sigprocmask... yes
    configure: POSIX signal handling found.
    checking for expm1... yes
    checking for log1p... yes
    checking for hypot... yes
    checking for fma... yes
    checking for copysign... yes
    checking for getrusage... yes
    checking for times... yes
    checking for secure_getenv... no
    checking for __secure_getenv... no
    checking for issetugid... yes
    checking for library containing clock_gettime... none required
    checking for socket... yes
    checking for socketpair... yes
    checking for bind... yes
    checking for listen... yes
    checking for accept... yes
    checking for connect... yes
    checking for socklen_t... yes
    checking for inet_aton... yes
    checking for struct sockaddr_in6... yes
    checking for getaddrinfo... yes
    checking for getnameinfo... yes
    checking for inet_pton... yes
    checking for inet_ntop... yes
    checking for rewinddir... yes
    checking for lockf... yes
    checking for mkfifo... yes
    checking for getcwd... yes
    checking for getpriority... yes
    checking for setpriority... yes
    checking for sys/types.h... (cached) yes
    checking utime.h usability... yes
    checking utime.h presence... yes
    checking for utime.h... yes
    checking for utime... yes
    checking for utimes... yes
    checking for dup2... yes
    checking for fchmod... yes
    checking for fchown... yes
    checking for truncate... yes
    checking for ftruncate... yes
    checking for select... yes
    checking for fd_set... yes
    checking for nanosleep... yes
    checking for symlink... yes
    checking for readlink... yes
    checking for lstat... yes
    checking for waitpid... yes
    checking for wait4... yes
    checking for getgroups... yes
    checking for setgroups... yes
    checking for initgroups... yes
    checking termios.h usability... yes
    checking termios.h presence... yes
    checking for termios.h... yes
    checking for tcgetattr... yes
    checking for tcsetattr... yes
    checking for tcsendbreak... yes
    checking for tcflush... yes
    checking for tcflow... yes
    checking for asynchronous I/O... yes
    checking for setitimer... yes
    checking for gethostname... yes
    checking sys/utsname.h usability... yes
    checking sys/utsname.h presence... yes
    checking for sys/utsname.h... yes
    checking for uname... yes
    checking for gettimeofday... yes
    checking for mktime... yes
    checking for setsid... yes
    checking for putenv... yes
    checking locale.h usability... yes
    checking locale.h presence... yes
    checking for locale.h... yes
    checking for newlocale... yes
    checking for freelocale... yes
    checking for uselocale... yes
    checking xlocale.h usability... yes
    checking xlocale.h presence... yes
    checking for xlocale.h... yes
    checking for newlocale... (cached) yes
    checking for freelocale... (cached) yes
    checking for uselocale... (cached) yes
    checking for strtod_l... yes
    checking for dlopen... yes
    configure: Dynamic loading of shared libraries is supported.
    checking sys/mman.h usability... yes
    checking sys/mman.h presence... yes
    checking for sys/mman.h... yes
    checking for mmap... yes
    checking for munmap... yes
    checking for pwrite... yes
    checking whether the C compiler supports -fdebug-prefix-map... yes
    checking for struct stat.st_atim.tv_nsec... no
    configure: stat supports nanosecond precision
    checking how many arguments gethostbyname_r() takes... cannot find function declaration in netdb.h
    checking how many arguments gethostbyaddr_r() takes... cannot find function declaration in netdb.h
    checking for mkstemp... yes
    checking for nice... yes
    checking for dup3... no
    checking for pipe2... no
    checking for accept4... no
    checking for getauxval... no
    checking for execvpe... no
    configure: replay debugger supported
    checking whether stack overflows can be detected... yes
    checking whether gcc is Clang... yes
    checking whether Clang needs flag to prevent "argument unused" warning when linking with -pthread... no
    checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
    checking whether more special flags are required for pthreads... no
    checking for PTHREAD_PRIO_INHERIT... yes
    configure: the POSIX threads library is supported
    checking for sigwait... yes
    configure: the bytecode threads library is supported
    checking for X... no
    configure: X has not been found
    configure: the graph library will not be built
    checking bfd.h usability... no
    checking bfd.h presence... no
    checking for bfd.h... no
    checking whether the assembler supports --debug-prefix-map... no
    checking whether the assembler supports CFI directives... disabled
    configure: not using frame pointers
    checking whether mmap supports huge pages... no
    checking whether to build spacetime... no
    configure: creating ./config.status
    config.status: creating Makefile.common
    config.status: creating Makefile.config
    config.status: creating runtime/caml/m.h
    config.status: creating runtime/caml/s.h
    config.status: executing libtool commands
    # esy-build-package: running: './esy-build'
    [esy-build] Detected OSX / Linux environment
    /Library/Developer/CommandLineTools/usr/bin/make -C runtime  all
....
a bunch more
....
    ../boot/ocamlrun ../boot/ocamlc -use-prims ../runtime/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48 -g -warn-error A -bin-annot -nostdlib -safe-string -strict-formats   -o stdlib__list.cmi -c list.mli
    make[1]: ../boot/ocamlrun: Permission denied
    make[1]: execvp: ./Compflags: Permission denied
    make[1]: *** [stdlib__list.cmi] Error 1
    make[1]: *** Waiting for unfinished jobs....
    make: *** [coldstart] Error 2
    error: command failed: './esy-build' (exited with 2)
    esy-build-package: exiting with errors above...

  building ocaml@4.8.1000
esy: exiting due to errors above

Expected Result:

No errors

Additional Information:

What I've tried so far:

  • Uninstall global node and switch to nvm to install/manage node, because I found this bucklescript issue that seemed similar
  • Reinstall esy
  • Was able to use ocamlrun as non-super user, based on logs from the makefile:
    ../boot/ocamlrun ../boot/ocamlc -use-prims ../runtime/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48 -g -warn-error A -bin-annot -nostdlib -safe-string -strict-formats -o stdlib__list.cmi -c list.mli
  • Was able to run the command one layer up in the stack as a non-super use:
    /Library/Developer/CommandLineTools/usr/bin/make -C stdlib \ ocaml-4.8.1000-426898cd COMPILER="../boot/ocamlc -use-prims ../runtime/primitives" all
  • Was able to run the top-level command that's failing in esy bootstrap:
    ./esy-configure --disable-cfi --prefix /Users/wpaul/.esy/3___________________________________________________________________/s/ocaml-4.8.1000-426898cd

Really confused at this point, any ideas?

Would it be possible to use an esy docker container for local dev?

Search terms used:

  • permissions denied, osx, ocamlrun, clang, esy, revery, ocaml, execvp
Et7f3 commented

Uhm it is really strange we are able to build on mac with github action and azures pipeline. Can you clone this branch https://github.com/esy-ocaml/ocaml/tree/4.8.1000+esy and just run: esy

Yep, just tried it, basically the same output.

...
/Library/Developer/CommandLineTools/usr/bin/make -C stdlib  \
	  COMPILER="../boot/ocamlc -use-prims ../runtime/primitives" all
../boot/ocamlrun ../boot/ocamlc -use-prims ../runtime/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48 -g -warn-error A -bin-annot -nostdlib -safe-string -strict-formats  -nopervasives -c camlinternalFormatBasics.mli
sed -e "s|%%VERSION%%|`sed -e 1q ../VERSION | tr -d '\r'`|" sys.mlp > sys.ml
for suff in '' d i; do \
	  echo '#!/Users/wpaul/Code/ocaml/_esy/default/store/s/ocaml-ad006b46/bin/ocamlrun'$suff > camlheader$suff && \
	  echo '#!/Users/wpaul/Code/ocaml/_esy/default/store/s/ocaml-ad006b46/bin/ocamlrun'$suff >target_camlheader$suff; \
	done && \
	echo '#!' | tr -d '\012' > camlheader_ur;
for suff in '' d i; do \
	  echo '#!/Users/wpaul/Code/ocaml/_esy/default/store/s/ocaml-ad006b46/bin/ocamlrun'$suff > camlheader$suff && \
	  echo '#!/Users/wpaul/Code/ocaml/_esy/default/store/s/ocaml-ad006b46/bin/ocamlrun'$suff >target_camlheader$suff; \
	done && \
	echo '#!' | tr -d '\012' > camlheader_ur;
for suff in '' d i; do \
	  echo '#!/Users/wpaul/Code/ocaml/_esy/default/store/s/ocaml-ad006b46/bin/ocamlrun'$suff > camlheader$suff && \
	  echo '#!/Users/wpaul/Code/ocaml/_esy/default/store/s/ocaml-ad006b46/bin/ocamlrun'$suff >target_camlheader$suff; \
	done && \
	echo '#!' | tr -d '\012' > camlheader_ur;
../boot/ocamlrun ../boot/ocamlc -use-prims ../runtime/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48 -g -warn-error A -bin-annot -nostdlib -safe-string -strict-formats  -nopervasives -c camlinternalFormatBasics.ml
../boot/ocamlrun ../boot/ocamlc -use-prims ../runtime/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48 -g -warn-error A -bin-annot -nostdlib -safe-string -strict-formats  -nopervasives -no-alias-deps -w -49  -pp "$AWK -f expand_module_aliases.awk" -c stdlib.mli
../boot/ocamlrun ../boot/ocamlc -use-prims ../runtime/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48 -g -warn-error A -bin-annot -nostdlib -safe-string -strict-formats  -nopervasives -no-alias-deps -w -49  -pp "$AWK -f expand_module_aliases.awk" -c stdlib.ml
../boot/ocamlrun ../boot/ocamlc -use-prims ../runtime/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48 -g -warn-error A -bin-annot -nostdlib -safe-string -strict-formats   -o stdlib__pervasives.cmo -c pervasives.ml
../boot/ocamlrun ../boot/ocamlc -use-prims ../runtime/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48 -g -warn-error A -bin-annot -nostdlib -safe-string -strict-formats   -o stdlib__seq.cmi -c seq.mli
../boot/ocamlrun ../boot/ocamlc -use-prims ../runtime/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48 -g -warn-error A -bin-annot -nostdlib -safe-string -strict-formats   -o stdlib__bool.cmi -c bool.mli
../boot/ocamlrun ../boot/ocamlc -use-prims ../runtime/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48 -g -warn-error A -bin-annot -nostdlib -safe-string -strict-formats   -o stdlib__char.cmi -c char.mli
make[1]: ../boot/ocamlrun: Permission denied
make[1]: execvp: ./Compflags: Permission denied
make[1]: *** [stdlib__char.cmi] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [coldstart] Error 2
error: command failed: './esy-build' (exited with 2)
esy-build-package: exiting with errors above...
error: build failed with exit code: 1

esy: exiting due to errors above

Manually tried these, in the ~/.esy/ dir for ocaml 4.8.100:

./esy-configure
./esy-build

Configure succeeded, but build failed with the same output.

Tried building just the stdlib, which seems to be what's failing if I'm understanding the script output (not to sure, don't know make/c very well):

/Library/Developer/CommandLineTools/usr/bin/make -C stdlib  \
	  COMPILER="../boot/ocamlc -use-prims ../runtime/primitives" all

And that succeeded, with this as the last output:

../boot/ocamlrun ../boot/ocamlc -use-prims ../runtime/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48 -g -warn-error A -bin-annot -nostdlib -safe-string -strict-formats   -c std_exit.ml
for suff in '' d i; do \
	  echo '#!/usr/local/bin/ocamlrun'$suff > camlheader$suff && \
	  echo '#!/usr/local/bin/ocamlrun'$suff >target_camlheader$suff; \
	done && \
	echo '#!' | tr -d '\012' > camlheader_ur;

So maybe it's what follows that which is failing?

Et7f3 commented

So it is not revery that fail but before. I have showed the ocaml version with some patch for windows. Can you try to build this of upstream ocaml https://github.com/ocaml/ocaml/tree/4.08: ./configure; make world.opt if it doesn't then you have a very strange config.

Yep, seems like it is definitely not a Revery issue, thanks for the help though!

Both esy-ocaml and ocaml org ocamls work with ./configure; make world.opt. I then ran make tests and those passed.

Looking at ./esy-build it also runs make install, I tried that and got permission denied. Looking at INSTALL.adoc it says to run make install as super user, which esy-build is not doing.

Running sudo make install I got a working ocaml repl in my path, but maybe that's not what esy is trying to do...

For anyone from Google, I did figure this out.

Basically, for whatever reason parallel builds were the problem on my system.

Figured it out by trying to install ocaml with opam, which gave the same errors as with esy, but also included the helpful:

=> A failure in the middle of the build may be caused by build parallelism
      (enabled by default).
      Please file a bug report at https://github.com/ocaml/ocaml/issues
=> You can try installing again including --jobs=1
      to force a sequential build instead.

Following that worked. So I went back to the esy errors, saw they originated from esy-build, so I edited that to pass -j=1 to make world. And that got ocaml installed with esy.

Then I had some python errors with compiling skia, but that was because I had a screwed up Python environment, which was fixed by running a brew reinstall.