Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create a switch for from source compiled and built OCaml compiler? #3951

Closed
CarpeDiemKopi opened this issue Aug 10, 2019 · 5 comments
Closed

Comments

@CarpeDiemKopi
Copy link

CarpeDiemKopi commented Aug 10, 2019

I have built an Ocaml compiler 4.02.3+bucklescript-1 and opam master branch too. How do I make this compiler opam known now?

In the following you can see, that I have a working opam 2.1.0~beta and a working ocamlc 4.02.3+BS. Now is the question, how to get these two components to work together?

Charleen@ROY /cygdrive/d/development/OCaml/opam
$ ocamlc -v
The OCaml compiler, version 4.02.3+BS
Standard library directory: /cygdrive/d/development/ocaml/home/Charleen/.opam/ocaml-4.02.3-buckle-1//lib/ocaml

Charleen@ROY /cygdrive/d/development/OCaml/opam
$ opam --version
2.1.0~beta

How do I teach opam to recognize and find the existing compiler?

The following excerpt from the installation instructions is rather unclear:

grafik

And exactly before this is where the creation of a linking of opam and an existing OCaml compiler instance should be mentioned and explained - with an example!

My first attempt with switch creates and given directory:

$ opam switch create /cygdrive/d/development/ocaml/home/Charleen/.opam/ocaml-4.02.3-buckle-1/

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
⬇ retrieved ocaml-base-compiler.4.08.1  (cached)

Opam didn't recognize the already in the given directory existing compiler and installed 4.08.1.

Do I need an extra tool to make a switch from an OCaml compiler?

@rjbou
Copy link
Collaborator

rjbou commented Aug 12, 2019

No need of extra tool, opam can handle it. There is a draft doc on how to handle unreleased/custom compilers, on ocaml/platform-blog#69 (readable version).

Feel free to add a comment if it's not so clear!

My first attempt with switch creates and given directory

Does your ocaml compiler directory contains opam files ?

@CarpeDiemKopi
Copy link
Author

Does your ocaml compiler directory contains opam files ?

No, see output of ls -R:

Charleen@ROY /cygdrive/d/Development/OCaml/home/Charleen/.opam/_backup_my_compile_ocaml-4.02.3-buckle-1
$ ls -R
.:
bin  lib  man

./bin:
ocaml.exe            ocamlbuild.native.exe  ocamlcp.exe     ocamldep.opt.exe  ocamllex.exe      ocamlmktop        ocamlopt.opt.exe  ocamlrun.exe
ocamlbuild.byte.exe  ocamlc.exe             ocamldebug.exe  ocamldoc.exe      ocamllex.opt.exe  ocamlobjinfo.exe  ocamloptp.exe     ocamlyacc.exe
ocamlbuild.exe       ocamlc.opt.exe         ocamldep.exe    ocamldoc.opt.exe  ocamlmklib.exe    ocamlopt.exe      ocamlprof.exe

./lib:
ocaml

