From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 72A067FEE5 for ; Tue, 18 Apr 2017 20:11:38 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=zhenya1007@gmail.com; spf=Pass smtp.mailfrom=zhenya1007@gmail.com; spf=None smtp.helo=postmaster@mail-yw0-f172.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of zhenya1007@gmail.com) identity=pra; client-ip=209.85.161.172; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="zhenya1007@gmail.com"; x-sender="zhenya1007@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of zhenya1007@gmail.com designates 209.85.161.172 as permitted sender) identity=mailfrom; client-ip=209.85.161.172; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="zhenya1007@gmail.com"; x-sender="zhenya1007@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-yw0-f172.google.com) identity=helo; client-ip=209.85.161.172; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="zhenya1007@gmail.com"; x-sender="postmaster@mail-yw0-f172.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AiHW45hItbatAjsUP7NmcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgfI/jxwZ3uMQTl6Ol3ixeRBMOAuq4C07KempujcFRI2YyGvnEGfc4EfD4+ou?= =?us-ascii?q?JSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgpp?= =?us-ascii?q?POT1HZPZg9iq2+yo9ZDeZwpFiCChbb9uM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R6?= =?us-ascii?q?895zE7B5ygDYbDXI+hnaCN0Du5E5BNaWBGD0qDEXbsd4meR/gMbyeSLtd7kjMY?= =?us-ascii?q?TbihV5Mh1Ra2uQDm0bVnK+7U9jQctZLiz9h1+/belQoy9DxxF8SSyXuBT2Bynm?= =?us-ascii?q?MSRj85xrpzoUJnygTL7a8tm/VFEZpX7vhJWxsSOJLBifF8Cs63VAnGe8uEDli8?= =?us-ascii?q?Efu8BjRkY8w+ztkfK3x6Bt+jiBvDwyerBfdBhbyGAo09q/qEgFD+Is98zzDN06?= =?us-ascii?q?x33ApueddGKWDz3v03zAPUHYOc1hzBz6s=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CKBABkVfZYh6yhVdFcHAEBBAEBCgEBG?= =?us-ascii?q?AEFAQsBgkOBBzQLgQsHg1+CBogPkDYBAQaBJYJmhUBmhCyIKYIPMIQagVoCg20?= =?us-ascii?q?HPxgBAQEBAQEBAQEBARIBAQEIDQkIKC+CMyIBgkABAgIBIx0BGx0BAwELBgULN?= =?us-ascii?q?wICIgERAQUBDgENGYoAAQMIBQgOnnU/jASCBAUBHIMJBYNgChknDVaDBwEBAQc?= =?us-ascii?q?BAQEBAQEBGQIGEoV6giODGIMYgWyCWYJfBYErAQEBiAWNAYZUEAgBAYE/CYU8g?= =?us-ascii?q?y2IOYJVgQuNaItDhwMUH4EVDxCBPWNZGFCDRSofggskNQEBAYkIAQEB?= X-IPAS-Result: =?us-ascii?q?A0CKBABkVfZYh6yhVdFcHAEBBAEBCgEBGAEFAQsBgkOBBzQ?= =?us-ascii?q?LgQsHg1+CBogPkDYBAQaBJYJmhUBmhCyIKYIPMIQagVoCg20HPxgBAQEBAQEBA?= =?us-ascii?q?QEBARIBAQEIDQkIKC+CMyIBgkABAgIBIx0BGx0BAwELBgULNwICIgERAQUBDgE?= =?us-ascii?q?NGYoAAQMIBQgOnnU/jASCBAUBHIMJBYNgChknDVaDBwEBAQcBAQEBAQEBGQIGE?= =?us-ascii?q?oV6giODGIMYgWyCWYJfBYErAQEBiAWNAYZUEAgBAYE/CYU8gy2IOYJVgQuNaIt?= =?us-ascii?q?DhwMUH4EVDxCBPWNZGFCDRSofggskNQEBAYkIAQEB?= X-IronPort-AV: E=Sophos;i="5.37,219,1488841200"; d="scan'208,217";a="220757874" Received: from mail-yw0-f172.google.com ([209.85.161.172]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 18 Apr 2017 20:11:36 +0200 Received: by mail-yw0-f172.google.com with SMTP id j9so267913ywj.3 for ; Tue, 18 Apr 2017 11:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=5PTDJq3Zi2qeRuZUD27U/hll9EJI1zXSfC6wLGpKSVs=; b=MVnk8h3aUslqqi3mfanF47goaPqbUFDh0Ta9Qnx51takuLTCpLF95PzvjwdqbCWK8/ uspifpTSEnYRZ9OvJPL9I5p6MX/BgpvB3Wv5i/Qw/h9msz5dJGPKgEDqI3YMaRnhxLq5 2qPrw0K1B7VvO4h3QlpUj2czMPkOAYmizsT1Nt2NAvv3QUuIHOMyYEOqUBpmE3kIOTgY Q4cPj1R/6uYAja/KCoBoLIqLBk9JWNbAsPHiu6KweFLiGtx1PBsdD7RRi0pWWwck33ND 6kfqTdmKWMgKsLTLuTAUbDqz97y9qeMt+KKJSJ7CmVNo5KI5cywJqnnxql8UbgVjrB15 Zqmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=5PTDJq3Zi2qeRuZUD27U/hll9EJI1zXSfC6wLGpKSVs=; b=bWB+Evkw9AgRFZ63G/S9K+AqTNr91l38NPIM5HWB71R1Dwugct34ZUh6gYcdkvpHnt II5qYQVv2oAWs0PiLvpRFXTIEOvOvieWlw3omg5TaRivL23oJCNN//4CgkXKwOugwaVW 2SL8o6ol3oCxJd9k96WMSGNTv/Dxt/AYz+uZP+N4iLKBAl+99IThMpgOimycj7YXZBp6 vJ4d8VOQhTdufBE7oX4xuxF3RwNm1tlkkYzDyNPB9DHRvsnpChAaZLiJmRkE1gNxkFPe iOQky7YBxtJhpkV8d2Zgwf2ZVcBU7BXcqNvgEH/Ofs4GyKd7mVoFDUJQ28LUVzNweZ84 mHcg== X-Gm-Message-State: AN3rC/58Ti2dMD4LUti+R3ZVtxqIuwIlF8M2TiLAUsI5WM/JRahk8rQP 09fzpH1GKRzkgkuXnPup3cYjx7qWPTkl X-Received: by 10.13.223.134 with SMTP id i128mr20123851ywe.117.1492539095419; Tue, 18 Apr 2017 11:11:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.104.206 with HTTP; Tue, 18 Apr 2017 11:11:34 -0700 (PDT) In-Reply-To: <36405058.13728179.1492500074563.JavaMail.zimbra@edu.univ-fcomte.fr> References: <36405058.13728179.1492500074563.JavaMail.zimbra@edu.univ-fcomte.fr> From: Evgeny Roubinchtein Date: Tue, 18 Apr 2017 14:11:34 -0400 Message-ID: To: paul.lachat@edu.univ-fcomte.fr Cc: OCaml Mailing List Content-Type: multipart/alternative; boundary=001a114e4ab4989251054d74d617 Subject: Re: [Caml-list] [Question] Compile a custom toplevel on Windows --001a114e4ab4989251054d74d617 Content-Type: text/plain; charset=UTF-8 Have you considered following the "standard" instructions for building a custom toplevel: http://caml.inria.fr/pub/docs/manual-ocaml-4.03/toplevel.html#sec275? Also, to the best of my knowledge, the standard toplevel (ocaml) is not a native code application. There _is_ a native toplevel called ocamlnat, but as of 4.03 (IIRC) it was still undocumented, and "non-standard." If your goal is simply to produce a stand-alone "executable" which packages the byte code an a COFF/ELF binary into a single file, then you can use the "-custom" flag as documented in Chapters 8 and 19 of the manual I linked to above. Finally, if you are using the Cygwin version of OCaml you cannot avoid Cygwin: your executable will be linked with cygwin.dll, and you will need to have that present in order to start your executable. If you wish to produce an executable that doesn't require Cygwin at run-time, you need to use one of the non-Cygwin OCaml compilers: on Windows, you have a choice between MSVC and MingGW. That is documented in the README.win32 that comes with the OCaml distribution: https://github.com/ocaml/ocaml/blob/4.03/README.win32.adoc Does this help, or do you have further questions? -- Best, Zhenya On Tue, Apr 18, 2017 at 3:21 AM, wrote: > Hello, > > I've change the toplevel of Ocaml to replace the standard input and output > by named pipes on Windows. > > To achieve this, I've change the toploop.ml (https://github.com/ocaml/ > ocaml/blob/trunk/toplevel/toploop.ml) to include the named pipes > of Ocamlnet (http://projects.camlcity.org/projects/dl/ocamlnet-4.1.2/ > doc/html-main/Netsys_win32.html#1_Supportfornamedpipes). > > After that, I tried to understand how I could compile this custom toplevel. > I want to compile the toplevel to have a .exe, so I could avoid using > Cygwin to launch the application. > > I've run the makefile of the git repository of Ocaml and tried to follow > the sequence of compilation for the toplevel. > I use ocamlopt to have a native aplication and ocamlfind to link > toploop.ml with the library ocamlnet > (via the package netsys where the win32 named pipe are defined) and unix > for catching exceptions. > > I use Opam : 1.3.0~dev, Ocaml : 4.03.0 and Cygwin on Windows 7. > > So I write a Makefile (see the attachement) and when I launch it, I get > this : > ______________________________________________________________________ > ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa > ocamlcommon.a ocamlbytecomp.a -c genprintval.mli > ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa > ocamlcommon.a ocamlbytecomp.a -c genprintval.ml > ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa > ocamlcommon.a ocamlbytecomp.a -c toploop.mli > ocamlfind ocamlopt -g -I +compiler-libs ocamlcommon.cmxa > ocamlbytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -c toploop.ml -linkpkg > -package netsys -package unix > File "C:\OCaml64\home\Zar\toplevel_custom\_none_", line 1: > Warning 58: no cmx file was found in path for module Netsys_win32, and its > interface was not compiled with -opaque > ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa > ocamlcommon.a ocamlbytecomp.a -c trace.mli > ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa > ocamlcommon.a ocamlbytecomp.a -c trace.ml > ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa > ocamlcommon.a ocamlbytecomp.a -c topdirs.mli > ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa > ocamlcommon.a ocamlbytecomp.a -c topdirs.ml > ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa > ocamlcommon.a ocamlbytecomp.a -c topmain.mli > ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa > ocamlcommon.a ocamlbytecomp.a -c topmain.ml > ocamlopt -g -I +compiler-libs -a -o tmp_ocamltoplevel.cmxa genprintval.cmx > toploop.cmx trace.cmx topdirs.cmx topmain.cmx > ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa > ocamlcommon.a ocamlbytecomp.a -c topstart.ml > ocamlfind ocamlopt -g -I +compiler-libs ocamlcommon.cmxa > ocamlbytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -linkall -o > toplevel_custom.exe tmp_ocamltoplevel.cmxa topstart.cmx tmp_ocamltoplevel.a > -linkpkg -package netsys -package unix > ** Cannot resolve symbols for tmp_ocamltoplevel.a(topdirs.o): > caml_get_current_environment > File "caml_startup", line 1: > Error: Error during linking > ______________________________________________________________________ > > But I don't know how to resolve this error. > I find that "caml_get_current_environment" is defined in meta.c (and used > in topdirs.ml) > (https://github.com/ocaml/ocaml/search?utf8=%E2%9C%93&q= > caml_get_current_environment+&type=) > But I think that meta.c is in the ocamlbytecomp.cmxa library, so I don't > know why the linker don't find the symbols. > > Someone know how to resolve this problem ? > > Thank you in advance ! > --001a114e4ab4989251054d74d617 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Have you considered following the "standard"= ; instructions for building a custom toplevel: http://caml.inria.fr/p= ub/docs/manual-ocaml-4.03/toplevel.html#sec275?

