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

DPP Windows support for MongoC and Mondo #190

Open
Laeeth opened this issue Oct 21, 2019 · 13 comments
Open

DPP Windows support for MongoC and Mondo #190

Laeeth opened this issue Oct 21, 2019 · 13 comments
Assignees

Comments

@Laeeth
Copy link

Laeeth commented Oct 21, 2019

Related to #182
Two ways to use Mongo DB in D - vibe and mondo. Problem is that pulling in vibe means pulling in quite a lot and tends to be fragile and break with new releases of DMD. Furthermore, vibe static constructor interacts badly with D bug in running static constructors twice for shared library on Linux and some entirely different bug on Windows (ask John).

For the time being, it's necessary for us to talk to Mongo even though it's by far not my cup of tea personally.

So I'd like to use Mondo to do this.

However Mondo is built using a hacked-together script around dstep and this only works on Linux.

I forked Mondo and replaced the dstep build script with something much simpler based on dpp. That works for Linux and ought to work on Windows, but dpp didn't quite work and now does thanks to @adamdruppe @veelo and others.

Since it's an important use case, if you are agreeable then would like to have this be one of the integration tests for dpp. If feel strongly against, then fine - the carbon integration tests should catch problems.

Sequence:

  1. Two below depends on mongoc and bsonc libraries. See the docs for those on how to build on Windows - it uses cmake so should not be that bad. Make sure at least you can build these on Windows and make a script to clone the original repos (we should be able to choose the branch/tag we want), build them and install in relevant subdir of extern_deps

  2. https://github.com/symmetryinvestments/mondo Make sure this works on Windows. Ignore the dstep based script and uncomment the preGenerate lines in the dub.sdl.

  3. Make sure we have a new release of dpp that actually incorporates Windows support. Make sure README is up to date - that it works on Windows and how to use it.

  4. Announce on forums saying work has been sponsored by Symmetry.

  5. Send PR to upstream mondo explaining decisions and that it adds Windows support. PR should also update README so it's clear.

@adamdruppe @atilaneves @John-Colvin

@adamdruppe
Copy link
Contributor

dpp takes ages to build those files. I can't really recommend having users go through that; really I'd bundle the C lib and the translation ahead and only run the script if those versions change.

I don't know why it is so slow, my guess is just going through a LOT of include files - there's an #include<windows.h> in there.... heck an #include<algorithm> too but windows.h is huge.

@adamdruppe
Copy link
Contributor

it might be a good idea to make dpp actually recognize windows.h and skip it - just replace that with the premade core.sys.windows.windows in D, unless an override switch is given.

@adamdruppe
Copy link
Contributor

yeah an isolated test confirms windows.h itself is the brutal slowness. gotta do something about that. i just don't know what yet.

@adamdruppe
Copy link
Contributor

alias PMETARECORD = __unaligned tagMETARECORD*;

it generated that trying to do a windows.h test too, which is a syntax error.

and this too

    static if(!is(typeof(PROFILE_EMBEDDED))) {
        enum PROFILE_EMBEDDED = 'MBED';
    }

prolly msvc extensions. but it also took like an hour to generate this file,

@Laeeth
Copy link
Author

Laeeth commented Oct 24, 2019

Fine near term if we vendor Windows. Being able to do this at all allows making Carbon a plug-in which opens up a lot.

Longer term yes I agree. @aneves ?

@Laeeth
Copy link
Author

Laeeth commented Oct 24, 2019

I guess DPP needs simple instrumentation too ?

@adamdruppe
Copy link
Contributor

so while lying in bed last night i thought of a few potential solutions. first i want to change the thing to enable those extensions. so i'll fix that in dpp so windows.h does work.

but then I plan on making it just skip windows.h. clang can parse it quickly enough, so it will do that, but no need to output 30,000 lines of translated D jsut because it was referenced. just importing core.sys.windows.windows ought to work in 99% of cases.

i work slowly on windows but i should have this finished later today.

@atilaneves
Copy link
Owner

so while lying in bed last night i thought of a few potential solutions. first i want to change the thing to enable those extensions. so i'll fix that in dpp so windows.h does work.

but then I plan on making it just skip windows.h. clang can parse it quickly enough, so it will do that, but no need to output 30,000 lines of translated D jsut because it was referenced. just importing core.sys.windows.windows ought to work in 99% of cases.

i work slowly on windows but i should have this finished later today.

Easiest is to ignore windows.h via the command-line, similarly to the existing options to ignore namespaces.

@adamdruppe
Copy link
Contributor

adamdruppe commented Oct 24, 2019 via email

@atilaneves
Copy link
Owner

On Thu, Oct 24, 2019 at 06:29:02AM -0700, Atila Neves wrote: Easiest is to ignore windows.h via the command-line, similarly to the existing options to ignore namespaces.
is this already there?

No, but is very easy to add.

@adamdruppe
Copy link
Contributor

adamdruppe commented Oct 24, 2019 via email

@aneves
Copy link

aneves commented Oct 24, 2019

Longer term yes I agree. @aneves ?

@Laeeth, not the user you meant. :)
cheers

@adamdruppe
Copy link
Contributor

eh checking on path kinda works but gotta be careful not to exclude stuff that is used while skipping stuff that are in different files but down line.

the cursors are already preprocessed by the time it gets in there :(

i'm kinda tempted to only translate symbols actually referenced in the d file. i wonder if that would work for any real world use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants