MLton / mlton

The MLton repository
http://mlton.org
Other
960 stars 127 forks source link

Unable to use MLton 20210117 in Ubuntu 22.04.1 #488

Closed hai-nguyen-van closed 1 year ago

hai-nguyen-van commented 1 year ago

After downloading and installing MLton 20210117 from the pre-built release on my Ubuntu 22.04.1, I am unable to compile any project (not even the MLton sources itself). I am facing the following errors:

MLton 20210117 starting
   Compile SML starting
Error: $(SML_LIB)/basis/primitive/prim-mlton.sml 179.13-180.43.
  Invalid type for _import.
    C_Pthread_Key.t * 'a array -> unit
Error: $(SML_LIB)/basis/primitive/prim-mlton.sml 191.13-191.87.
  Unknown primitive: Array_update_noWriteBarrier.
Error: $(SML_LIB)/basis/primitive/prim-mlton.sml 194.13-194.68.
  Unknown primitive: Ref_assign_noWriteBarrier.
Error: $(SML_LIB)/basis/primitive/prim-mlton.sml 197.13-197.76.
  Unknown primitive: Array_sub_noReadBarrier.
Error: $(SML_LIB)/basis/primitive/prim-mlton.sml 200.13-200.59.
  Unknown primitive: Ref_deref_noReadBarrier.
Error: $(SML_LIB)/basis/primitive/prim-mlton.sml 213.9-213.48.
  Unknown primitive: Ref_cas.
Error: $(SML_LIB)/basis/primitive/prim-mlton.sml 216.9-216.67.
  Unknown primitive: Array_cas.
Error: $(SML_LIB)/basis/primitive/prim-mlton.sml 354.9-355.50.
  Invalid type for _import.
    'a ref * 'b ref * 'c ref * thread -> bool
   Compile SML reported errors in 0.81 + 0.40 (33% GC)
MLton 20210117 reported errors in 0.81 + 0.40 (33% GC)

I can confirm that all dependencies specified in the README are already installed.

MatthewFluet commented 1 year ago

Those primitives are only used in the MaPLe fork of MLton (https://github.com/MPLLang/mpl). It looks like (regular) MLton is trying to use the Basis Library implementation of MaPLe.

hai-nguyen-van commented 1 year ago

Indeed, this seems to be related to MPL. I cleaned up some directories and was able to build MLton properly. I don't really understand what I messed up 🤔 I guess we can just close this thread. Thanks for your quick reply.