./lib/ocaml:
arg.cmi           bytesLabels.mli               complex.mli      int32.mli        marshal.cmi         parsing.mli     sort.cmi        string.ml
arg.cmx           callback.cmi                  condition.mli    int64.cmi        marshal.cmx         pervasives.cmi  sort.cmx        string.mli
arg.ml            callback.cmx                  digest.cmi       int64.cmx        marshal.ml          pervasives.cmx  sort.ml         stringLabels.cmi
arg.mli           callback.ml                   digest.cmx       int64.ml         marshal.mli         pervasives.ml   sort.mli        stringLabels.cmx
arith_flags.cmx   callback.mli                  digest.ml        int64.mli        moreLabels.cmi      pervasives.mli  stack.cmi       stringLabels.ml
arith_status.cmi  caml                          digest.mli       lazy.cmi         moreLabels.cmx      printexc.cmi    stack.cmx       stringLabels.mli
arith_status.cmx  camlheader                    dynlink.cma      lazy.cmx         moreLabels.ml       printexc.cmx    stack.ml        stublibs
arith_status.mli  camlheader_ur                 dynlink.cmi      lazy.ml          moreLabels.mli      printexc.ml     stack.mli       sys.cmi
array.cmi         camlinternalFormat.cmi        dynlink.mli      lazy.mli         mutex.mli           printexc.mli    std_exit.cmi    sys.cmx
array.cmx         camlinternalFormat.cmx        event.mli        ld.conf          nat.cmi             printf.cmi      std_exit.cmo    sys.ml
array.ml          camlinternalFormat.ml         expunge.exe      lexing.cmi       nat.cmx             printf.cmx      std_exit.cmx    sys.mli
array.mli         camlinternalFormat.mli        extract_crc.exe  lexing.cmx       nat.mli             printf.ml       std_exit.ml     thread.mli
arrayLabels.cmi   camlinternalFormatBasics.cmi  filename.cmi     lexing.ml        nativeint.cmi       printf.mli      std_exit.o      threads
arrayLabels.cmx   camlinternalFormatBasics.cmx  filename.cmx     lexing.mli       nativeint.cmx       profiling.cmi   std_exit.p.cmx  threadUnix.mli
arrayLabels.ml    camlinternalFormatBasics.ml   filename.ml      libasmrun.a      nativeint.ml        profiling.cmo   std_exit.p.o    topdirs.cmi
arrayLabels.mli   camlinternalFormatBasics.mli  filename.mli     libasmrunp.a     nativeint.mli       profiling.cmx   stdLabels.cmi   unix.a
big_int.cmi       camlinternalLazy.cmi          format.cmi       libbigarray.a    num.cmi             profiling.o     stdLabels.cmx   unix.cma
big_int.cmx       camlinternalLazy.cmx          format.cmx       libcamlrun.a     num.cmx             queue.cmi       stdLabels.ml    unix.cmi
big_int.mli       camlinternalLazy.ml           format.ml        libcamlstr.a     num.mli             queue.cmx       stdLabels.mli   unix.cmx
bigarray.a        camlinternalLazy.mli          format.mli       libnums.a        nums.a              queue.ml        stdlib.a        unix.cmxa
bigarray.cma      camlinternalMod.cmi           gc.cmi           libthreads.a     nums.cma            queue.mli       stdlib.cma      unix.mli
bigarray.cmi      camlinternalMod.cmx           gc.cmx           libthreadsnat.a  nums.cmxa           random.cmi      stdlib.cmxa     unixLabels.cmi
bigarray.cmx      camlinternalMod.ml            gc.ml            libunix.a        obj.cmi             random.cmx      stdlib.p.a      unixLabels.cmx
bigarray.cmxa     camlinternalMod.mli           gc.mli           list.cmi         obj.cmx             random.ml       stdlib.p.cmxa   unixLabels.mli
bigarray.mli      camlinternalOO.cmi            genlex.cmi       list.cmx         obj.ml              random.mli      str.a           VERSION
buffer.cmi        camlinternalOO.cmx            genlex.cmx       list.ml          obj.mli             ratio.cmi       str.cma         vmthreads
buffer.cmx        camlinternalOO.ml             genlex.ml        list.mli         objinfo_helper.exe  ratio.cmx       str.cmi         weak.cmi
buffer.ml         camlinternalOO.mli            genlex.mli       listLabels.cmi   ocamlbuild          ratio.mli       str.cmx         weak.cmx
buffer.mli        char.cmi                      hashtbl.cmi      listLabels.cmx   ocamldoc            scanf.cmi       str.cmxa        weak.ml
bytes.cmi         char.cmx                      hashtbl.cmx      listLabels.ml    oo.cmi              scanf.cmx       str.mli         weak.mli
bytes.cmx         char.ml                       hashtbl.ml       listLabels.mli   oo.cmx              scanf.ml        stream.cmi
bytes.ml          char.mli                      hashtbl.mli      Makefile.config  oo.ml               scanf.mli       stream.cmx
bytes.mli         compiler-libs                 int_misc.cmx     map.cmi          oo.mli              set.cmi         stream.ml
bytesLabels.cmi   complex.cmi                   int32.cmi        map.cmx          parsing.cmi         set.cmx         stream.mli
bytesLabels.cmx   complex.cmx                   int32.cmx        map.ml           parsing.cmx         set.ml          string.cmi
bytesLabels.ml    complex.ml                    int32.ml         map.mli          parsing.ml          set.mli         string.cmx

./lib/ocaml/caml:
address_class.h  bigarray.h  compatibility.h  custom.h  gc.h    intext.h  misc.h      printexc.h  socketaddr.h  unixsupport.h
alloc.h          callback.h  config.h         fail.h    hash.h  memory.h  mlvalues.h  signals.h   threads.h     version.h

./lib/ocaml/compiler-libs:
annot.cmi                   clflags.cmi     datarepr.cmi      interf.cmi         ocamlbytecomp.cmxa  parser.cmi        reloadgen.cmi   topmain.cmi
arch.cmi                    closure.cmi     deadcode.cmi      lambda.cmi         ocamlcommon.a       parsetree.cmi     runtimedef.cmi  topstart.cmi
asmgen.cmi                  cmi_format.cmi  debuginfo.cmi     lexer.cmi          ocamlcommon.cma     path.cmi          schedgen.cmi    topstart.cmo
asmlibrarian.cmi            cmm.cmi         depend.cmi        linearize.cmi      ocamlcommon.cmxa    pparse.cmi        scheduling.cmi  trace.cmi
asmlink.cmi                 cmmgen.cmi      dll.cmi           liveness.cmi       ocamloptcomp.a      pprintast.cmi     selectgen.cmi   translclass.cmi
asmpackager.cmi             cmo_format.cmi  docstrings.cmi    location.cmi       ocamloptcomp.cma    predef.cmi        selection.cmi   translcore.cmi
ast_helper.cmi              cmt_format.cmi  emit.cmi          longident.cmi      ocamloptcomp.cmxa   primitive.cmi     simplif.cmi     translmod.cmi
ast_mapper.cmi              cmx_format.cmi  emitaux.cmi       mach.cmi           ocamltoplevel.cma   printast.cmi      spill.cmi       translobj.cmi
asttypes.cmi                coloring.cmi    emitcode.cmi      main.cmi           opcodes.cmi         printclambda.cmi  split.cmi       typeclass.cmi
branch_relaxation.cmi       comballoc.cmi   env.cmi           main.cmo           oprint.cmi          printcmm.cmi      strmatch.cmi    typecore.cmi
branch_relaxation_intf.cmi  compenv.cmi     envaux.cmi        main.cmx           optcompile.cmi      printinstr.cmi    stypes.cmi      typedecl.cmi
btype.cmi                   compile.cmi     errors.cmi        main.o             opterrors.cmi       printlambda.cmi   subst.cmi       typedtree.cmi
bytegen.cmi                 compilenv.cmi   expunge.cmi       main_args.cmi      optmain.cmi         printlinear.cmi   switch.cmi      typedtreeIter.cmi
bytelibrarian.cmi           compmisc.cmi    genprintval.cmi   matching.cmi       optmain.cmo         printmach.cmi     symtable.cmi    typedtreeMap.cmi
bytelink.cmi                config.cmi      ident.cmi         meta.cmi           optmain.cmx         printtyp.cmi      syntaxerr.cmi   typemod.cmi
bytepackager.cmi            consistbl.cmi   includeclass.cmi  misc.cmi           optmain.o           printtyped.cmi    tbl.cmi         typeopt.cmi
bytesections.cmi            CSE.cmi         includecore.cmi   mtype.cmi          outcometree.cmi     proc.cmi          terminfo.cmi    types.cmi
ccomp.cmi                   CSEgen.cmi      includemod.cmi    ocamlbytecomp.a    parmatch.cmi        reg.cmi           topdirs.cmi     typetexp.cmi
clambda.cmi                 ctype.cmi       instruct.cmi      ocamlbytecomp.cma  parse.cmi           reload.cmi        toploop.cmi     warnings.cmi

./lib/ocaml/ocamlbuild:
ocamlbuild.cmo  ocamlbuild_executor.cmi  ocamlbuild_pack.cmi    ocamlbuild_plugin.cmx       ocamlbuild_unix_plugin.cmx  ocamlbuildlib.cma
ocamlbuild.cmx  ocamlbuild_executor.cmx  ocamlbuild_pack.cmx    ocamlbuild_plugin.o         ocamlbuild_unix_plugin.o    ocamlbuildlib.cmxa
ocamlbuild.o    ocamlbuild_executor.o    ocamlbuild_plugin.cmi  ocamlbuild_unix_plugin.cmi  ocamlbuildlib.a

./lib/ocaml/ocamldoc:
custom             odoc_comments_global.cmi  odoc_exception.cmi  odoc_info.cmxa        odoc_messages.cmi   odoc_scan.cmi       odoc_text_lexer.cmi
ocamldoc.hva       odoc_config.cmi           odoc_extension.cmi  odoc_info.mli         odoc_misc.cmi       odoc_search.cmi     odoc_text_parser.cmi
odoc.cmi           odoc_control.cmi          odoc_gen.cmi        odoc_inherit.cmi      odoc_module.cmi     odoc_see_lexer.cmi  odoc_to_text.cmi
odoc_analyse.cmi   odoc_cross.cmi            odoc_global.cmi     odoc_latex.cmi        odoc_name.cmi       odoc_sig.cmi        odoc_type.cmi
odoc_args.cmi      odoc_dag2html.cmi         odoc_html.cmi       odoc_latex_style.cmi  odoc_ocamlhtml.cmi  odoc_str.cmi        odoc_types.cmi
odoc_ast.cmi       odoc_dep.cmi              odoc_info.a         odoc_lexer.cmi        odoc_parameter.cmi  odoc_test.cmi       odoc_value.cmi
odoc_class.cmi     odoc_dot.cmi              odoc_info.cma       odoc_man.cmi          odoc_parser.cmi     odoc_texi.cmi
odoc_comments.cmi  odoc_env.cmi              odoc_info.cmi       odoc_merge.cmi        odoc_print.cmi      odoc_text.cmi

./lib/ocaml/ocamldoc/custom:

./lib/ocaml/stublibs:

./lib/ocaml/threads:
condition.cmi  event.cmi  mutex.cmi  thread.cmi  threads.a    threads.cmxa    threadUnix.cmx
condition.cmx  event.cmx  mutex.cmx  thread.cmx  threads.cma  threadUnix.cmi

./lib/ocaml/vmthreads:
condition.cmi  event.cmi  libvmthreads.a  mutex.mli   thread.cmi  threads.cma     threadUnix.mli
condition.mli  event.mli  mutex.cmi       stdlib.cma  thread.mli  threadUnix.cmi  unix.cma

./man:
man1  man3

./man/man1:
ocaml.1   ocamlc.opt.1  ocamldebug.1  ocamldoc.1  ocamlmktop.1  ocamlopt.opt.1  ocamlprof.1  ocamlyacc.1
ocamlc.1  ocamlcp.1     ocamldep.1    ocamllex.1  ocamlopt.1    ocamloptp.1     ocamlrun.1

./man/man3:
Arg.3o              Ast_mapper.3o                Hashtbl.HashedType.3o                   MoreLabels.Hashtbl.SeededS.3o  Random.State.3o
Array.3o            Asttypes.3o                  Hashtbl.Make.3o                         MoreLabels.Map.3o              Scanf.3o
ArrayLabels.3o      Bigarray.3o                  Hashtbl.MakeSeeded.3o                   MoreLabels.Map.Make.3o         Scanf.Scanning.3o
Ast_helper.3o       Bigarray.Array1.3o           Hashtbl.S.3o                            MoreLabels.Map.OrderedType.3o  Set.3o
Ast_helper.Cf.3o    Bigarray.Array2.3o           Hashtbl.SeededHashedType.3o             MoreLabels.Map.S.3o            Set.Make.3o
Ast_helper.Ci.3o    Bigarray.Array3.3o           Hashtbl.SeededS.3o                      MoreLabels.Set.3o              Set.OrderedType.3o
Ast_helper.Cl.3o    Bigarray.Genarray.3o         Int32.3o                                MoreLabels.Set.Make.3o         Set.S.3o
Ast_helper.Csig.3o  Buffer.3o                    Int64.3o                                MoreLabels.Set.OrderedType.3o  Sort.3o
Ast_helper.Cstr.3o  Bytes.3o                     Lazy.3o                                 MoreLabels.Set.S.3o            Stack.3o
Ast_helper.Ctf.3o   BytesLabels.3o               Lexer.3o                                Nativeint.3o                   StdLabels.3o
Ast_helper.Cty.3o   Callback.3o                  Lexing.3o                               Num.3o                         StdLabels.Array.3o
Ast_helper.Exp.3o   CamlinternalFormat.3o        List.3o                                 Obj.3o                         StdLabels.Bytes.3o
Ast_helper.Incl.3o  CamlinternalFormatBasics.3o  ListLabels.3o                           Oo.3o                          StdLabels.List.3o
Ast_helper.Mb.3o    CamlinternalLazy.3o          Location.3o                             Parse.3o                       StdLabels.String.3o
Ast_helper.Md.3o    CamlinternalMod.3o           Longident.3o                            Parser.3o                      Str.3o
Ast_helper.Mod.3o   CamlinternalOO.3o            Map.3o                                  Parsetree.3o                   Stream.3o
Ast_helper.Mtd.3o   Char.3o                      Map.Make.3o                             Parsing.3o                     String.3o
Ast_helper.Mty.3o   Complex.3o                   Map.OrderedType.3o                      Pervasives.3o                  StringLabels.3o
Ast_helper.Opn.3o   Depend.3o                    Map.S.3o                                Pervasives.LargeFile.3o        Syntaxerr.3o
Ast_helper.Pat.3o   Depend.StringSet.3o          Marshal.3o                              Pprintast.3o                   Sys.3o
Ast_helper.Sig.3o   Digest.3o                    MoreLabels.3o                           Pprintast.printer.3o           Unix.3o
Ast_helper.Str.3o   Docstrings.3o                MoreLabels.Hashtbl.3o                   Printast.3o                    Unix.LargeFile.3o
Ast_helper.Te.3o    Filename.3o                  MoreLabels.Hashtbl.HashedType.3o        Printexc.3o                    Weak.3o
Ast_helper.Typ.3o   Format.3o                    MoreLabels.Hashtbl.Make.3o              Printexc.Slot.3o               Weak.Make.3o
Ast_helper.Type.3o  Gc.3o                        MoreLabels.Hashtbl.MakeSeeded.3o        Printf.3o                      Weak.S.3o
Ast_helper.Val.3o   Genlex.3o                    MoreLabels.Hashtbl.S.3o                 Queue.3o
Ast_helper.Vb.3o    Hashtbl.3o                   MoreLabels.Hashtbl.SeededHashedType.3o  Random.3o

@rjbou
Copy link
Collaborator

rjbou commented Aug 29, 2019

If it is already installed on your system, no need of local opam files, you'll just need to follow steps of cited draft blog post.
If you want to install from your local ocaml source directory, you can retrieve the ocaml compiler opam file, update it with your version and follow steps described for that case.

@rjbou
Copy link
Collaborator

rjbou commented Dec 12, 2019

Any news on this one ?

@rjbou
Copy link
Collaborator

rjbou commented Nov 18, 2020

Closing, fell free to reopen if this is still an issue

@rjbou rjbou closed this as completed Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants