aantron/dream

Can't build Quick Start locally in MacOS Ventura 13.3.1

Closed this issue · 7 comments

The QuickStart section on the https://github.com/aantron/dream page ways to run

bash -c "$(curl -fsSL https://raw.githubusercontent.com/aantron/dream/master/example/quickstart.sh)"

But I get the following errors when I attempt to do that.

➜ dream bash -c "$(curl -fsSL https://raw.githubusercontent.com/aantron/dream/master/example/quickstart.sh)"

\e[0m✅ Creating example directory ./2-middleware\e[0m

💲 mkdir 2-middleware

\e[0m✅ Fetching example files with git\e[0m
\e[0m Source: https://github.com/aantron/dream/tree/master/example/2-middleware#files\e[0m

\e[0m✅ Installing esy in ./2-middleware\e[0m
\e[0m esy (https://esy.sh/) is an npm-like package manager for native code\e[0m

💲 npm install esy

\e[0m✅ Building and installing native dependencies in ./2-middleware\e[0m
\e[0m This can take a few minutes the first time\e[0m

💲 npx esy
info esy 0.6.12 (using esy.json)
info checking https://github.com/ocaml/opam-repository for updates...
info checking https://github.com/esy-ocaml/esy-opam-override for updates...
info resolving esy packages: done
info solving esy constraints: done
info resolving npm packages: done
info fetching: done
info installing: done
info building ocaml@4.12.1001@d41d8cd9
error: build failed with exit code: 1
build log:
# esy-build-package: building: ocaml@4.12.1001
# esy-build-package: pwd: /Users/garyrob/.esy/3/b/ocaml-4.12.1001-00b0534a
# esy-build-package: running: './esy-configure' '--prefix' '/Users/garyrob/.esy/3________________________________________________________________/s/ocaml-4.12.1001-00b0534a'
[esy-configure] Detected OSX / Linux environment
configure: Configuring OCaml version 4.12.2+dev0-2021-09-23
checking build system type... x86_64-apple-darwin22.4.0
checking host system type... x86_64-apple-darwin22.4.0
checking target system type... x86_64-apple-darwin22.4.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/bin/sed
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... 786432
checking how to convert x86_64-apple-darwin22.4.0 file names to x86_64-apple-darwin22.4.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin22.4.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... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
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... darwin22.4.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 C compiler vendor... clang-14-0
checking whether #! works in shell scripts... yes
checking for a BSD-compatible install... /usr/bin/install -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 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 alignment of long long... 8
checking whether the C compiler supports -fno-tree-vrp... no
checking whether the C compiler supports attribute((aligned(n)))... yes
checking whether the C compiler supports attribute((optimize("tree-vectorize")))... no
checking for ld... ld
checking for as... as
checking for rlwrap... no
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 mach_timebase_info... yes
checking for mach_absolute_time... yes
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 whether system is declared... 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 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 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 for setenv... yes
checking for unsetenv... 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... can't tell
checking how many arguments gethostbyaddr_r() takes... can't tell
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 sys/shm.h usability... yes
checking sys/shm.h presence... yes
checking for sys/shm.h... yes
checking for shmat... yes
checking for execvpe... no
checking spawn.h usability... yes
checking spawn.h presence... yes
checking for spawn.h... yes
checking for posix_spawn... yes
checking for posix_spawnp... yes
checking for ffs... yes
checking for BitScanForward... 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
checking whether the assembler supports --debug-prefix-map... no
checking whether the assembler supports CFI directives... yes
configure: not using frame pointers
checking whether mmap supports huge pages... no
configure: No support for function sections on x86_64-apple-darwin22.4.0.
configure: Disabling function sections.
configure: creating ./config.status
config.status: creating Makefile.build_config
config.status: creating Makefile.config
config.status: creating tools/eventlog_metadata
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
/Applications/Xcode.app/Contents/Developer/usr/bin/make coldstart
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C runtime all
echo "/Users/garyrob/.esy/3
_____________________________________________________________/s/ocaml-4.12.1001-00b0534a/lib/ocaml/stublibs" > ld.conf
tr -d '\r' < caml/instruct.h |
sed -e '//*/d'
-e '/^#/d'
-e 's/enum /static char * names_of_/'
-e 's/{$/[] = {/'
-e 's/([[:upper:]][[:upper:]_0-9]
)/"\1"/g' > caml/opnames.h
../tools/make-version-header.sh ../VERSION > caml/version.h
tr -d '\r' < caml/instruct.h |
sed -n -e '/^ /s/ ([A-Z])/ &&lbl_\1/gp'
-e '/^}/q' > caml/jumptbl.h
echo "/Users/garyrob/.esy/3________________________________________________________________/s/ocaml-4.12.1001-00b0534a/lib/ocaml" >> ld.conf
cp primitives.new primitives
(echo '#define CAML_INTERNALS';
echo '#include "caml/mlvalues.h"';
echo '#include "caml/prims.h"';
sed -e 's/./extern value &();/' primitives;
echo 'c_primitive caml_builtin_cprim[] = {';
sed -e 's/.
/ &,/' primitives;
echo ' 0 };';
echo 'char * caml_names_of_builtin_cprim[] = {';
sed -e 's/.*/ "&",/' primitives;
echo ' 0 };') > prims.c
gcc -c -O2 -fno-strict-aliasing -fwrapv -Wall -Wdeclaration-after-statement -Werror -fno-common -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE -DCAMLDLLIMPORT=
-o prims.o prims.c
prims.c:158:14: error: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
extern value caml_get_public_method();
^
prims.c:338:14: error: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
extern value caml_set_oo_id();
^
2 errors generated.
make[2]: *** [prims.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [coldstart] Error 2
make: *** [world.opt] Error 2
error: command failed: './esy-build' (exited with 2)
esy-build-package: exiting with errors above...

building ocaml@4.12.1001
esy: exiting due to errors above

This looks like probably an instance of ocaml/ocaml#11759 upstream in the compiler. I am upgrading the compiler version in the examples right now locally (#256) to see if this has been fixed since OCaml 4.12 (a somewhat old version that the examples are using). I'll get back soon with some instructions to try or more information. Thanks!

I've uploaded a branch that upgrades the examples' dependencies as far as I think can be done right now, given esy/esy#1456. Can you try with the following commands? This should use OCaml 4.14.0, which should have most of the same bugfixes as OCaml 5.0.0, the most recent version.

git clone https://github.com/aantron/dream.git --recursive --branch examples-upgrade-ocaml-compiler
cd dream/example/2-middleware
npm install esy
npx esy
npx esy start

That works! Many thanks for addressing this so quickly. It gives me good vibes about using this framework. :)

[I had a question here that I answered for myself. I was wondering how what you're doing related to opam, but I see esy is an alternative to that.]

I have the same problem as before when I try to run the h-sql example, so I'm guessing that you've only addressed 2-middleware so far. Looking forward to everything being updated.

Great, thanks for checking that!

I actually already updated all the examples in master to use 4.14.0 with esy (EDIT: wrong link was here yesterday), so if you do a fresh checkout or a pull, they should all be working (or at least, not failing with this error!). Hope that helps!

I'm going to close this issue, as I think and hope it is solved. Feel free to reopen if I'm wrong, or open additional issues for whatever else might happen :) Thanks again!

Oops, put the wrong link in the comment above. It should have been f0cde12.

Thank you!!