grain-lang / grain

The Grain compiler toolchain and CLI. Home of the modern web staple. 🌾
https://grain-lang.org/
GNU Lesser General Public License v3.0
3.28k stars 115 forks source link

grain compile very slow #648

Closed loveencounterflow closed 2 years ago

loveencounterflow commented 3 years ago

On Linux Mint, I installed grain using the command line from the docs which got me grain 0.3.1. When I run grain demo.gr or grain compile demo.gr with a file containing only print("helo world"), some *.wasm files are produced under target/, but then the executable is seemingly stuck and does not print anything to the terminal. silent for around 10 minutes or so and only then prints out the message; re-running the same command on an unchanged file still takes almost a minute. Is this to be expected?

marcusroberts commented 3 years ago

The current binary downloads do unfortunately run slowly, as they are a packaged node application with the compiler compiled from OCaml to Javascript (using JS_of_OCaml). It will take a long time on the first run as it is compiling the standard library modules (and is also running as a JS app).

If you are able to compile the source code, it will take a while as it needs the OCaml compiler and toolchain, but after that you should find compiles are pretty fast.

loveencounterflow commented 3 years ago

Thanks for your consideration!

So I did

pnpm install -g yarn esy
git clone git://github.com/grain-lang/grain path/to/grain
cd path/to/grain
yarn compiler build

which ran for like 30 mintues but then stopped with error:

