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

[RFC] Add -Xcc= compiler switch #10441

Merged
merged 2 commits into from Oct 13, 2019

Conversation

CyberShadow
Copy link
Member

@CyberShadow CyberShadow commented Sep 26, 2019

This aims to replace -preview=noXlinker and address the same problems it aimed to address, however, without breaking pre-existing dmd.conf files or linker scripts.

-X in DMD already has a meaning (it deals with emitting JSON metadata and related options); the switch name was chosen to match the LDC switch with the same name and behavior.

TODO:

  • Ensure this solves the same class of problems as -preview=noXlinker. (The supplied test does work.)
  • Ensure this switch adds value over CC='cc ...'
  • Ensure this is reasonably compatible with the behavior of LDC's switch
  • Restrict to affected platforms
  • Add documentation
    • Changelog entry
    • -help entry
    • man pages / dlang.org/compiler pages

A global on/off switch, intended to become the default, which caused
all pre-existing dmd.conf files to be invalid and broke linking
scripts, might not be the optimal solution.
@airwin1
Copy link

airwin1 commented Sep 29, 2019

I have had success with my first test of this PR on Linux with the test_d project! So that is a promising start that should encourage you to quickly mature this PR.

The test_d project is a small self-contained project to test my CMake D language support under a wide variety of circumstances for any Posix or Windows platform for any D compiler (e.g., your PR for dmd) which is installed or can be built and installed on those platforms.

@CyberShadow I highly encourage you to try test_d yourself now and later as you mature your PR. Although test_d is completely self-contained (it refers to no files outside its own source tree) the top-level directory of this test_d source-tree is located at cmake/test_d within the PLplot git repository. Here is how to gain access to test_d and comprehensively test any version of dmd with that project:

# Make sure this directory does not exist before the clone
rm -rf plplot.git
git clone https://git.code.sf.net/p/plplot/plplot plplot.git
# Change to the top-level directory of the test_d project
cd plplot.git/cmake/test_d

Then look in the README file in that top-level directory for further instructions about how to comprehensively test CMake D language support for dmd with this project. Note that currently test_d does not test the -pthread C compiler option that via -Xcc for this PR could be passed to the C compiler that is called by dmd. But see the plplot git log message for commit 9251b9540 for further plans concerning implementing such a test, and thus testing -Xcc with test_d. And once -pthread works for test_d it should be straightforward to update the plplot build system so it also works for the plplot project (which has its own comprehensive test script). So there is a lot to look forward to here as you mature your PR and as I mature the CMake build systems for first test_d, and second plplot.

@airwin1
Copy link

airwin1 commented Sep 30, 2019

I have now (PLplot commit ab8a90546) changed the C library of the test_d project to use the -pthread link option, and for a dmd version corresponding to this pull request (and ldc2) showed the -Xcc=-pthread option (which translates to the -pthread option for the underlying C compiler that is used for linking by dmd and ldc2) works well. (For further details see the commit message for ab8a90546.) So these are quite promising results that indicate this version of dmd (and also ldc2) should (with a bit of extra work on my part) also work well for the much more complex PLplot project. (The third choice of D compiler, gdc, already works well for both test_d and PLplot.)

@CyberShadow In sum, the test_d support of a version of dmd corresponding to this PR has matured (at least on my Linux platform and likely Mac OS X as well), and I am pretty sure I will soon be able to say the same thing concerning the PLplot project. So I am fairly rapidly reaching my -pthread test goals here, and as a result I look forward to you maturing this PR so it is in good shape to be merged for the next release of dmd.

@CyberShadow
Copy link
Member Author

CyberShadow commented Oct 1, 2019

Ensure this is reasonably compatible with the behavior of LDC's switch

The switch in LDC is defined as follows:

cl::list<std::string>
    ccSwitches("Xcc", cl::CommaSeparated,
               cl::desc("Pass <ccflag> to GCC/Clang for linking"),
               cl::value_desc("ccflag"), cl::cat(linkingCategory));

I'm slightly worried about cl::CommaSeparated, as indeed -Xcc=-opt1,-opt2 translates to distinct options on gcc's command line. This is not what the current implementation here does, should it be changed to match? Though, I see that LDC uses cl::CommaSeparated in other places, so maybe this is not something we should worry about.