Also,= to the best of my knowledge, the standard toplevel (ocaml) is not a native= code application.=C2=A0 There _is_ a native toplevel called ocamlnat, but = as of 4.03 (IIRC) it was still undocumented, and "non-standard."= =C2=A0 If your goal is simply to produce a stand-alone "executable&quo= t; which packages the byte code an a COFF/ELF binary into a single file, th= en you can use the "-custom" flag as documented in Chapters 8 and= 19 of the manual I linked to above.

Finally, if you are = using the Cygwin version of OCaml you cannot avoid Cygwin: your executable = will be linked with cygwin.dll, and you will need to have that present in o= rder to start your executable.=C2=A0 If you wish to produce an executable t= hat doesn't require Cygwin at run-time, you need to use one of the non-= Cygwin OCaml compilers: on Windows, you have a choice between MSVC and Ming= GW.=C2=A0 That is documented in the README.win32 that comes with the OCaml = distribution: https://github.com/ocaml/ocaml/blob/4.03/README.win32.adoc
Does this help, or do you have further questions?
=

--
Best,
Zhenya

On Tue, Apr 18, 2017 at= 3:21 AM, <paul.lachat@edu.univ-fcomte.fr> wro= te:
Hello,

I= 9;ve change the toplevel of Ocaml to replace the standard input and output = by named pipes on Windows.

