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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 8F83F7FA80 for ; Sat, 24 Oct 2015 13:33:06 +0200 (CEST) IronPort-PHdr: 9a23:DgYxZRLROqlahWNg19mcpTZWNBhigK39O0sv0rFitYgVKPXxwZ3uMQTl6Ol3ixeRBMOAu68C07KempujcFJDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXsq3G/pQQfBg/4fVIsYL+lR8iK14ye7KObxd76W01wnj2zYLd/fl2djD76kY0ou7ZkMbs70RDTo3FFKKx8zGJsIk+PzV6nvp/jtLYqySlbuuog+shcSu26Ov1gFf0LRAghZioO48DkqQPEVU/Hw3oXUmwbllAAVw3E5xHzU5O3qSz3ufZn3zGyPMvqQLRyUjOnueMjAhThjSNCMz8i7EnWjNZxheRVuljp8xd2xoqRZICOKNJ/eLncdJUUXzwScNxWUnltC529Y8MmC+4aOv5A593xvVJLqxahHiGpCf/m0SNBjXyw1qo/hbdyWTra1RAtSopd+E/fq8/4YeJLCbi4 Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=dra-news@metastack.com; spf=Pass smtp.mailfrom=dra-news@metastack.com; spf=None smtp.helo=postmaster@outmail149082.authsmtp.co.uk Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of dra-news@metastack.com) identity=pra; client-ip=62.13.149.82; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of dra-news@metastack.com designates 62.13.149.82 as permitted sender) identity=mailfrom; client-ip=62.13.149.82; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@outmail149082.authsmtp.co.uk) identity=helo; client-ip=62.13.149.82; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="postmaster@outmail149082.authsmtp.co.uk"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BTAACTaytWnFKVDT5dgmkhgQBvAQWpQAaUbQENI4E3I4V6AoEsOBQBAQEBAQEBARABAQEBAQgLCQkhLoIrggcBAQEEAyocKxUCAQgQAQQBAQsZBAcyFAMBBQgBAQQBEggTiBYDCcU1AQEBAQEBAQEBAQEBAQEBAQEBAQEBGIYwhUWEXC0KAYMagRQFljaFHIgGBoFTSJYeg3ARDgEBglMWBxaBP3IBhhGBBgEBAQ X-IPAS-Result: A0BTAACTaytWnFKVDT5dgmkhgQBvAQWpQAaUbQENI4E3I4V6AoEsOBQBAQEBAQEBARABAQEBAQgLCQkhLoIrggcBAQEEAyocKxUCAQgQAQQBAQsZBAcyFAMBBQgBAQQBEggTiBYDCcU1AQEBAQEBAQEBAQEBAQEBAQEBAQEBGIYwhUWEXC0KAYMagRQFljaFHIgGBoFTSJYeg3ARDgEBglMWBxaBP3IBhhGBBgEBAQ X-IronPort-AV: E=Sophos;i="5.20,192,1444687200"; d="scan'208,217";a="184290744" Received: from outmail149082.authsmtp.co.uk ([62.13.149.82]) by mail2-smtp-roc.national.inria.fr with ESMTP; 24 Oct 2015 13:33:04 +0200 Received: from mail-c232.authsmtp.com (mail-c232.authsmtp.com [62.13.128.232]) by punt20.authsmtp.com (8.14.2/8.14.2/) with ESMTP id t9OBX4DE057674; Sat, 24 Oct 2015 12:33:04 +0100 (BST) Received: from romulus.metastack.com (114.212-105-213.static.virginmediabusiness.co.uk [213.105.212.114]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id t9OBX2Cf051318; Sat, 24 Oct 2015 12:33:02 +0100 (BST) Received: from remus.metastack.local (remus.metastack.com [172.16.0.1]) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id t9OBX1ZN020644 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Sat, 24 Oct 2015 12:33:02 +0100 Received: from Remus.metastack.local ([fe80::547c:3c42:e1da:eda2]) by Remus.metastack.local ([fe80::547c:3c42:e1da:eda2%10]) with mapi id 14.03.0248.002; Sat, 24 Oct 2015 12:33:01 +0100 From: David Allsopp To: "Soegtrop, Michael" , "caml-list@inria.fr" Thread-Topic: flexdll circular dependency on ocamlc: Impossible to built ocaml for mingw without using some prebuilt binaries? Thread-Index: AdEOQWsyPDiuTuX3RGe00BbDnTwYuQACZA7Q Date: Sat, 24 Oct 2015 11:33:00 +0000 Message-ID: References: <0F7D3B1B3C4B894D824F5B822E3E5A172CE331EE@IRSMSX102.ger.corp.intel.com> In-Reply-To: <0F7D3B1B3C4B894D824F5B822E3E5A172CE331EE@IRSMSX102.ger.corp.intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.0.18] Content-Type: multipart/alternative; boundary="_000_E51C5B015DBD1348A1D85763337FB6D9E9FB68CFRemusmetastackl_" MIME-Version: 1.0 Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 172.16.0.20 X-Server-Quench: fcb57803-7a42-11e5-829e-00151795d556 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCd1ZAARAlZZVg1f DC4bFwdFRBksPQFF ChxFJgxfNl8UURhQ KkJXbgASJgdAAnZS R3kJW1VRQFxzU2B2 YQpSIwdcYVRPXwB0 UklLXFNTEBpqBAMB SFoXLWsadXYQeHtx ZkdqEHJTVUByOxAu EEtTHW0FeGAxbGIC UUENch5ccgofYx9F a1V+U3oINWACYDQC Ml17MTQ8LTlbLGxe QxsGMFYbWw4HEyYx QRwPGz4+VUoDDyI4 JhkiIQxUPUMJNV4p MFElVBoENFcYFwxa AyMFByRQIl1JSS0x RQZbW0EBWCJcXSdb HwFgPwRJBDMaQS1d CQNdURwFFiJBTGFC STBUSCwgFw9B X-Authentic-SMTP: 61633634383431.1037:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 213.105.212.114/25 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. Subject: RE: [Caml-list] flexdll circular dependency on ocamlc: Impossible to built ocaml for mingw without using some prebuilt binaries? --_000_E51C5B015DBD1348A1D85763337FB6D9E9FB68CFRemusmetastackl_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable This is indeed a strange effect - bluntly, flexlink should be bootstrapped = with the OCaml sources (i.e. a bytecode image of flexlink should be in /boo= t). Note that your Cygwin build-route really is missing a step - you're bootstr= apping, so the final stage should be recompiling flexlink using your new oc= amlopt (the compilers do indeed need flexlink), then the dependency on Cygw= in disappears. For my own builds, I extract flexlink.exe from Alain's binar= y distribution, build the FlexDLL objects from sources, compile OCaml and t= hen recompile flexlink.exe using the that fresh compiler and replace the ea= rlier binary copy. See, for example, https://github.com/dra27/OCaml-Windows= -Build/blob/master/build.cmd#L527-L570 At some point, I was going to alter things so that FlexDLL is the only requ= irement for pre-installation (as that can be built from source) and have th= e ocaml process use boot/flexlink if a binary flexlink isn't available... b= ut as that's only to satisfy a religious fervour to remove the circular dep= endency, it's right down at the bottom of my personal task list, especially= as I doubt it would be merged :o) Regarding the reason for FlexDLL, the solution for tricking the linker does= also work for gcc - see http://edll.sourceforge.net/#def_a (which is refer= enced from FlexDLL's webpage). I expect Alain's motivation for FlexDLL is t= hat the "side-effects" referred to in http://alain.frisch.fr/flexdll.html#e= xamples were known about beforehand which the .def/.a solution doesn't solv= e, especially as it makes the build process more complicated. David From: caml-list-request@inria.fr [mailto:caml-list-request@inria.fr] On Beh= alf Of Soegtrop, Michael Sent: 24 October 2015 10:51 To: caml-list@inria.fr Subject: [Caml-list] flexdll circular dependency on ocamlc: Impossible to b= uilt ocaml for mingw without using some prebuilt binaries? Dear Ocaml Users, building Ocaml for Mingw on Cygwin I came across a strange effect: flexdll = (or flexlink) depends on the Ocaml compiler and the Ocaml compiler depends = on flexdll. I wonder how one is supposed to build Ocaml for Mingw from scra= tch? One either needs prebuilt flexdll/flexlink or Ocaml. What does work is= to first build a native Cygwin Ocaml, then flexlink using this one and the= n the MingW Ocaml, but then flexlink depends on the Cygwin dlls. I am not s= ure how bad this is but I think ocamlc needs flexlink later as well when li= nking MingW apps. Also the effort of this is rather high. So I used a prebu= ilt flexlink/flexdll but I don't really like this. Also I wonder why flexdll/flexlink is required. The documentation of flexdl= l states: Windows DLL cannot refer to symbols defined in the main application or in p= reviously loaded DLLs. In my experience this is not true. At least when using MSVC one can declare= functions in the main executable as DLL-export. Then when linking the main= executable an import library is created in the same way as when building a= DLL by the linker. The DLL can then link to this import library and can ac= cess the functions in the main executable. The same is true for any other = dlls already loaded. I don't do this every day but I did this more than onc= e. I am not sure if this also works on old Windows OSes. I think the oldest= one on which I tested this is Windows 7. Also I don't know if gcc does sup= port creating an import library when linking an executable. If this is of interest, I could provide a small demo for this and also test= it with gcc for mingw and, if someone thinks this is useful, also on XP an= d Vista. Best regards, Michael Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Prof. Dr. Hermann Eul Chairperson of the Supervisory Board: Tiffany Doon Silva Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928 --_000_E51C5B015DBD1348A1D85763337FB6D9E9FB68CFRemusmetastackl_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

