From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25798 invoked by alias); 31 Jul 2015 14:20:27 -0000 Mailing-List: contact jit-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: jit-owner@gcc.gnu.org Received: (qmail 25782 invoked by uid 89); 31 Jul 2015 14:20:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.98.7 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mx1.redhat.com Message-ID: <1438351930.9683.32.camel@surprise> Subject: Re: Has anyone tried building for Windows? From: David Malcolm To: Mukul Sabharwal Cc: Dibyendu Majumdar , Hayden Livingston , jit@gcc.gnu.org Date: Thu, 01 Jan 2015 00:00:00 -0000 In-Reply-To: References: <1438166692.9683.17.camel@surprise> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-SW-Source: 2015-q3/txt/msg00126.txt.bz2 On Fri, 2015-07-31 at 00:14 -0700, Mukul Sabharwal wrote: > For GCCSharp [https://github.com/mjsabby/GCCSharp], I did get GCC with > the JIT frontend working* but with modifications. I've been wanting to > tell Dave about them, so here is the very short list: Thanks for posting this. > (1) `fchmod` in playback::compile_to_file::copy_file isn't supported > on MinGW - maybe put this behind an ifdef? Perhaps that whole function could be replaced with a call to ::CopyFile on Windows? (and ::GetLastError). > (2) `dlopen` and dl* family of things in > playback::context::dlopen_built_dso - again, on MinGW toolset this > isn't available. Since this is not essential to the JIT API, maybe > also make this something a user can opt out of? > > So, the working* in my case was essentially generating .S files > (GCC_JIT_OUTPUT_KIND_ASSEMBLER) My Windows expertise is very rusty, but I believe something equivalent could be cooked up using ::LoadLibrary, ::GetProcAddress, and ::FreeLibrary. (IIRC, Windows doesn't require the extension for the jit-generated shared library to be ".dll"; I seem to remember in my past life as a game developer working with plugins for apps that had other extensions). > If there is an interest in having a LIBGCCJIT.DLL built with these > modifications, I can certainly make a GitHub repo with some sort of > binary and source drops. I'm particularly interested in *how* you built it; a recipe would be good to hear (I don't have a Windows development box handy, but maybe it can run under Wine). You mention "source drops" - note that for non-trivial changes, there are some legal requirements that must be followed before I can commit them back to the source tree; see: https://gcc.gnu.org/contribute.html#legal But if it's a case of simply #ifdef-ing a few lines out, that may be below the threshold (I am not a lawyer). Dave > Mukul > > > On Wed, Jul 29, 2015 at 12:51 PM, Dibyendu Majumdar > wrote: > > On 29 July 2015 at 11:44, David Malcolm wrote: > >> On Tue, 2015-07-28 at 22:43 -0700, Hayden Livingston wrote: > >>> I've attempted to build on Windows using Cygwin and MingW-64 and I'm > >>> not really familiar with the build system enough but I can't make any > >>> forward progress. > >> > >> Thanks for trying this. As far as I know, you're the first person who's > >> attempted this. > >> > > > > I tried a few days ago - but could not even get configure to work. It > > kept complaining about missing mpfr, gmp, mpc even though these were > > installed. I was using msys2 as the environment with mingw64 > > compilers. In the end decided life is too short and I have many other > > things I need to do. > > > > Does gcc even compile on Windows without patches from mingw project? > > > > It is a pity as LLVM code generated on Windows has a serious > > deficiency - longjmp calls cause crash as the generated code doesn't > > conform to Windows requirements. I was hoping that gcc generated code > > would not suffer from this. > > > > Regards > > Dibyendu