From ed7a206ba82ed439a6f1eb3e1bda76118359baef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6lund?= Date: Tue, 2 Apr 2019 13:58:40 +0200 Subject: [PATCH] More debugging for cross-compilation of FMUs Belonging to [master]: - OpenModelica/OMCompiler#3027 --- Compiler/Script/CevalScriptBackend.mo | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Compiler/Script/CevalScriptBackend.mo b/Compiler/Script/CevalScriptBackend.mo index 575e75d0812..54fab4f36d2 100644 --- a/Compiler/Script/CevalScriptBackend.mo +++ b/Compiler/Script/CevalScriptBackend.mo @@ -3352,7 +3352,7 @@ protected function configureFMU input String logfile; input Boolean isWindows; protected - String CC, CFLAGS, LDFLAGS, makefileStr, container, host, nozip, + String CC, CFLAGS, LDFLAGS, makefileStr, container, host, nozip, path1, path2, dir=fmutmp+"/sources/", cmd="", quote="'", dquote = if isWindows then "\"" else "'", @@ -3427,8 +3427,15 @@ algorithm case host::"docker"::"run"::rest algorithm uid := System.getuid(); - cmd := "docker run "+(if uid<>0 then "--user " + String(uid) else "")+" --rm -w /fmu -v "+quote+System.realpath(fmutmp+"/..")+quote+":/fmu -v "+quote+System.realpath(includeDefaultFmi)+quote+":/fmiInclude "+stringDelimitList(rest," ")+ " sh -c " + dquote + - "(cd " + dquote + System.basename(fmutmp) + "/sources" + dquote + " || (ls -lh ; false)) && " + + path1 := System.realpath(fmutmp+"/.."); + path2 := path1 + "/" + System.basename(fmutmp); + for path in {path1, path2} loop + if not System.directoryExists(path) then + Error.addMessage(Error.SIMULATOR_BUILD_ERROR, {path + " does not exist, but we should have just created it..."}); + end if; + end for; + cmd := "docker run "+(if uid<>0 then "--user " + String(uid) else "")+" --rm -w /fmu -v "+quote+path1+quote+":/fmu -v "+quote+System.realpath(includeDefaultFmi)+quote+":/fmiInclude "+stringDelimitList(rest," ")+ " sh -c " + dquote + + "(cd " + dquote + path2 + "/sources" + dquote + " || (ls -lh ; false)) && " + "./configure --host="+quote+host+quote+" CFLAGS="+quote+"-Os"+quote+" CPPFLAGS=-I/fmiInclude LDFLAGS= && " + nozip + dquote; if 0 <> System.systemCall(cmd, outFile=logfile) then