public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: Mukul Sabharwal <mjsabby@gmail.com>
Cc: Dibyendu Majumdar <mobile@majumdar.org.uk>,
	Hayden Livingston <halivingston@gmail.com>,
	jit@gcc.gnu.org
Subject: Re: Has anyone tried building for Windows?
Date: Thu, 01 Jan 2015 00:00:00 -0000	[thread overview]
Message-ID: <1438351930.9683.32.camel@surprise> (raw)
In-Reply-To: <CAC6Eoopit+5hLjEV7UNnNehJCMFuf++tHEA=ahWR7rbseBbXqg@mail.gmail.com>

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
> <mobile@majumdar.org.uk> wrote:
> > On 29 July 2015 at 11:44, David Malcolm <dmalcolm@redhat.com> 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


  parent reply	other threads:[~2015-07-31 14:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-01  0:00 Hayden Livingston
2015-01-01  0:00 ` David Malcolm
2015-01-01  0:00   ` Dibyendu Majumdar
2015-01-01  0:00     ` Mukul Sabharwal
2015-01-01  0:00       ` Dibyendu Majumdar
2015-01-01  0:00       ` David Malcolm [this message]
2015-01-01  0:00         ` Mukul Sabharwal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438351930.9683.32.camel@surprise \
    --to=dmalcolm@redhat.com \
    --cc=halivingston@gmail.com \
    --cc=jit@gcc.gnu.org \
    --cc=mjsabby@gmail.com \
    --cc=mobile@majumdar.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).