Closed aliak00 closed 5 years ago
Looks like there was a bug with formatting an error message, fixed in 895d767e20213c010123569a77ff8af827e74616.
The error is "Can't find DMD configuration file %s corresponding to DMD located at %s", but I don't know why that happens for you. How did you install the DMD version in /usr/local/bin/dmd
?
Ah I see. I install DMD via brew. And brew usually symlinks to it's own local spot, in this case:
/usr/local/bin/dmd@ -> ../Cellar/dmd/2.081.2/bin/dmd
Does DMD have a configuration file somewhere?
Yes, there should be a default configuration file included with D distributions. Does brew not install it?
Hmm. Find gives me these two:
/usr/local/etc/dmd.conf
/usr/local/Cellar/dmd/2.081.2/.bottle/etc/dmd.conf
So it seems brew puts it in user local etc.
Does DMD actually find it there?
What do you get for dmd -v | grep Config
?
Seems so:
➜ dmd -v | grep Config
Config file: /usr/local/etc/dmd.conf
Interesting.
I pushed a commit that should pull the config file location from the same place, can you try it?
Nahp. This will fix the install part:
if (result.status == 0)
foreach (line; result.output.splitLines)
if (line.findSkip("Config file: ")) // also sets line *at* position after arg
if (pathOK(line.findSplitBefore(dmdConfigName)[0])) // pathOk adds dmdConfigName so don't get that
return configPath;
So then install works:
[11:07:00:18-09-10]/Users/aliak/tmp $ dub run digger -- install
Building package digger in /Users/aliak/.dub/packages/digger-master/digger/
Performing "debug" build using dmd for x86_64.
digger ~master: target for configuration "application" is up to date.
To force a rebuild of up-to-date targets, run again with --force.
Running ../.dub/packages/digger-master/digger/digger install
digger: Found DMD executable: /usr/local/bin/dmd
digger: Found DMD configuration: /usr/local/etc/dmd.conf
digger: Found Phobos static library (libphobos2.a): /usr/local/opt/dmd/lib
digger: Found Phobos source code (std/stdio.d): /usr/local/opt/dmd/include/dlang/dmd
digger: Found Druntime import files (object.d): /usr/local/opt/dmd/include/dlang/dmd
digger: Will install:
digger: - Binaries to: /usr/local/bin
digger: - Libraries to: /usr/local/opt/dmd/lib
digger: - Phobos source code to: /usr/local/opt/dmd/include/dlang/dmd
digger: - Druntime includes to: /usr/local/opt/dmd/include/dlang/dmd
digger: This will be a new Digger installation.
digger: Backups and uninstall data will be saved in /usr/local/bin/.digger-install
digger: Preparing object list...
digger: - dmd
digger: - rdmd
digger: - libphobos2-64.a
digger: - object.di
digger: - core
digger: - std
digger: - etc
digger: Testing write access and filesystem boundaries:
digger: - /usr/local/bin
digger: - /usr/local/opt/dmd/include/dlang/dmd
digger: - /usr/local/opt/dmd/lib
digger: UID=501 GID=20 Mode=444
digger: Things to do:
digger: - Install component dmd from /Users/aliak/tmp/work/result/bin/dmd to /usr/local/bin/dmd
digger: - Install component rdmd from /Users/aliak/tmp/work/result/bin/rdmd to /usr/local/bin/rdmd
digger: - Install component libphobos2-64.a from /Users/aliak/tmp/work/result/lib/libphobos2.a to /usr/local/opt/dmd/lib/libphobos2.a
digger: - Install component object.di from /Users/aliak/tmp/work/result/import/object.d to /usr/local/opt/dmd/include/dlang/dmd/object.d
digger: - Install component core from /Users/aliak/tmp/work/result/import/core to /usr/local/opt/dmd/include/dlang/dmd/core
digger: - Install component std from /Users/aliak/tmp/work/result/import/std to /usr/local/opt/dmd/include/dlang/dmd/std
digger: - Install component etc from /Users/aliak/tmp/work/result/import/etc to /usr/local/opt/dmd/include/dlang/dmd/etc
digger: You will be able to undo this action by running `digger uninstall`.
Proceed with installation? [Y/n] Y
digger: Saving uninstall information...
digger: Backing up original files...
digger: - dmd
digger: - rdmd
digger: - libphobos2-64.a
digger: - object.di
digger: - core
digger: - std
digger: - etc
digger: Installing new files...
digger: - dmd
digger: - rdmd
digger: - libphobos2-64.a
digger: - object.di
digger: - core
digger: - std
digger: - etc
digger: Applying attributes...
digger: - dmd
digger: Warning: UID/GID mismatch for /usr/local/bin/dmd
digger: - rdmd
digger: Warning: UID/GID mismatch for /usr/local/bin/rdmd
digger: - libphobos2-64.a
digger: - object.di
digger: - core
digger: - std
digger: - etc
digger: Install OK.
digger: You can undo this action by running `digger uninstall`.
But running DMD does not work:
Failed to invoke the compiler dmd to determine the build platform: Error: cannot find source code for runtime library file 'object.d'
dmd might not be correctly installed. Run 'dmd -man' for installation instructions.
config file: not found
Specify path to file 'object.d' with -I switch
And uh... well... now I can't uninstall either 😱
dub run digger -- uninstall
Failed to invoke the compiler dmd to determine the build platform: Error: cannot find source code for runtime library file 'object.d'
dmd might not be correctly installed. Run 'dmd -man' for installation instructions.
config file: not found
Specify path to file 'object.d' with -I switch
Seems digger tramples on brew: reinstall also didn't work off the bat without some forced relinking:
[11:28:30:18-09-10]/Users/aliak/tmp $ brew reinstall dmd
==> Reinstalling dmd
==> Downloading https://homebrew.bintray.com/bottles/dmd-2.081.2.high_sierra.bottle.tar.gz
Already downloaded: /Users/aliak/Library/Caches/Homebrew/downloads/a36692ff57f5366eadc203ca4fdcd8b3224e38ff3749a77289c48f2f5a740bda--dmd-2.081.2.high_sierra.bottle.tar.gz
==> Pouring dmd-2.081.2.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/dmd
Target /usr/local/bin/dmd
already exists. You may want to remove it:
rm '/usr/local/bin/dmd'
To force the link and overwrite all conflicting files:
brew link --overwrite dmd
To list all files that would be deleted:
brew link --overwrite --dry-run dmd
Possible conflicting files are:
/usr/local/bin/dmd
/usr/local/bin/rdmd
==> Summary
🍺 /usr/local/Cellar/dmd/2.081.2: 598 files, 68.5MB
Error: Directory not empty @ dir_s_rmdir - /usr/local/Cellar/dmd/2.081.2.reinstall
[11:28:37:18-09-10]/Users/aliak/tmp $ brew link --overwrite --dry-run dmd
Would remove:
/usr/local/bin/dmd
/usr/local/bin/rdmd
[11:29:18:18-09-10]/Users/aliak/tmp $ brew link --overwrite dmd
Linking /usr/local/Cellar/dmd/2.081.2... 15 symlinks created
[11:29:25:18-09-10]/Users/aliak/tmp $ dmd --version
DMD64 D Compiler v2.081.2
Copyright (C) 1999-2018 by The D Language Foundation, All Rights Reserved written by Walter Bright
[11:29:28:18-09-10]/Users/aliak/tmp $
Okay, looks like there's still a few things missing:
And uh... well... now I can't uninstall either scream
Ah, that's coming from dub because the D compiler is broken. Invoking the Digger binary might have worked.
Do you have SYSCONFDIR
in your environment? (env | grep ^SYSCONFDIR
)
SYSCONFDIR
is set in the Brew formula:
https://github.com/Homebrew/homebrew-core/blob/master/Formula/dmd.rb#L51
Unfortunately, it doesn't look like Digger can do much about this. Brew is building a custom version, and Digger doesn't know ahead of time if the binary it builds is meant to replace Brew's build or one installed normally.
Seems it does!
You mean digger can't do an install or digger can't trample on Brew's? If the latter I think it's ok because you can brew force it back to working.
When Digger does a build can it set the conf file path itself for the DMD it builds?
When Digger does a build can it set the conf file path itself for the DMD it builds?
Hmm... there is a way. Try digger -c 'build.components.common.makeArgs=["SYSCONFDIR=/usr/local/etc"]' build
Hmm... there is a way. Try
:( did not work
Ran Digger/digger -c 'build.components.common.makeArgs=["SYSCONFDIR=/usr/local/etc"]' build v2.082.0
And then:
./work/result/bin/dmd --help | grep Config
Config file: /Users/aliak/tmp/work/result/bin/dmd.conf
Is it possible when digger builds dmd to force /Users/aliak/tmp/work/result/bin/dmd.conf
(or whoever digger is building) as the path to the conf file?
So then when you install with digger the dmd that was built with it would know where the conf file is?
That's expected, DMD looks in its directory before the system directory for a configuration file. Check what happens if you remove dmd.conf
from that location.
Ok yes you're right!
So, during digger build
step can it do the same for where the specific build's dmd.conf was put? (i.e. in work/result/bin/dmd.conf)
Then it'll work no matter where you install it right?
Sorry, I don't understand the question.
DMD looks for dmd.conf in its binary's directory, among other places, so putting a dmd.conf in /usr/local/bin (or whatever directory /usr/local/bin/dmd points to, if it's a symlink) would work, but it would be the wrong place to put it.
I don't mean moving dmd.conf, I just tried this:
Digger/digger -c 'build.components.common.makeArgs=["SYSCONFDIR=/Users/aliak/tmp/work/result/bin"]' build v2.082.0
And then Digger/digger install
Which put the new dmd in /usr/local/bin`
And then:
$ dmd -h | grep Config
Config file: /Users/aliak/tmp/work/result/bin/dmd.conf
So it "sees" the conf file it was built with
So since digger build knows where it'l' put the binary in, I'm asking if it can do the 'build.components.common.makeArgs=["SYSCONFDIR=/Users/aliak/tmp/work/result/bin"]
magic during build
No, that's not a good idea - it would break the compiler installed in the system directories if you were to build another D version with Digger, or move Digger's work directory, or try using the system compiler from a different user account...
The installed version should be independent and not rely on any files from DIgger's work directory.
But it's not independent. It relies on a conf file being in the same dir. Which is apparently not a given.
dmd -v | grep Config
Config file: (null)
I don't see how does it break the system compiler. It only tells the new dmd where to find its own conf file. Uninstalling should put the old compiler back which will know where it's own SYSCONFDIR.
Or what am I missing here?
But it's not independent. It relies on a conf file being in the same dir.
That's different. It's like saying that it's not independent because it relies on /lib/ld.so
or libc. Point is that the compiler binary is installed systemwide and has the same lifetime and visibility as other systemwide-installed programs, but its configuration file does not.
As mentioned, it will cause many problems. I will not support it.
Huh? No it's not. libc is not part of dmd. It's a dependency. It's not the same. As mentioned, not sure I understand the problems but anyway I guess that's that.
But do note that brew is probably the most common way to install command line software on osx so it'd be nice if there's some way to make it work, and digger seems really cool too so it'd be nice to have it just work on osx as well.
On Thu, Sep 13, 2018 at 11:53 AM Vladimir Panteleev < notifications@github.com> wrote:
But it's not independent. It relies on a conf file being in the same dir.
That's different. It's like saying that it's not independent because it relies on /lib/ld.so or libc. Point is that the compiler binary is installed systemwide and has the same lifetime and visibility as other systemwide-installed programs, but its configuration file does not.
As mentioned, it will cause many problems. I will not support it.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CyberShadow/Digger/issues/74#issuecomment-420950789, or mute the thread https://github.com/notifications/unsubscribe-auth/AChBzILxqnSAtpwAaP3u9LCSm_tuA3oFks5uaisWgaJpZM4WemzR .
so it'd be nice if there's some way to make it work
digger -c 'build.components.common.makeArgs=["SYSCONFDIR=/usr/local/etc"]' build
is the way.
dmd --version
: DMD64 D Compiler v2.081.2dub run digger -- build v2.082.0
:Something I'm missing?
Thanks!