This is indeed a strange effect – bluntly, fle= xlink should be bootstrapped with the OCaml sources (i.e. a bytecode image = of flexlink should be in /boot).

 

Note that your Cygwin build-route really is missing = a step – you’re bootstrapping, so the final stage should be recompiling flexlink using your new ocamlopt (the compilers do indee= d need flexlink), then the dependency on Cygwin disappears. For my own buil= ds, I extract flexlink.exe from Alain’s binary distribution, build th= e FlexDLL objects from sources, compile OCaml and then recompile flexlink.exe using the that fresh compiler and re= place the earlier binary copy. See, for example, https://github.com/dra27/OCaml-Windows-Build/blob/master/build.cmd#L527-L57= 0

 

At some point, I was going to alter things so that F= lexDLL is the only requirement for pre-installation (as that can be built f= rom source) and have the ocaml process use boot/flexlink if a binary flexli= nk isn’t available… but as that’s only to satisfy a religious fervour to remove the circular dependency, it&= #8217;s right down at the bottom of my personal task list, especially as I = doubt it would be merged :o)

 

Regarding the reason for FlexDLL, the solution for t= ricking the linker does also work for gcc – see http://edll.sourceforge.net/= #def_a (which is referenced from FlexDLL’s webpage). I expect Ala= in’s motivation for FlexDLL is that the “side-effects” re= ferred to in http://alain.frisc= h.fr/flexdll.html#examples were known about beforehand which the .def/.= a solution doesn’t solve, especially as it makes the build process mo= re complicated.

 

 