@CyberShadow In sum, the test_d support of a version of dmd corresponding to this PR has matured (at least on my Linux platform and likely Mac OS X as well), and I am pretty sure I will soon be able to say the same thing concerning the PLplot project. So I am fairly rapidly reaching my -pthread test goals here, and as a result I look forward to you maturing this PR so it is in good shape to be merged for the next release of dmd.

Great. I had a look at test_d, and though I'm not that familiar with CMake to fully understand it, I think I can see that it also answers an important question in whether the ability to set the CC environment variable would be sufficient to achieve the same goal (and it doesn't look like that is the case), which justifies adding this switch.

@CyberShadow CyberShadow marked this pull request as ready for review October 1, 2019 05:52
@airwin1
Copy link

airwin1 commented Oct 6, 2019

@CyberShadow How do I get access to your -Xcc work now?

Here is what happened with the old method (after a git fetch):

software@merlin> git checkout pull-20190926-222551
Switched to branch 'pull-20190926-222551'
Your branch and 'CyberShadow/pull-20190926-222551' have diverged,
and have 1 and 1 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

But executing "git pull" lead to two conflicts which I don't think should be my business to resolve, but I thought I should let you know about those in case you were unaware of them.

In case it makes any difference here are my notes of exactly what I did to get access to your
work before from an already established local dmd repository.

# He recommended
# git remote add --fetch CyberShadow https://github.com/CyberShadow/dmd
# but I can find no mention of that --fetch option so I did this
# instead:

# N.B. no --fetch option
software@merlin> git remote add CyberShadow https://github.com/CyberShadow/dmd
# Show status of remotes
software@merlin> git remote --verbose
CyberShadow     https://github.com/CyberShadow/dmd (fetch)
CyberShadow     https://github.com/CyberShadow/dmd (push)
origin  https://github.com/dlang/dmd (fetch)
origin  https://github.com/dlang/dmd (push)
# Fetch all those remotes
software@merlin> git fetch --all
Fetching origin
Fetching CyberShadow
[...] listing of zillions of branches by CyberShadow

# Gain access to his branch that is relevant to -Xcc
software@merlin> git checkout pull-20190926-222551
Branch 'pull-20190926-222551' set up to track remote branch 'pull-20190926-222551' from 'CyberShadow'.
Switched to a new branch 'pull-20190926-222551'

@CyberShadow
Copy link
Member Author

CyberShadow commented Oct 6, 2019

I did some TODOs and squashed the commits into one, so that caused the merge failure.

$ git fetch CyberShadow
$ git checkout pull-20190926-222551
$ git reset --hard CyberShadow/pull-20190926-222551

should work.

@airwin1
Copy link

airwin1 commented Oct 6, 2019

Thanks for that git suggestion which did work. For the record (since these "remote" manipulations are all new to me) here is exactly what I did, and the git response.

software@merlin> git fetch CyberShadow
software@merlin> git checkout pull-20190926-222551
Already on 'pull-20190926-222551'
Your branch and 'CyberShadow/pull-20190926-222551' have diverged,
and have 1 and 1 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
software@merlin> git reset --hard CyberShadow/pull-20190926-222551
HEAD is now at c45c17327 Add -Xcc= compiler flag
software@merlin> git status
On branch pull-20190926-222551
Your branch is up to date with 'CyberShadow/pull-20190926-222551'.

nothing to commit, working tree clean

So this indicates there have been no code changes on this branch since I last pulled it. I understand the reason for this lack of activity is you are waiting for those reviews. But I do admit to getting a little antsy about how soon the decision will be made about whether your work or the changed -L semantics approach will be getting into the next release which is only 3 weeks from now. So I hope those reviews are completed soon so you can move closer to making the decision.

@CyberShadow
Copy link
Member Author

@kinke Any thoughts on the LDC comma question?

@WalterBright probably wants to know whenever a compiler switch is to be added.

@kinke
Copy link
Contributor

kinke commented Oct 6, 2019

I think commas support would be nice, similar to gcc/clang -Wl,arg1,arg2,arg3,....

More important though IMO is the correct order wrt. -Xcc and -L - dmd -Xcc=gccArg1 -LldArg1 -Xcc=gccArg2 -LldArg2 resulting in gcc gccArg1 -Xlinker ldArg1 gccArg2 -Xlinker ldArg2.

@CyberShadow
Copy link
Member Author

I think commas support would be nice, similar to gcc/clang -Wl,arg1,arg2,arg3,....

If we are doing this, then it raises the question of what to do with existing switches, where DMD interprets the comma literally but LDC as a delimiter.

More important though IMO is the correct order wrt. -Xcc and -L - dmd -Xcc=gccArg1 -LldArg1 -Xcc=gccArg2 -LldArg2 resulting in gcc gccArg1 -Xlinker ldArg1 gccArg2 -Xlinker ldArg2.

I think we're good here...

@airwin1
Copy link

airwin1 commented Oct 7, 2019

CyberShadow said "I think we're good here..." [with regard to preserving order of -Xcc and -L options in generated gcc result].

@kinke I just confirmed option order was preserved with my own build of Cybershadow's work.

Copy link
Member

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get this in before the merge window closes in two days.

@@ -266,6 +264,7 @@ extern (C++) struct Param
// Linker stuff
Array!(const(char)*) objfiles;
Array!(const(char)*) linkswitches;
Array!bool linkswitchIsForCC;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could have also defined a struct of both properties and then just used a single array.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Though, that would have involved touching all the other platforms' linker driver code. Can refactor in a follow-up.

@wilzbach
Copy link
Member

CC @atilaneves

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @CyberShadow!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + dmd#10441"

@dlang-bot dlang-bot merged commit e1ea20d into dlang:master Oct 13, 2019
@airwin1
Copy link

airwin1 commented Oct 14, 2019

I wanted to test this merge to the master branch to make sure it continues to work as well as this PR.
However, my bash build script for building and testing the master branch version of dmd, phobos, etc., is now failing on tests because of the following libphobos issue:

software@merlin> ldd -r install/linux/lib64/libphobos2.so
        linux-vdso.so.1 (0x00007ffd107eb000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0f6836b000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0f681e8000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0f681e3000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f0f681d9000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f0f681bf000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0f67ffe000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f0f689d7000)