To achieve this, I= 've change the toploop.= ml (https://github.com/ocaml/ocaml/blob/trunk/top= level/toploop.ml) to include the named pipes

Aft= er that, I tried to understand how I could compile this custom toplevel.
I want to compile the toplevel to have a .exe, so I could avoid= using Cygwin to launch the application.

I= 9;ve run the makefile of the git repository of Ocaml and tried to follow th= e sequence of compilation for the toplevel.
I use ocamlopt to hav= e a native aplication and ocamlfind to link toploop.ml with the library ocamlnet
(via th= e package netsys where the win32 named pipe are defined) and unix for catch= ing exceptions.

I use Opam : 1.3.0~dev, Ocaml = : 4.03.0 and Cygwin on Windows 7.

So I write a Mak= efile (see the attachement) and when I launch it, I get this :
_______________________________________________________________= _______
ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlb= ytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -c genprintval.mli
ocamlopt -= g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocaml= bytecomp.a -c genprintv= al.ml
ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.c= mxa ocamlcommon.a ocamlbytecomp.a -c toploop.mli
ocamlfind ocamlopt -g -= I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocamlbyt= ecomp.a -c toploop.ml -= linkpkg -package netsys -package unix
File "C:\OCaml64\home\Zar\top= level_custom\_none_", line 1:
Warning 58: no cmx file was foun= d in path for module Netsys_win32, and its interface was not compiled with = -opaque
ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmx= a ocamlcommon.a ocamlbytecomp.a -c trace.mli
ocamlopt -g -I +compiler-li= bs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -c trace.ml
ocamlopt -g -I += compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocamlbyteco= mp.a -c topdirs.mli
ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocaml= bytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -c topdirs.ml
ocamlopt -g -I +compiler-libs ocamlco= mmon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -c topmain.mliocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlco= mmon.a ocamlbytecomp.a -c t= opmain.ml
ocamlopt -g -I +compiler-libs -a -o tmp_ocamltoplevel.cmxa= genprintval.cmx toploop.cmx trace.cmx topdirs.cmx topmain.cmx
ocamlopt = -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocam= lbytecomp.a -c topstart.ml=
ocamlfind ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytec= omp.cmxa ocamlcommon.a ocamlbytecomp.a -linkall -o toplevel_custom.exe tmp_= ocamltoplevel.cmxa topstart.cmx tmp_ocamltoplevel.a -linkpkg -package netsy= s -package unix
** Cannot resolve symbols for tmp_ocamltoplevel.a(topdir= s.o):
caml_get_current_environment
File "caml_startup"= ;, line 1:
Error: Error during linking
______________________= ________________________________________________

But I don't know how to resolve this error.
I find that= "caml_get_current_environment" is defined in meta.c (and used in= topdirs.ml)
<= div>(https://gi= thub.com/ocaml/ocaml/search?utf8=3D%E2%9C%93&q=3Dcaml_get_cur= rent_environment+&type=3D)
But I think that meta= .c is in the ocamlbytecomp.cmxa library, so I don't know why the linker= don't find the symbols.

Someone know how to resolve = this problem ?

Thank you in advance !

--001a114e4ab4989251054d74d617--