* fix #12735 osx: dsymutil needs to be called for debug builds * also write dsymutil command to extraCmds in json build file
This commit is contained in:
parent
e1d79d40f2
commit
b081166685
2 changed files with 22 additions and 0 deletions
|
|
@ -838,6 +838,15 @@ proc execLinkCmd(conf: ConfigRef; linkCmd: string) =
|
||||||
execExternalProgram(conf, linkCmd,
|
execExternalProgram(conf, linkCmd,
|
||||||
if optListCmd in conf.globalOptions or conf.verbosity > 1: hintExecuting else: hintLinking)
|
if optListCmd in conf.globalOptions or conf.verbosity > 1: hintExecuting else: hintLinking)
|
||||||
|
|
||||||
|
proc maybeRunDsymutil(conf: ConfigRef; exe: AbsoluteFile) =
|
||||||
|
when defined(osx):
|
||||||
|
if optCDebug notin conf.globalOptions: return
|
||||||
|
# if needed, add an option to skip or override location
|
||||||
|
let cmd = "dsymutil " & $(exe).quoteShell
|
||||||
|
conf.extraCmds.add cmd
|
||||||
|
tryExceptOSErrorMessage(conf, "invocation of dsymutil failed."):
|
||||||
|
execExternalProgram(conf, cmd, hintExecuting)
|
||||||
|
|
||||||
proc execCmdsInParallel(conf: ConfigRef; cmds: seq[string]; prettyCb: proc (idx: int)) =
|
proc execCmdsInParallel(conf: ConfigRef; cmds: seq[string]; prettyCb: proc (idx: int)) =
|
||||||
let runCb = proc (idx: int, p: Process) =
|
let runCb = proc (idx: int, p: Process) =
|
||||||
let exitCode = p.peekExitCode
|
let exitCode = p.peekExitCode
|
||||||
|
|
@ -979,6 +988,7 @@ proc callCCompiler*(conf: ConfigRef) =
|
||||||
linkViaResponseFile(conf, linkCmd)
|
linkViaResponseFile(conf, linkCmd)
|
||||||
else:
|
else:
|
||||||
execLinkCmd(conf, linkCmd)
|
execLinkCmd(conf, linkCmd)
|
||||||
|
maybeRunDsymutil(conf, mainOutput)
|
||||||
else:
|
else:
|
||||||
linkCmd = ""
|
linkCmd = ""
|
||||||
if optGenScript in conf.globalOptions:
|
if optGenScript in conf.globalOptions:
|
||||||
|
|
@ -1066,6 +1076,9 @@ proc writeJsonBuildInstructions*(conf: ConfigRef) =
|
||||||
lit "],\L\"linkcmd\": "
|
lit "],\L\"linkcmd\": "
|
||||||
str getLinkCmd(conf, conf.absOutFile, objfiles)
|
str getLinkCmd(conf, conf.absOutFile, objfiles)
|
||||||
|
|
||||||
|
lit ",\L\"extraCmds\": "
|
||||||
|
lit $(%* conf.extraCmds)
|
||||||
|
|
||||||
if optRun in conf.globalOptions or isDefined(conf, "nimBetterRun"):
|
if optRun in conf.globalOptions or isDefined(conf, "nimBetterRun"):
|
||||||
lit ",\L\"cmdline\": "
|
lit ",\L\"cmdline\": "
|
||||||
str conf.commandLine
|
str conf.commandLine
|
||||||
|
|
@ -1131,6 +1144,14 @@ proc runJsonBuildInstructions*(conf: ConfigRef; projectfile: AbsoluteFile) =
|
||||||
let linkCmd = data["linkcmd"]
|
let linkCmd = data["linkcmd"]
|
||||||
doAssert linkCmd.kind == JString
|
doAssert linkCmd.kind == JString
|
||||||
execLinkCmd(conf, linkCmd.getStr)
|
execLinkCmd(conf, linkCmd.getStr)
|
||||||
|
if data.hasKey("extraCmds"):
|
||||||
|
let extraCmds = data["extraCmds"]
|
||||||
|
doAssert extraCmds.kind == JArray
|
||||||
|
for cmd in extraCmds:
|
||||||
|
doAssert cmd.kind == JString, $cmd.kind
|
||||||
|
let cmd2 = cmd.getStr
|
||||||
|
execExternalProgram(conf, cmd2, hintExecuting)
|
||||||
|
|
||||||
except:
|
except:
|
||||||
when declared(echo):
|
when declared(echo):
|
||||||
echo getCurrentException().getStackTrace()
|
echo getCurrentException().getStackTrace()
|
||||||
|
|
|
||||||
|
|
@ -249,6 +249,7 @@ type
|
||||||
command*: string # the main command (e.g. cc, check, scan, etc)
|
command*: string # the main command (e.g. cc, check, scan, etc)
|
||||||
commandArgs*: seq[string] # any arguments after the main command
|
commandArgs*: seq[string] # any arguments after the main command
|
||||||
commandLine*: string
|
commandLine*: string
|
||||||
|
extraCmds*: seq[string] # for writeJsonBuildInstructions
|
||||||
keepComments*: bool # whether the parser needs to keep comments
|
keepComments*: bool # whether the parser needs to keep comments
|
||||||
implicitImports*: seq[string] # modules that are to be implicitly imported
|
implicitImports*: seq[string] # modules that are to be implicitly imported
|
||||||
implicitIncludes*: seq[string] # modules that are to be implicitly included
|
implicitIncludes*: seq[string] # modules that are to be implicitly included
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue