Thread overview |
---|
March 03, 2017 How to get dub to work when I have dlang installed in custom directory? | ||||
---|---|---|---|---|
| ||||
I have successfully compiled and installed dmd, druntime and phobos and installed them all in /opt/dlang/dmd /opt/dlang/druntime /opt/dlang/phobos Everything works, I can compile and run d programs just fine. I use this in my .bashrc to make everything work: # Dlang export PATH="/opt/dlang/dmd/src:$PATH" export PATH="/opt/dlang/druntime/generated/linux/release/64:$PATH" export PATH="/opt/dlang/druntime/import/:$PATH" export PATH="/opt/dlang/phobos/generated/linux/release/64:$PATH" export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/dlang/phobos/generated/linux/release/64 dlang_compile="-fPIC -L-lphobos2 -I/opt/dlang/druntime/import -I/opt/dlang/phobos -L-L/opt/dlang/phobos/generated/linux/release/64" alias dmd="dmd $dlang_compile" I installed dub and added the binary to my path. I can use dub init to create a new project, but when I run dub in a initiated project I get this message: 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: (null) Specify path to file 'object.d' with -I switch I have no idea what is is wrong and or how to fix it. Any help? |
March 03, 2017 Re: How to get dub to work when I have dlang installed in custom directory? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jamal | On Friday, 3 March 2017 at 20:35:04 UTC, Jamal wrote:
> I have no idea what is is wrong and or how to fix it.
>
> Any help?
It would be the alias. When you're running dmd from your shell, you're using an alias that includes a bunch of flags to make dmd work. When dub runs, it'll run the dmd executable directly, not your alias, and lose the flags.
You can get rid of the alias and use a dmd.conf instead. Just make a file called "dmd.conf" in the same directory as your dmd executable, and put something like this in it:
[Environment32]
DFLAGS=<all your dmd flags for 32b code -- you might not need this>
[Environment64]
DFLAGS=<all your dmd flags for 64b code -- same as your current "dlang_compile">
|
March 03, 2017 Re: How to get dub to work when I have dlang installed in custom directory? | ||||
---|---|---|---|---|
| ||||
Posted in reply to sarn | On Friday, 3 March 2017 at 23:22:07 UTC, sarn wrote:
> On Friday, 3 March 2017 at 20:35:04 UTC, Jamal wrote:
>> I have no idea what is is wrong and or how to fix it.
>>
>> Any help?
>
> It would be the alias. When you're running dmd from your shell, you're using an alias that includes a bunch of flags to make dmd work. When dub runs, it'll run the dmd executable directly, not your alias, and lose the flags.
>
> You can get rid of the alias and use a dmd.conf instead. Just make a file called "dmd.conf" in the same directory as your dmd executable, and put something like this in it:
>
> [Environment32]
> DFLAGS=<all your dmd flags for 32b code -- you might not need this>
>
> [Environment64]
> DFLAGS=<all your dmd flags for 64b code -- same as your current "dlang_compile">
Worked.
Thank you.
|
Copyright © 1999-2021 by the D Language Foundation