undefined symbol: _D4core6thread8PAGESIZEym     (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread6Thread7__ClassZ        (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread6Thread7__ClassZ        (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread5Fiber7__ClassZ (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread6Thread8isDaemonMFNdNiNfbZv     (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread6Thread7getThisFNbNiNfZCQBkQBiQBe       (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread6Thread4joinMFbZC6object9Throwable      (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread5Fiber5stateMxFNaNbNdNiNfZEQBnQBlQBh5State      (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread6Thread8priorityMFNdiZv (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread6Thread12PRIORITY_MINFNaNbNdNiNeZi      (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread6Thread8isDaemonMFNdNiNfZb      (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread6Thread5yieldFNbNiZv    (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread6Thread7opApplyFMDFKCQBhQBfQBbZiZi      (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread5Fiber6__ctorMFNbDFZvmmZCQBlQBjQBf      (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread6Thread6__ctorMFNaNbNiNfDFZvmZCQBrQBpQBl        (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread5Fiber5yieldFNbNiZv     (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread5Fiber7getThisFNbNiNfZCQBjQBhQBd        (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread6Thread8priorityMFNdZi  (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread5Fiber4callMFEQBaQyQt7RethrowZC6object9Throwable        (install/linux/lib64/libphobos2.so)
undefined symbol: _D4core6thread6Thread5startMFNbZCQBfQBdQz     (install/linux/lib64/libphobos2.so)

I am not sure whether this issue is due to some issue with the present merge (as opposed to the pull request which is fine) or some other independent issue with the master branch. In any case, I thought I should report this master branch issue here first. If you have any trouble replicating it please let me know what else you think I should try with regard to building libphobos. Note, I am using my standard bash script to make a consistent build, test, and install of dmd, libphobos, etc. that starts from scratch (with all old results removed). That script worked roughly a month ago with no configuration, build, test, or install issues. But if you are having difficulty replicating the above issue with the installed version of libphobos, then please let me know if you are aware of any change in the build procedure for libphobos in the last month, and meanwhile I will be researching that possibility as well.

@CyberShadow
Copy link
Member Author

Digger works fine for me, if it's the same for you then you could narrow down the problem by examining the differences in what commands the two run.

@Geod24
Copy link
Member

Geod24 commented Oct 15, 2019

This looks like stale built artifacts.
Try to git pull --ff-only <upstream> master (replacing upstream with the appropriate remote), make -f posix.mak clean in all 3 repositories, then build again.

@rainers
Copy link
Member

rainers commented Oct 15, 2019

undefined symbol: _D4core6thread6Thread7__ClassZ

core.thread has been refactored to a package, so it's likely that there is still a core/thread.d in your druntime import folder that phobos uses instead of the package.

@airwin1
Copy link

airwin1 commented Oct 15, 2019

@CyberShadow The short story is thanks for your quick response which helped me to (eventually) solve this issue. The (good) "ldd -r" results I get now are

software@merlin> ldd -r install/linux/lib64/libphobos2.so
        linux-vdso.so.1 (0x00007ffc0a50f000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f52be746000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f52be5c3000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f52be5be000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f52be5b4000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f52be59a000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f52be3d9000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f52bedb2000)

And I should mention that my test_d project runs without issues for this latest build and install.

The longer story is that response showed you could not replicate the issue with digger which inspired me to review exactly what my script and the relevant Posix Makefiles were doing, and it turned out the ldd error for phobos that I documented in my previous post was caused by not building the "clean" target for druntime before the build and install of dmd and phobos. That is, somehow stale build files for druntime were so severely interfering with the phobos build that ldd was failing for the installed version of libphobos! This obscure interaction between phobos and druntime certainly violates the "least surprise" principle. And something similar happens for the install target for druntime (which I fixed when I first implemented this script).

In my defense, all of these issues in my build script that I have had to address are due to the seriously incomplete documentation at https://wiki.dlang.org/Building_under_Posix. A minor issue is that page does not state the default target name (which turns out to be "all" for dmd and phobos). Much more seriously, that wiki page says absolutely nothing about the "clean" (dmd, phobos, and druntime) targets that must be built before the "all" (dmd and phobos) targets; the "install" (dmd, phobos, and druntime) targets that must be be built after the "all" targets; and the test (dmd) and unittest(phobos) targets that must be built after the "install" targets. See the attached latest version of my build script. All these additional undocumented targets and especially the order in which they should be built and for which repositories should be of interest to any serious builder/tester of dmd and phobos such as me. So I hope you view these remarks as an informal bug report concerning the incomplete content of https://wiki.dlang.org/Building_under_Posix which I hope you would be willing to address in your copious spare time. :-) Seriously, though, if you cannot make such a commitment any time soon, let me know, and I will open a separate bug report about this dmd wiki content issue.

@airwin1 if you could file a bug report with the text you just posted, that would be good.

Will do!

@WalterBright
Copy link
Member

@airwin1 if you could file a bug report with the text you just posted, that would be good.

@wilzbach
Copy link
Member

was caused by not building the "clean" target for druntime before the build and install of dmd and phobos.

You shouldn't need to run clean. If you update your source via git pull, they will rebuild automatically on make -f posix.mak. So that's a bug in the Makefile then.

Much more seriously, that wiki page says absolutely nothing about the "clean"

Because you typically don't need to and this page documents the first-timer build from scratch.

and the test (dmd) and unittest(phobos) targets that must be built after the "install" targets.

FYI: You don't need to run install. You can directly use dmd from e.g. dmd/generated/linux/release/64/dmd.

All these additional undocumented targets and especially the order in which they should be built and for which repositories should be of interest to any serious builder/tester of dmd and phobos such as me.

I'm sorry that this caused troubles for you, but it's really just:

for repo in dmd druntime phobos
  cd repo
  git fetch upstream && git merge --ff-only upstream/master
  make -f posix.mak -j10
  cd ..

Though tester can just use digger or the nightly builds - both should be much easier.

@airwin1
Copy link

airwin1 commented Oct 15, 2019

@Geod24 commented > This looks like stale built artifacts.

It turns out you were absolutely right. But as soon as I saw Cybershadow's post I put my head down and figured out the issue which could be immediately solved by the brute-force approach of starting with a fresh clone of each repository each time, but it took me a lot longer to figure out a more sophisticated approach, i.e., find the missing clean target build in my script and figure out how to test for any remaining stale build files (with "git status --ignored") after the build of each clean target.

Which reminds me that although your clean target for phobos was fine, your clean targets for dmd and druntime need work, i.e.,that git status test after building the clean target showed the following results for dmd:

 Ignored files:
  (use "git add -f <file>..." to include in what will be committed)

        test/mixin.o
        test/mymod.o
        test/runnable-test13504.lst
        test/runnable-test18296.lst
        test/trace.def
        test/trace.log

and the following result for druntime:

Ignored files:
  (use "git add -f <file>..." to include in what will be committed)

        druntime.json

Evidently, these stale build files are not a serious issue that interferes with good test results. Nevertheless, I assume the dmd developers would like these issues to be fixed. So again, if nobody here wants to fix those issues immediately, I would be willing (sigh) to fill in a separate bug report for each, but as you can no doubt tell from that sigh, I hope this informal report is sufficient for what I assume are trivial, easy-to-fix issues.

@airwin1
Copy link

airwin1 commented Oct 15, 2019

@wilzbach said:

was caused by not building the "clean" target for druntime before the build and install of dmd and phobos.

You shouldn't need to run clean. If you update your source via git pull, they will rebuild automatically on make -f posix.mak. So that's a bug in the Makefile then.

Much more seriously, that wiki page says absolutely nothing about the "clean"

Because you typically don't need to and this page documents the first-timer build from scratch.

and the test (dmd) and unittest(phobos) targets that must be built after the "install" targets.

FYI: You don't need to run install. You can directly use dmd from e.g. dmd/generated/linux/release/64/dmd.

All these additional undocumented targets and especially the order in which they should be built and for which repositories should be of interest to any serious builder/tester of dmd and phobos such as me.

I'm sorry that this caused troubles for you, but it's really just:

for repo in dmd druntime phobos
  cd repo
  git fetch upstream && git merge --ff-only upstream/master
  make -f posix.mak -j10
  cd ..

Though tester can just use digger or the nightly builds - both should be much easier.

Sure, for a perfect build system you should not have to build clean targets. But we do live in an imperfect world so I disagree with you that the clean targets do not need documentation in what is recommended as the wiki entry on building dmd on Posix systems (so that is definitely not just a page for beginners).

I agree a nightly build would likely have been much easier for me, but as a matter of principle I do like to figure out how to build free software from that software's documentation.

Your assertion that dmd can be run from the build tree is correct. In fact, I was forced to do that for early versions of my build script that did not deal with the druntime install I mentioned. However, experienced builders of lots of different free software like me tend to like to run install-tree results whenever possible. The substantial saving of disk space between the build tree and install tree obviously does not matter much if either (a) you have a build system that forces you to build in the source tree rather than a separate build tree or (b) your are building using a source tree that is the working directory of a local git repository where that git repo size is obviously going to be huge compared to either the build tree or install tree size. But in any case most free software projects I have been experienced with do implement a separate build tree because users of those projects prefer pristine source trees that contain no stale build results by definition regardless of whether the source tree is a git working directory or a tarball unpack. Anyhow, out of habit I did try the dmd install, and I had to do some extra steps to debug that install because of the seriously incomplete documentation of the Posix build instructions that I have already mentioned.

By the way, I do realize your experience developing and building and testing dmd is likely far outside my experience with other free software projects. Also, I haven't used proprietary software since 1996 (except for my direct use of the BIOS on the computers I have bought in the two decades since and my indirect use via web servers) as a long-standing free software principle I live by. So I am pretty sure that building and testing like I do from a locally cloned repository because I want to avoid the github proprietary add-ons as much as possible may be far outside your experience. So we may have to simply write off the differences in our two approaches as a culture clash and leave it there since it appears that other dmd developers are definitely interested in getting that Posix build wiki entry updated properly for this J. Random Builder that doesn't do building, testing, and using dmd in exactly the same way that dedicated dmd developers likely do that. :-)

@airwin1
Copy link

airwin1 commented Oct 15, 2019

To sum up my dmd build experiences so far, from my "J. Random Builder" perspective, I don't like the dmd build system because there doesn't appear to be any way to have a separate build tree that allows me to maintain an absolutely pristine source tree; the obscure interactions between the phobos build and druntime build, clean, and install targets that violates the principle of least surprise and demonstrably has screwed up my recent install; apparently a separate build procedure for Windows versus Posix; and a hard-coded install directory that makes it gratuitously difficult to package dmd for free software distributions (which is likely one of the reasons that Debian Buster, for example, has not packaged dmd whereas they have long since already packaged gdc and ldc2). But that is the end of my bitching about these dmd, phobos, and druntime build-system issues in this post, and the rest of this is dedicated to an idea I have for permanently fixing these issues.

I am quite busy continuing to develop my own free software projects on Linux so despite being a retiree, I don't have a lot of time to help out with dmd. Nevertheless, if there is any dmd developer here that is similarly concerned with what I think of as pretty bad deficiencies in the dmd, phobos, and druntime build systems, please get in touch with me at airwin@users.sourceforge.net to see whether we can address these issues together.

But to summarize what I had in mind, I would be willing to collaborate with such a dmd developer or developers to implement a "super-build" CMake-based build system for dmd, phobus, and druntime that could almost trivially handle all the git aspects of keeping all repositories up to date with each other and to configure the clean, all, install, test, and unittest targets I have been discussing in a reliable, cross-platform way.

Note that CMake typically co-exists happily with other build systems. Which makes it trivially easy to carefully compare results for building the targets configured by one CMake-based "super-build" system with what your current Posix and Windows builds for each separate repository are currently generating as a result of building the targets that are implemented for each of those build systems.

I do have much more than casual experience with CMake. For example, I have had more than 10 years of intense experience with being the go-to guy for the CMake-based build system for PLplot. Typically, the plplot software project (as opposed to certain parts of the PLplot source tree) is not organized as a super-build project, but within the PLplot source tree I implemented roughly 5 years ago a large super-build project (located at cmake/epa_build within the PLplot source tree) that attempted to build PLplot and most of the large number of external libraries it uses (e.g., Qt and a large subset of the GTK suite of software libraries) on both Linux and Windows. I had complete success with epa_build on Linux, and I almost (aside from a small fraction of the GTK software libraries) also had complete success for traditional MinGW/MSYS (not MinGW-w64/MSYS2 since MSYS2 was not available back then, you don't need something like epa_build on that platform because that distribution provides pre-built system versions of most PLplot prerequisites and, in any case, MSYS2 currently does not work properly on the Wine version of Windows).

Therefore due to that old super-build implementation experience I am confident I could implement the framework for such a super-build system that did all the relevant cleans, build, and installs for each repository in the right order on Linux. And that super-build would be quite near to working on non-Linux free software distributions such as fink, MacPorts, and Homebrew on Mac OS X and MSYS2 on Windows. Of course, that framework would just be the start that could likely be implemented by me in just a week or so, and the hard grafting (which I would cheerfully leave to my dmd colleagues!) would be to implement the configuration of the many different test targets in the same way they are implemented now with your present build systems for each of your repositories and to test the result on all Linux and non-Linux platforms my potential dmd collaborators have access to.

Of course, once that hard grafting was done on the testing front by my collaborators, it would be completely straightforward to generalize those results from test targets to Ctest results and the associated dashboards of results you can submit from those to any free (in both senses) dashboard server such as my.cdash.org. So I would be willing to contribute that extension as well if there is any interest by dmd developers in it. However, I assume from a previous discussion here there would likely be a large culture clash between my typical development experience and that of my potential dmd collaborators. For example, you may be completely happy using github proprietary software (digger?) that does the equivalent of CTest (unless and until github starts charging for use of their proprietary software).

But even if you ignore that good (from the free software perspective) CTest possibility, I still think a CMake-based super-build system that configures clean, all, install, and many different test targets for each of dmd, phobos, and druntime in an absolutely reliable (no violation of the principle of least surprise) and cross-platform way is well worth having. So if somebody here is truly interested and inspired by this possibility (i.e., they would be prepared to carry on with the test target implementation and on-going maintenance of this proposed CMake-based super-build system once I gave them a big start), then please get in touch with me if you want me to start working on my (start-up/proof-of-concept) part of this.

@airwin1
Copy link

airwin1 commented Oct 29, 2019

@WalterBright

From the "better late than never" department, I wanted to generate new issues today concerning the incomplete clean targets I mentioned above for the dmd and druntime repositories, and the incomplete documentation of the wiki item mentioned above.

However, today I seem to be blocked from creating new issues. I logged in, and followed the directions at https://help.github.com/en/github/managing-your-work-on-github/creating-an-issue but to no avail. What do I need to do to create new issues for dmd, druntime, etc.?

@CyberShadow
Copy link
Member Author

However, today I seem to be blocked from creating new issues. I logged in, and followed the directions at https://help.github.com/en/github/managing-your-work-on-github/creating-an-issue but to no avail. What do I need to do to create new issues for dmd, druntime, etc.?

As documented in the README, issues are to be filed at https://issues.dlang.org/ .

@airwin1
Copy link

airwin1 commented Oct 30, 2019

@CyberShadow Thanks for that hint (which I needed because I am working simultaneously with too many different bug trackers and development platforms). As promised I have now collected all build issues I noticed above into the following four bug reports:

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