Thread overview
make dub use my version of dmd
Apr 16, 2020
Jonathan M Davis
Apr 16, 2020
Adam D. Ruppe
Apr 17, 2020
WebFreak001
April 16, 2020
I'm running into an issue where I need to run an old compiler to build something, but the dub installation included with that compiler seems to have an infinite loop problem. So I want to run a standalone version of dub, but whatever compiler is selected with my path. Problem is, when I run the version of dub from the given compiler directory, it looks only in that directory for dmd.

OK, I thought, just put it in ~/bin, and run it from there. Doesn't work, now it looks in ~/bin (where there is no compiler), and fails.

Is there a way to make dub just use the existing PATH?

-Steve
April 16, 2020
On 4/16/20 2:28 PM, Steven Schveighoffer wrote:

> OK, I thought, just put it in ~/bin, and run it from there. Doesn't work, now it looks in ~/bin (where there is no compiler), and fails.

I wish I could delete this idiotic post.

I had a broken link to a dmd compiler in ~/bin. Removing that now it works.

Carry on everyone...

-Steve
April 16, 2020
On Thursday, April 16, 2020 12:41:14 PM MDT Steven Schveighoffer via Digitalmars-d-learn wrote:
> On 4/16/20 2:28 PM, Steven Schveighoffer wrote:
> > OK, I thought, just put it in ~/bin, and run it from there. Doesn't work, now it looks in ~/bin (where there is no compiler), and fails.
>
> I wish I could delete this idiotic post.
>
> I had a broken link to a dmd compiler in ~/bin. Removing that now it works.
>
> Carry on everyone...

LOL. Well, things like that happen to us all from time to time. I don't even want to think about how much of my life I've wasted because of my own stupidity with stuff like this...

I _was_ going to suggest just building dub yourself, since that's what I have on my system (with it in ~/bin), and I've never had this problem, but clearly, you found the issue. :)

- Jonathan M Davis



April 16, 2020
On 4/16/20 3:34 PM, Jonathan M Davis wrote:
> I_was_  going to suggest just building dub yourself

I already tried that of course ;)

-Steve
April 16, 2020
For future reference, newer dubs (v 1.17 + i think) allow --compiler=dmd-version for example.

You need to put the exe in your PATH and rename it yourself, but it recognizes *dmd-* (or *ldc2-* or *gdc-*) all the same so you can specifiy them.

I was doing that in early versions of my android thing, i made a program "android-ldc" and then did "dub build --compiler=android-ldc" and it all worked.

S o you can do that with versions too.
April 17, 2020
On Thursday, 16 April 2020 at 19:56:44 UTC, Adam D. Ruppe wrote:
> For future reference, newer dubs (v 1.17 + i think) allow --compiler=dmd-version for example.
>
> You need to put the exe in your PATH and rename it yourself, but it recognizes *dmd-* (or *ldc2-* or *gdc-*) all the same so you can specifiy them.
>
> I was doing that in early versions of my android thing, i made a program "android-ldc" and then did "dub build --compiler=android-ldc" and it all worked.
>
> S o you can do that with versions too.

Also you can use `dub --compiler=/path/to/dmd` (or ldc, or gdc) and it magically know the compiler type, though maybe it knows because of the filename.
April 17, 2020
On 4/17/20 4:37 AM, WebFreak001 wrote:
> On Thursday, 16 April 2020 at 19:56:44 UTC, Adam D. Ruppe wrote:
>> For future reference, newer dubs (v 1.17 + i think) allow --compiler=dmd-version for example.
>>
>> You need to put the exe in your PATH and rename it yourself, but it recognizes *dmd-* (or *ldc2-* or *gdc-*) all the same so you can specifiy them.
>>
>> I was doing that in early versions of my android thing, i made a program "android-ldc" and then did "dub build --compiler=android-ldc" and it all worked.
>>
>> S o you can do that with versions too.

Sure, it does all that. But if you have a broken symlink in the same directory as the dub executable it tries to use that first.

> 
> Also you can use `dub --compiler=/path/to/dmd` (or ldc, or gdc) and it magically know the compiler type, though maybe it knows because of the filename.

Yes, I think that is what was happening. I had a broken symlink in ~/bin/dmd, and it complained about not being able to get the version from it.

I mistakenly thought it couldn't find a dmd in that directory, and it wasn't willing to use my path DMD. Then I tried the same dub binary on a different machine and it successfully found the dmd in my path. Which is when I realized something was different between the two installations.

But one thing I DID learn, is that if you have your path set to one compiler's dmd, and specifically call another compiler's dub, it will use the dmd in that dub's directory rather than your path. So you do have to copy it elsewhere (or use the --compiler option).

-Steve