Bug 18729 – dmd -run executes in different environment

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-04-04T21:49:27Z
Last change time
2019-08-06T07:02:39Z
Keywords
pull
Assigned to
No Owner
Creator
Jonathan Marler

Comments

Comment #0 by johnnymarler — 2018-04-04T21:49:27Z
I ran into a problem where I was running a D program via dmd -run that itself invoked DMD. The resulting program was invoking the compiler with -m64, but the original dmd -run did not use -m64. This caused a problem because the first invocation of the compiler set the LINKCMD environment variable to the OPTLINK executable, which caused the second invocation to use the OPTLINK executable but it treated it like the MSVC linker because it was running in 64-bit mode. You can reproduce this scenario on windows inside the dlang/tools repo by running this: dmd -run rdmd.d -m64 rdmd.d OPTLINK (R) for Win32 Release 8.00.17 Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html OPTLINK : Warning 9: Unknown Option : OUT OPTLINK : Warning 9: Unknown Option : LIBPATH OPTLINK : Warning 9: Unknown Option : LIBPATH OPTLINK : Warning 9: Unknown Option : LIBPATH C:\Users\Jonathan\AppData\Local\Temp\.rdmd\rdmd-rdmd.d-C379EA2E17BAC309A238EECC3E638589\objs\rdmd.exe.obj Offset 00000H Record Type 0064 Error 138: Module or Dictionary corrupt Error: linker exited with status 1 The solution here is to make sure that "dmd -run" maintain the original environment during execution. PR: https://github.com/dlang/dmd/pull/8121
Comment #1 by dlang-bot — 2019-05-27T08:35:08Z
@marler8997 updated dlang/dmd pull request #8121 "Maintain same environment for dmd -run" fixing this issue: - Maintain same environment for dmd -run Fix issue 18729 https://github.com/dlang/dmd/pull/8121
Comment #2 by bugzilla — 2019-06-03T19:04:50Z
I have some objections to this enhancement request: https://github.com/dlang/dmd/pull/8121#pullrequestreview-245064295
Comment #3 by johnnymarler — 2019-06-03T19:22:09Z
I miscategorized it as an enhancement, it should just be a normal bug. I've changed it to "normal". What objection do you have?
Comment #4 by dlang-bot — 2019-08-06T07:02:39Z
dlang/dmd pull request #8121 "fix Issue 18729 - dmd -run executes in different environment" was merged into master: - b919c83688c96a2bed628b55bc6a8ac36839c387 by Jonathan Marler: Maintain same environment for dmd -run Fix issue 18729 https://github.com/dlang/dmd/pull/8121