info building @opam/js_of_ocaml-ppx@opam:3.9.0@8454b2f9: done
info building @grain/binaryen.ml@github:grain-lang/binaryen.ml#867de62ec6a8a6540151e49b4b83bc41f139cc6c@d41d8cd9
info building @grain/binaryen.ml@github:grain-lang/binaryen.ml#867de62ec6a8a6540151e49b4b83bc41f139cc6c@d41d8cd9: done
Done: 1444/1989 (jobs: 2)File "_none_", line 1:
Warning 58: no cmx file was found in path for module Dyp, and its interface was not compiled with -opaque
Done: 1632/1989 (jobs: 4)File "_none_", line 1:
Warning 58: no cmx file was found in path for module Dyp, and its interface was not compiled with -opaque
Done: 1997/2006 (jobs: 3)/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(binaryen-c.cpp.o): In function `wasm::Wasm2JSBuilder::processFunctionBody(wasm::Module*, wasm::Function*, bool)::ExpressionProcessor::visitConst(wasm::Const*)':
binaryen-c.cpp:(.text+0x28681): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(binaryen-c.cpp.o): In function `std::_Sp_counted_ptr_inplace<wasm::GCData, std::allocator<wasm::GCData>, (__gnu_cxx::_Lock_policy)2>::_M_get_deleter(std::type_info const&)':
binaryen-c.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN4wasm6GCDataESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info[_ZNSt23_Sp_counted_ptr_inplaceIN4wasm6GCDataESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info]+0x1f): undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info const&)'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(LocalCSE.cpp.o): In function `std::_Sp_counted_ptr_inplace<std::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> >, std::allocator<std::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> > >, (__gnu_cxx::_Lock_policy)2>::_M_get_deleter(std::type_info const&)':
LocalCSE.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceISt3setIjSt4lessIjESaIjEESaIS4_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info[_ZNSt23_Sp_counted_ptr_inplaceISt3setIjSt4lessIjESaIjEESaIS4_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info]+0x1f): undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info const&)'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(ReReloop.cpp.o): In function `std::_Sp_counted_ptr_inplace<wasm::ReReloop::BlockTask, std::allocator<wasm::ReReloop::BlockTask>, (__gnu_cxx::_Lock_policy)2>::_M_get_deleter(std::type_info const&)':
ReReloop.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN4wasm8ReReloop9BlockTaskESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info[_ZNSt23_Sp_counted_ptr_inplaceIN4wasm8ReReloop9BlockTaskESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info]+0x1f): undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info const&)'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(ReReloop.cpp.o): In function `std::_Sp_counted_ptr_inplace<wasm::ReReloop::TriageTask, std::allocator<wasm::ReReloop::TriageTask>, (__gnu_cxx::_Lock_policy)2>::_M_get_deleter(std::type_info const&)':
ReReloop.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN4wasm8ReReloop10TriageTaskESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info[_ZNSt23_Sp_counted_ptr_inplaceIN4wasm8ReReloop10TriageTaskESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info]+0x1f): undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info const&)'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(ReReloop.cpp.o): In function `std::_Sp_counted_ptr_inplace<wasm::ReReloop::IfTask, std::allocator<wasm::ReReloop::IfTask>, (__gnu_cxx::_Lock_policy)2>::_M_get_deleter(std::type_info const&)':
ReReloop.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN4wasm8ReReloop6IfTaskESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info[_ZNSt23_Sp_counted_ptr_inplaceIN4wasm8ReReloop6IfTaskESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info]+0x1f): undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info const&)'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(wasm-validator.cpp.o): In function `wasm::FunctionValidator::validateAlignment(unsigned long, wasm::Type, unsigned int, bool, wasm::Expression*)':
wasm-validator.cpp:(.text+0xd879): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(wasm-validator.cpp.o): In function `wasm::validateMemory(wasm::Module&, wasm::ValidationInfo&)':
wasm-validator.cpp:(.text+0x14585): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(wasm-validator.cpp.o): In function `wasm::validateExports(wasm::Module&, wasm::ValidationInfo&)':
wasm-validator.cpp:(.text+0x17a09): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
wasm-validator.cpp:(.text+0x17ba1): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(wasm-validator.cpp.o): In function `wasm::WasmValidator::validate(wasm::Module&, unsigned int)':
wasm-validator.cpp:(.text+0x1a895): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(wasm-validator.cpp.o):wasm-validator.cpp:(.text+0x1aa05): more undefined references to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()' follow
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking (exit code 1)
Done: 1997/2006 (jobs: 2)/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(binaryen-c.cpp.o): In function `wasm::Wasm2JSBuilder::processFunctionBody(wasm::Module*, wasm::Function*, bool)::ExpressionProcessor::visitConst(wasm::Const*)':
binaryen-c.cpp:(.text+0x28681): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(binaryen-c.cpp.o): In function `std::_Sp_counted_ptr_inplace<wasm::GCData, std::allocator<wasm::GCData>, (__gnu_cxx::_Lock_policy)2>::_M_get_deleter(std::type_info const&)':
binaryen-c.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN4wasm6GCDataESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info[_ZNSt23_Sp_counted_ptr_inplaceIN4wasm6GCDataESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info]+0x1f): undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info const&)'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(LocalCSE.cpp.o): In function `std::_Sp_counted_ptr_inplace<std::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> >, std::allocator<std::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int> > >, (__gnu_cxx::_Lock_policy)2>::_M_get_deleter(std::type_info const&)':
LocalCSE.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceISt3setIjSt4lessIjESaIjEESaIS4_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info[_ZNSt23_Sp_counted_ptr_inplaceISt3setIjSt4lessIjESaIjEESaIS4_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info]+0x1f): undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info const&)'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(ReReloop.cpp.o): In function `std::_Sp_counted_ptr_inplace<wasm::ReReloop::BlockTask, std::allocator<wasm::ReReloop::BlockTask>, (__gnu_cxx::_Lock_policy)2>::_M_get_deleter(std::type_info const&)':
ReReloop.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN4wasm8ReReloop9BlockTaskESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info[_ZNSt23_Sp_counted_ptr_inplaceIN4wasm8ReReloop9BlockTaskESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info]+0x1f): undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info const&)'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(ReReloop.cpp.o): In function `std::_Sp_counted_ptr_inplace<wasm::ReReloop::TriageTask, std::allocator<wasm::ReReloop::TriageTask>, (__gnu_cxx::_Lock_policy)2>::_M_get_deleter(std::type_info const&)':
ReReloop.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN4wasm8ReReloop10TriageTaskESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info[_ZNSt23_Sp_counted_ptr_inplaceIN4wasm8ReReloop10TriageTaskESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info]+0x1f): undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info const&)'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(ReReloop.cpp.o): In function `std::_Sp_counted_ptr_inplace<wasm::ReReloop::IfTask, std::allocator<wasm::ReReloop::IfTask>, (__gnu_cxx::_Lock_policy)2>::_M_get_deleter(std::type_info const&)':
ReReloop.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN4wasm8ReReloop6IfTaskESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info[_ZNSt23_Sp_counted_ptr_inplaceIN4wasm8ReReloop6IfTaskESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info]+0x1f): undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info const&)'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(wasm-validator.cpp.o): In function `wasm::FunctionValidator::validateAlignment(unsigned long, wasm::Type, unsigned int, bool, wasm::Expression*)':
wasm-validator.cpp:(.text+0xd879): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(wasm-validator.cpp.o): In function `wasm::validateMemory(wasm::Module&, wasm::ValidationInfo&)':
wasm-validator.cpp:(.text+0x14585): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(wasm-validator.cpp.o): In function `wasm::validateExports(wasm::Module&, wasm::ValidationInfo&)':
wasm-validator.cpp:(.text+0x17a09): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
wasm-validator.cpp:(.text+0x17ba1): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(wasm-validator.cpp.o): In function `wasm::WasmValidator::validate(wasm::Module&, unsigned int)':
wasm-validator.cpp:(.text+0x1a895): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
/home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/libbinaryen.a(wasm-validator.cpp.o):wasm-validator.cpp:(.text+0x1aa05): more undefined references to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()' follow
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking (exit code 1)
    ocamlopt grainc/grainc.exe (exit 2)
(cd /home/flow/3rdparty/grain/compiler/_esy/default/store/b/grain__s__compiler-229a94fc/default && /home/flow/.esy/3____________________________________________________________________/i/ocaml-4.11.0-d9345c86/bin/ocamlopt.opt -w -40 -g -o grainc/grainc.exe /home/flow/.esy/3____________________________________________________________________/i/opam__s__cmdliner-opam__c__1.0.4-3f37cf75/lib/cmdliner/cmdliner.cmxa /home/flow/.esy/3____________________________________________________________________/i/ocaml-4.11.0-d9345c86/lib/ocaml/compiler-libs/ocamlcommon.cmxa /home/flow/.esy/3____________________________________________________________________/i/ocaml-4.11.0-d9345c86/lib/ocaml/unix.cmxa -I /home/flow/.esy/3____________________________________________________________________/i/ocaml-4.11.0-d9345c86/lib/ocaml /home/flow/.esy/3____________________________________________________________________/i/opam__s__grain__dypgen-opam__c__0.2-e081fd83/lib/dyp/dyp.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__fp-2a077e5a/lib/fp/Fp.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__fs-90133b1b/lib/fs/lib/Fs.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__sexplib0-opam__c__v0.14.0-12eabf76/lib/sexplib0/sexplib0.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__ppx__sexp__conv-opam__c__v0.14.3-beb41b29/lib/ppx_sexp_conv/runtime-lib/ppx_sexp_conv_lib.cmxa /home/flow/.esy/3____________________________________________________________________/i/ocaml-4.11.0-d9345c86/lib/ocaml/bigarray.cmxa -I /home/flow/.esy/3____________________________________________________________________/i/ocaml-4.11.0-d9345c86/lib/ocaml /home/flow/.esy/3____________________________________________________________________/i/opam__s__base-opam__c__v0.14.1-c18f4cd0/lib/base/caml/caml.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__parsexp-opam__c__v0.14.0-40d9f036/lib/parsexp/parsexp.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__sexplib-opam__c__v0.14.0-e9eff544/lib/sexplib/sexplib.cmxa /home/flow/.esy/3____________________________________________________________________/i/ocaml-4.11.0-d9345c86/lib/ocaml/str.cmxa -I /home/flow/.esy/3____________________________________________________________________/i/ocaml-4.11.0-d9345c86/lib/ocaml src/utils/grain_utils.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__utf8-4f0960a2/lib/utf8/lib/Utf8.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__result-opam__c__1.5-d07a1751/lib/result/result.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__ppx__deriving-opam__c__5.2.1-ab97d8bd/lib/ppx_deriving/runtime/ppx_deriving_runtime.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__ppx__deriving__yojson-opam__c__3.6.1-70c1ea9b/lib/ppx_deriving_yojson/runtime/ppx_deriving_yojson_runtime.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__easy_format-opam__c__1.3.2-d0afe9ee/lib/easy-format/easy_format.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__biniou-opam__c__1.2.1-5b33fe19/lib/biniou/biniou.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__yojson-opam__c__1.7.0-7403d575/lib/yojson/yojson.cmxa src/parsing/grain_parsing.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__stdlib_shims-opam__c__0.3.0-fc2932a9/lib/stdlib-shims/stdlib_shims.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__ocamlgraph-opam__c__2.0.0-155c2922/lib/ocamlgraph/graph.cmxa src/typed/grain_typed.cmxa src/middle_end/grain_middle_end.cmxa /home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/binaryen_native.cmxa -I /home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native src/codegen/grain_codegen.cmxa src/linking/grain_linking.cmxa src/diagnostics/grain_diagnostics.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__ounit2-opam__c__2.2.4-a192138f/lib/ounit2/advanced/oUnitAdvanced.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__ounit2-opam__c__2.2.4-a192138f/lib/ounit2/oUnit.cmxa src/grain.cmxa grainc/.grainc.eobjs/native/build_info__Build_info_data.cmx /home/flow/.esy/3____________________________________________________________________/i/opam__s__dune_build_info-opam__c__2.8.5-a0763526/lib/dune-build-info/build_info.cmxa grainc/.grainc.eobjs/native/dune__exe__Grainc.cmx)
    ocamlopt test/test.exe (exit 2)
(cd /home/flow/3rdparty/grain/compiler/_esy/default/store/b/grain__s__compiler-229a94fc/default && /home/flow/.esy/3____________________________________________________________________/i/ocaml-4.11.0-d9345c86/bin/ocamlopt.opt -w -40 -g -o test/test.exe /home/flow/.esy/3____________________________________________________________________/i/opam__s__cmdliner-opam__c__1.0.4-3f37cf75/lib/cmdliner/cmdliner.cmxa /home/flow/.esy/3____________________________________________________________________/i/ocaml-4.11.0-d9345c86/lib/ocaml/compiler-libs/ocamlcommon.cmxa /home/flow/.esy/3____________________________________________________________________/i/ocaml-4.11.0-d9345c86/lib/ocaml/unix.cmxa -I /home/flow/.esy/3____________________________________________________________________/i/ocaml-4.11.0-d9345c86/lib/ocaml /home/flow/.esy/3____________________________________________________________________/i/opam__s__grain__dypgen-opam__c__0.2-e081fd83/lib/dyp/dyp.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__fp-2a077e5a/lib/fp/Fp.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__fs-90133b1b/lib/fs/lib/Fs.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__sexplib0-opam__c__v0.14.0-12eabf76/lib/sexplib0/sexplib0.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__ppx__sexp__conv-opam__c__v0.14.3-beb41b29/lib/ppx_sexp_conv/runtime-lib/ppx_sexp_conv_lib.cmxa /home/flow/.esy/3____________________________________________________________________/i/ocaml-4.11.0-d9345c86/lib/ocaml/bigarray.cmxa -I /home/flow/.esy/3____________________________________________________________________/i/ocaml-4.11.0-d9345c86/lib/ocaml /home/flow/.esy/3____________________________________________________________________/i/opam__s__base-opam__c__v0.14.1-c18f4cd0/lib/base/caml/caml.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__parsexp-opam__c__v0.14.0-40d9f036/lib/parsexp/parsexp.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__sexplib-opam__c__v0.14.0-e9eff544/lib/sexplib/sexplib.cmxa /home/flow/.esy/3____________________________________________________________________/i/ocaml-4.11.0-d9345c86/lib/ocaml/str.cmxa -I /home/flow/.esy/3____________________________________________________________________/i/ocaml-4.11.0-d9345c86/lib/ocaml src/utils/grain_utils.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__utf8-4f0960a2/lib/utf8/lib/Utf8.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__result-opam__c__1.5-d07a1751/lib/result/result.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__ppx__deriving-opam__c__5.2.1-ab97d8bd/lib/ppx_deriving/runtime/ppx_deriving_runtime.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__ppx__deriving__yojson-opam__c__3.6.1-70c1ea9b/lib/ppx_deriving_yojson/runtime/ppx_deriving_yojson_runtime.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__easy_format-opam__c__1.3.2-d0afe9ee/lib/easy-format/easy_format.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__biniou-opam__c__1.2.1-5b33fe19/lib/biniou/biniou.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__yojson-opam__c__1.7.0-7403d575/lib/yojson/yojson.cmxa src/parsing/grain_parsing.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__stdlib_shims-opam__c__0.3.0-fc2932a9/lib/stdlib-shims/stdlib_shims.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__ocamlgraph-opam__c__2.0.0-155c2922/lib/ocamlgraph/graph.cmxa src/typed/grain_typed.cmxa src/middle_end/grain_middle_end.cmxa /home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native/binaryen_native.cmxa -I /home/flow/.esy/3____________________________________________________________________/i/grain__s__binaryen.ml-4aef2547/lib/binaryen/native src/codegen/grain_codegen.cm
xa src/linking/grain_linking.cmxa src/diagnostics/grain_diagnostics.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__ounit2-opam__c__2.2.4-a192138f/lib/ounit2/advanced/oUnitAdvanced.cmxa /home/flow/.esy/3____________________________________________________________________/i/opam__s__ounit2-opam__c__2.2.4-a192138f/lib/ounit2/oUnit.cmxa src/grain.cmxa test/.test.eobjs/native/dune__exe.cmx test/.test.eobjs/native/dune__exe__Runner.cmx test/.test.eobjs/native/dune__exe__Test_concatlist.cmx test/.test.eobjs/native/dune__exe__Test_end_to_end.cmx test/.test.eobjs/native/dune__exe__Test_wasm_utils.cmx test/.test.eobjs/native/dune__exe__Test.cmx)
error: command failed: 'dune' 'build' '--no-buffer' (exited with 1)
esy-build-package: exiting with errors above...
error: build failed with exit code: 1

esy: exiting due to errors above
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /usr/local/bin/node
Arguments: /home/flow/pnpm-global/5/node_modules/.pnpm/yarn@1.22.10/node_modules/yarn/lib/cli.js run build
Directory: /home/flow/3rdparty/grain/compiler
Output:

info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

... which is unfortunate. Any ideas what went wrong? It looks like

error: command failed: 'dune' 'build' '--no-buffer' (exited with 1)

is what caused the error. Now I don't have a dune executable in the path and it cannot possibly refer to https://www.npmjs.com/package/dune, so it's not like another pnpm install -g would fix that issue...

marcusroberts commented 3 years ago

I don't have an immediate answer, but those errors seem to be related to an different versions of C++11, typically seen when different components are compiled with different versions of GCC, typically a library compiled with an earlier version linking to a program compiled with a later version.

loveencounterflow commented 3 years ago

In that case, how could I find out about the required or conflicting versions?

marcusroberts commented 3 years ago

That's the hard part :(. Can I check though, which version of node are you running?

loveencounterflow commented 3 years ago

My Node version is 15.12.0

marcusroberts commented 3 years ago

I can't guarantee this will help, but node 14 is the version we recommend. If you use NVM you could switch to 14 to see if that helps?

loveencounterflow commented 3 years ago

OK hang on, it'll take some time again...

Update Nope, didn't work with node 14.16.1. This time around yarn compiler build took only 13s so it obviously re-used stuff from the previous build which could have introduced errors. The error message looks just the same as above.

marcusroberts commented 3 years ago

The compile being that fast is worrying. The reason we put out the binaries is although they are slow they let us avoid these compile time warnings. I'll ping the rest of the team as I think we include some binaries in the source build too for some of the build tools and this may be where the issue is. You may want (if you're feeling brave) to clear out the previously built artifacts such as node_modules and your esy cache.

I'm going to get Linux Mint set up in a VM to see if I could reproduce the issue - what version are you running?

marcusroberts commented 3 years ago

This looks similar to #569

loveencounterflow commented 3 years ago

The compile being that fast is worrying. [...] clear out the previously built artifacts such as node_modules and your esy cache.

My thinking exactly, so I went and re-installed yarn and esy and also trashed ~/.esy (after doing some searching for artifacts). The compile time is now down to 17 minutes from 30, which might mean I did not catch all dependencies (I'm doing this on a laptop though and when the compiling gets into the critical phase I'm reading 80% RAM usage which is when I quit the browser to avoid thrashing; there should consequently be a high timing variability because the system load is not trivial).

The OS version is Linux Mint 19.3 Tricia so not the newest one.

loveencounterflow commented 3 years ago

This looks similar to #569

Yes it does the last few output lines read the same. Where does this dune executable into play and where is it located?

marcusroberts commented 3 years ago

Can you run

cc -v

(or gcc -v)

and tell me the C compiler version you're running please?

loveencounterflow commented 3 years ago

Here you go:

$ cc -v       
Reading specs from /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/specs
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/libexec/gcc/x86_64-unknown-linux-gnu/5.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-5 --with-gmp=/home/linuxbrew/.linuxbrew/opt/gmp --with-mpfr=/home/linuxbrew/.linuxbrew/opt/mpfr --with-mpc=/home/linuxbrew/.linuxbrew/opt/libmpc --with-pkgversion='Homebrew GCC 5.5.0_7' --with-isl=/home/linuxbrew/.linuxbrew/opt/isl@0.18 --with-bugurl=https://github.com/Homebrew/linuxbrew-core/issues --with-boot-ldflags='-static-libstdc++ -static-libgcc ' --disable-multilib
Thread model: posix
gcc version 5.5.0 (Homebrew GCC 5.5.0_7) 
$ gcc -v      
Reading specs from /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/specs
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/libexec/gcc/x86_64-unknown-linux-gnu/5.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-5 --with-gmp=/home/linuxbrew/.linuxbrew/opt/gmp --with-mpfr=/home/linuxbrew/.linuxbrew/opt/mpfr --with-mpc=/home/linuxbrew/.linuxbrew/opt/libmpc --with-pkgversion='Homebrew GCC 5.5.0_7' --with-isl=/home/linuxbrew/.linuxbrew/opt/isl@0.18 --with-bugurl=https://github.com/Homebrew/linuxbrew-core/issues --with-boot-ldflags='-static-libstdc++ -static-libgcc ' --disable-multilib
Thread model: posix
gcc version 5.5.0 (Homebrew GCC 5.5.0_7) 

(so no cc really only gcc)

benracine commented 3 years ago

I'm seeing 30+ second compile times on the 2nd, 3rd, 4th hello world examples. Not sure if that's typical of indicative that I'm seeing this same issue.

I'm using Node version v14.16.0 and

Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: x86_64-apple-darwin20.3.0
marcusroberts commented 3 years ago

No surprise but I get the same compile error on a clean install of Mint 19.3. Now I can reproduce the problem I'll see if I can fix it.

marcusroberts commented 3 years ago

@loveencounterflow I'm going to carry on with this issue in #569 as that's about compiling grain.

@benracine the performance problem you see is the linking phase which does take around this amount of time with the JS version of the tools.

MarkTiedemann commented 3 years ago

Same on Windows. 16 seconds for nth compile of hello.gr.

phated commented 3 years ago

Same on Windows. 16 seconds for nth compile of hello.gr.

Yes, we are aware of the performance of the packaged binaries. Static linking is ~80% of that time. --no-link should run in ~5 seconds.

cloudspeech commented 3 years ago

I don't see this being predominantly static-linking time in my measurements. Evidently, the times are far too slow... Binary from https://grain-lang.org/docs/getting_grain#MacOS-x64---Homebrew, downloaded just now.

2014 MacbookPro here, running MacOS Catalina 10.15.5: Model Name: MacBook Pro Model Identifier: MacBookPro11,2 Processor Name: Quad-Core Intel Core i7 Processor Speed: 2.2 GHz Number of Processors: 1 Total Number of Cores: 4 L2 Cache (per Core): 256 KB L3 Cache: 6 MB Hyper-Threading Technology: Enabled Memory: 16 GB

$ time grain hello.gr --no-link Hello, world!

real 0m43.047s user 0m58.184s sys 0m0.800s

$ time grain hello.gr Hello, world!

real 0m49.597s user 1m5.953s sys 0m0.832s

ospencer commented 3 years ago

Fast compile times can be achieved by building the compiler from source. You can find instructions here: https://grain-lang.org/docs/getting_grain#Building-Grain-from-Source

We plan to ship fast native binaries later this year / early next year.

emummel20 commented 2 years ago

@ospencer Hi 👋 , I see this issue is Open. May I ask what the status is? Are there still these slowness issues with the complier? Any luck shipping faster binaries? Thank you.

ospencer commented 2 years ago

Hey @emummel20! This will be resolved in the next version of Grain, v0.5.0. Should be out within a few weeks :)