David

 

 

From: caml-list-request@inria.fr [mailto:caml-list-request@= inria.fr] On Behalf Of Soegtrop, Michael
Sent: 24 October 2015 10:51
To: caml-list@inria.fr
Subject: [Caml-list] flexdll circular dependency on ocamlc: Impossib= le to built ocaml for mingw without using some prebuilt binaries?

 

Dear Ocaml Users,

 

building Ocaml for Mingw on Cyg= win I came across a strange effect: flexdll (or flexlink) depends on the Oc= aml compiler and the Ocaml compiler depends on flexdll. I wonder how one is= supposed to build Ocaml for Mingw from scratch? One either needs prebuilt flexdll/flexlink or Ocaml. What does wo= rk is to first build a native Cygwin Ocaml, then flexlink using this one an= d then the MingW Ocaml, but then flexlink depends on the Cygwin dlls. I am = not sure how bad this is but I think ocamlc needs flexlink later as well when linking MingW apps. Also the effo= rt of this is rather high. So I used a prebuilt flexlink/flexdll but I don&= #8217;t really like this.

 

Also I wonder why flexdll/flexl= ink is required. The documentation of flexdll states:

 

Wi= ndows DLL cannot refer to symbols defined in the main application or in pre= viously loaded DLLs.

 

In my experience this is not tr= ue. At least when using MSVC one can declare functions in the main executab= le as DLL-export. Then when linking the main executable an import library i= s created in the same way as when building a DLL by the linker. The DLL can then link to this import library and can = access the functions  in the main executable. The same is true for any= other dlls already loaded. I don’t do this every day but I did this = more than once. I am not sure if this also works on old Windows OSes. I think the oldest one on which I tested this i= s Windows 7. Also I don’t know if gcc does support creating an import= library when linking an executable.

 

If this is of interest, I could= provide a small demo for this and also test it with gcc for mingw and, if = someone thinks this is useful, also on XP and Vista.

 

Best regards,=

 

Michael

 

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de=
Managing Directors: Christin Eisenschmid, Prof. Dr. Hermann Eul
Chairperson of the Supervisory Board: Tiffany Doon Silva
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

--_000_E51C5B015DBD1348A1D85763337FB6D9E9FB68CFRemusmetastackl_--