Opened 5 years ago

Last modified 5 years ago

#5943 new defect

Get rid of OPENMODELICAHOME (and OPENMODELICALIBRARY)

Reported by: Adrian Pop Owned by: somebody
Priority: critical Milestone: 2.0.0
Component: Interactive Environment Version:
Keywords: Cc: Niklas Worschech, Adeel Asghar, Martin Sjölund

Description

Currently we use OPENMODELICAHOME to point to the OM installation in Windows. We should remove the need for this variable as:

  • would simplify having multiple installations on the same computer #5809
  • would make handling of installation directory homogeneous on all platforms

Issues:

  • some clients are using this OPENMODELICAHOME variable to find omc (MDT, OMPython, etc)
  • the build process is using the OPENMODELICAHOME variable

All references of OPENMODELICAHOME in OpenModelica/ (filter on files: *.mo *.tpl *.cpp *.c *.h *.hpp, *akefile*, CMake*)

Search "OPENMODELICAHOME" (100 hits in 35 files)
  
  e:\dev\OpenModelica\OMCompiler\CMakeLists.txt (3 hits)
	Line 17: SET(OPENMODELICAHOME $ENV{OPENMODELICAHOME})
	Line 17: SET(OPENMODELICAHOME $ENV{OPENMODELICAHOME})
	Line 18: SET(OMC_DEBUG ${OPENMODELICAHOME}/bin/omc.exe)
  
  e:\dev\OpenModelica\OMCompiler\Compiler\BackEnd\OpenTURNS.mo (2 hits)
	Line 683:  returns $OPENMODELICAHOME/share/omc/scripts/OpenTurns/"
	Line 695:  returns $OPENMODELICAHOME/share/omc/scripts/OpenTurns/FILE_NAME
  
  e:\dev\OpenModelica\OMCompiler\Compiler\FrontEnd\ModelicaBuiltin.mo (6 hits)
	Line 1044:   String OPENMODELICAHOME, OPENMODELICALIBRARY, OMC_PATH, SYSTEM_PATH, OMDEV_PATH;
	Line 1482: function setInstallationDirectoryPath "Sets the OPENMODELICAHOME environment variable. Use this method instead of setEnvironmentVar."
	Line 1489: function getInstallationDirectoryPath "This returns OPENMODELICAHOME if it is set; on some platforms the default path is returned if it is not set."
	Line 1510: <p>To override the default path (<a href=\"modelica://OpenModelica.Scripting.getInstallationDirectoryPath\">OPENMODELICAHOME</a>/lib/omlibrary/:~/.openmodelica/libraries/), set the environment variable OPENMODELICALIBRARY=...</p>
	Line 3825: <p>You will also need to start an m3d backend to render the results. We hid them in $OPENMODELICAHOME/lib/omlibrary-modelica3d/osg-gtk/dbus-server.py (or blender2.59).</p>
	Line 4929:   <body>Redirecting to the <a href=\"https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/releases.html\">on-line release notes</a> (you can also find the release notes in the locally installed version of the user's guide, OPENMODELICAHOME/share/doc/OpenModelicaUsersGuide).</body>
  
  e:\dev\OpenModelica\OMCompiler\Compiler\Main\Main.mo (4 hits)
	Line 723:         System.setEnv("OPENMODELICAHOME",omHome,true);
	Line 746:             print("We could not find some needed MINGW paths in $OPENMODELICAHOME or $OMDEV. Searched for paths:\n");
	Line 898:       print("Error: OPENMODELICAHOME was not set.\n");
	Line 900:       print("  Most OpenModelica release distributions have scripts that set OPENMODELICAHOME for you.\n\n");
  
  e:\dev\OpenModelica\OMCompiler\Compiler\NFFrontEnd\NFModelicaBuiltin.mo (6 hits)
	Line 1247:   String OPENMODELICAHOME, OPENMODELICALIBRARY, OMC_PATH, SYSTEM_PATH, OMDEV_PATH;
	Line 1667: function setInstallationDirectoryPath "Sets the OPENMODELICAHOME environment variable. Use this method instead of setEnvironmentVar."
	Line 1674: function getInstallationDirectoryPath "This returns OPENMODELICAHOME if it is set; on some platforms the default path is returned if it is not set."
	Line 1695: <p>To override the default path (<a href=\"modelica://OpenModelica.Scripting.getInstallationDirectoryPath\">OPENMODELICAHOME</a>/lib/omlibrary/:~/.openmodelica/libraries/), set the environment variable OPENMODELICALIBRARY=...</p>
	Line 3958: <p>You will also need to start an m3d backend to render the results. We hid them in $OPENMODELICAHOME/lib/omlibrary-modelica3d/osg-gtk/dbus-server.py (or blender2.59).</p>
	Line 5002:   <body>Redirecting to the <a href=\"https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/releases.html\">on-line release notes</a> (you can also find the release notes in the locally installed version of the user's guide, OPENMODELICAHOME/share/doc/OpenModelicaUsersGuide).</body>
  
  e:\dev\OpenModelica\OMCompiler\Compiler\runtime\settingsimpl.c (5 hits)
	Line 71:     fprintf(stderr, "could not deduce the OpenModelica installation directory from executable path: [%s], please set OPENMODELICAHOME", omhome);
	Line 86:   const char *path = getenv("OPENMODELICAHOME");
	Line 116:   const char *path = getenv("OPENMODELICAHOME");
	Line 270:   /* set the env-var to created string this is useful when scripts and clients started by omc wants to use OPENMODELICAHOME*/
	Line 280:   commonSetEnvVar("OPENMODELICAHOME",value);
  
  e:\dev\OpenModelica\OMCompiler\Compiler\runtime\systemimpl.c (1 hit)
	Line 2649:   fprintf(stderr, "Warning: environment variable OPENMODELICAHOME is not set. Cannot load locale.\n");
  
  e:\dev\OpenModelica\OMCompiler\Compiler\Script\CevalScript.mo (7 hits)
	Line 243:     // We only need to set OPENMODELICAHOME on Windows, and set doesn't work in bash shells anyway
	Line 246:     //        OPENMODELICAHOME that we set will contain a SPACE at the end!
	Line 247:     //        set OPENMODELICAHOME=DIR && actually adds the space between the DIR and &&
	Line 249:     omhome := "set OPENMODELICAHOME=" + System.stringReplace(omhome_1, "/", "\\") + "&& ";
	Line 287:       // Check that it is a correct OPENMODELICAHOME, on Windows only
	Line 290:         Error.addMessage(Error.SIMULATOR_BUILD_ERROR, {stringAppendList({"command ",s_call," not found. Check $OPENMODELICAHOME"})});
	Line 1650:         vars_1 = {"OPENMODELICAHOME",
  
  e:\dev\OpenModelica\OMCompiler\Compiler\Script\CevalScriptBackend.mo (8 hits)
	Line 1588:         Settings.getInstallationDirectoryPath() "simulation fail for some other reason than OPENMODELICAHOME not being set." ;
	Line 1600:           "\nEnvironment variable OPENMODELICAHOME not set.",
	Line 2595:         // get OPENMODELICAHOME
	Line 2656:         // get OPENMODELICAHOME
	Line 3066:         // get OPENMODELICAHOME
	Line 3868:     // get OPENMODELICAHOME
	Line 5532:   $OPENMODELICAHOME/work if the file was not saved yet"
	Line 5561:         omhome = Settings.getInstallationDirectoryPath() "model not yet saved! change to $OPENMODELICAHOME/work" ;
  
  e:\dev\OpenModelica\OMCompiler\Compiler\SimCode\SerializeInitXML.mo (1 hit)
	Line 116:   File.write(file, "  OPENMODELICAHOME                    = \"");
  
  e:\dev\OpenModelica\OMCompiler\Compiler\Template\CodegenCpp.tpl (16 hits)
	Line 3144:   OMHOME=<%if boolOr(stringEq(makefileParams.platform, "win32"),stringEq(makefileParams.platform, "win64")) then '$(OPENMODELICAHOME)' else makefileParams.omhome%>
	Line 3226:             OMHOME=<%if boolOr(stringEq(makefileParams.platform, "win32"),stringEq(makefileParams.platform, "win64")) then '$(OPENMODELICAHOME)' else makefileParams.omhome%>
	Line 3324:       OPENMODELICAHOME := $(subst \,/,$(OPENMODELICAHOME))
	Line 3324:       OPENMODELICAHOME := $(subst \,/,$(OPENMODELICAHOME))
	Line 3377:       IDE_INCLUDES = -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip -I$(MLPI_SDK_01)/mlpiCore/include -I$(OPENMODELICAHOME)/include/omc/omsicpp -I$(OPENMODELICAHOME)/include/omc/omsicpp/Core -I$(OPENMODELICAHOME)/include/omc/omsicpp
	Line 3377:       IDE_INCLUDES = -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip -I$(MLPI_SDK_01)/mlpiCore/include -I$(OPENMODELICAHOME)/include/omc/omsicpp -I$(OPENMODELICAHOME)/include/omc/omsicpp/Core -I$(OPENMODELICAHOME)/include/omc/omsicpp
	Line 3377:       IDE_INCLUDES = -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip -I$(MLPI_SDK_01)/mlpiCore/include -I$(OPENMODELICAHOME)/include/omc/omsicpp -I$(OPENMODELICAHOME)/include/omc/omsicpp/Core -I$(OPENMODELICAHOME)/include/omc/omsicpp
	Line 3379:       IDE_LIBRARIES = $(OPENMODELICAHOME)/lib/omc/omsicpp/vxworks/SimCore.a
	Line 3426:       com.boschrexroth.$(MODEL_NAME)/$(MODE_DIR)/% : IDE_INCLUDES = -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip -I$(MLPI_SDK_01)/mlpiCore/include -I$(OPENMODELICAHOME)/include/omc/omsicpp -I$(OPENMODELICAHOME)/include/omc/omsicpp/Core -I$(OPENMODELICAHOME)/include/omc/omsicpp
	Line 3426:       com.boschrexroth.$(MODEL_NAME)/$(MODE_DIR)/% : IDE_INCLUDES = -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip -I$(MLPI_SDK_01)/mlpiCore/include -I$(OPENMODELICAHOME)/include/omc/omsicpp -I$(OPENMODELICAHOME)/include/omc/omsicpp/Core -I$(OPENMODELICAHOME)/include/omc/omsicpp
	Line 3426:       com.boschrexroth.$(MODEL_NAME)/$(MODE_DIR)/% : IDE_INCLUDES = -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip -I$(MLPI_SDK_01)/mlpiCore/include -I$(OPENMODELICAHOME)/include/omc/omsicpp -I$(OPENMODELICAHOME)/include/omc/omsicpp/Core -I$(OPENMODELICAHOME)/include/omc/omsicpp
	Line 3427:       com.boschrexroth.$(MODEL_NAME)/$(MODE_DIR)/% : IDE_LIBRARIES = $(OPENMODELICAHOME)/lib/omc/omsicpp/vxworks/SimCore.a
	Line 3478:       com.boschrexroth.$(MODEL_NAME)_partialImage/$(MODE_DIR)/% : IDE_INCLUDES = -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip -I$(MLPI_SDK_01)/mlpiCore/include -I$(OPENMODELICAHOME)/include/omc/omsicpp -I$(OPENMODELICAHOME)/include/omc/omsicpp/Core -I$(OPENMODELICAHOME)/include/omc/omsicpp
	Line 3478:       com.boschrexroth.$(MODEL_NAME)_partialImage/$(MODE_DIR)/% : IDE_INCLUDES = -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip -I$(MLPI_SDK_01)/mlpiCore/include -I$(OPENMODELICAHOME)/include/omc/omsicpp -I$(OPENMODELICAHOME)/include/omc/omsicpp/Core -I$(OPENMODELICAHOME)/include/omc/omsicpp
	Line 3478:       com.boschrexroth.$(MODEL_NAME)_partialImage/$(MODE_DIR)/% : IDE_INCLUDES = -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip -I$(MLPI_SDK_01)/mlpiCore/include -I$(OPENMODELICAHOME)/include/omc/omsicpp -I$(OPENMODELICAHOME)/include/omc/omsicpp/Core -I$(OPENMODELICAHOME)/include/omc/omsicpp
	Line 3479:       com.boschrexroth.$(MODEL_NAME)_partialImage/$(MODE_DIR)/% : IDE_LIBRARIES = $(OPENMODELICAHOME)/lib/omc/omsicpp/vxworks/SimCore.a
  
  e:\dev\OpenModelica\OMCompiler\Compiler\Template\CodegenFMU.tpl (1 hit)
	Line 3040:     simulationInfo->OPENMODELICAHOME = "<%makefileParams.omhome%>";
  
  e:\dev\OpenModelica\OMCompiler\Compiler\Template\CodegenFMUCpp.tpl (2 hits)
	Line 649:   OMHOME=<%if boolOr(stringEq(makefileParams.platform, "win32"),stringEq(makefileParams.platform, "win64")) then '$(OPENMODELICAHOME)' else makefileParams.omhome%>
	Line 728:   OMHOME=<%if boolOr(stringEq(makefileParams.platform, "win32"),stringEq(makefileParams.platform, "win64")) then '$(OPENMODELICAHOME)' else makefileParams.omhome%>
  
  e:\dev\OpenModelica\OMCompiler\Compiler\Template\CodegenJava.tpl (1 hit)
	Line 1257:   top_dir = ${OPENMODELICAHOME}/
  
  e:\dev\OpenModelica\OMCompiler\Compiler\Util\Flags.mo (1 hit)
	Line 364:   Gettext.gettext("Disables warnings on Windows if OPENMODELICAHOME/MinGW is missing."));
  
  e:\dev\OpenModelica\OMCompiler\SimulationRuntime\c\simulation\modelinfo.c (2 hits)
	Line 491:     const char *omhome = data->simulationInfo->OPENMODELICAHOME;
	Line 536:       strcpy(buf, "OPENMODELICAHOME missing");
  
  e:\dev\OpenModelica\OMCompiler\SimulationRuntime\c\simulation\simulation_input_xml.c (4 hits)
	Line 554:   read_value_string(findHashStringString(mi.md,"OPENMODELICAHOME"), &simulationInfo->OPENMODELICAHOME);
	Line 554:   read_value_string(findHashStringString(mi.md,"OPENMODELICAHOME"), &simulationInfo->OPENMODELICAHOME);
	Line 555:   infoStreamPrint(LOG_SIMULATION, 0, "OPENMODELICAHOME: %s", simulationInfo->OPENMODELICAHOME);
	Line 555:   infoStreamPrint(LOG_SIMULATION, 0, "OPENMODELICAHOME: %s", simulationInfo->OPENMODELICAHOME);
  
  e:\dev\OpenModelica\OMCompiler\SimulationRuntime\c\simulation_data.h (1 hit)
	Line 709:   const char *OPENMODELICAHOME;
  
  e:\dev\OpenModelica\OMCompiler\SimulationRuntime\c\util\java_interface.c (3 hits)
	Line 291:   openmodelicahome = getenv("OPENMODELICAHOME");
	Line 293:     fprintf(stderr, "getenv(OPENMODELICAHOME) failed - Java subsystem can't find the Java runtime...\n");
	Line 1105:       return "The exception handler triggered an exception.\nMake sure the java runtime is installed in $OPENMODELICAHOME/share/java/modelica_java.jar\n";
  
  e:\dev\OpenModelica\OMCompiler\SimulationRuntime\OMSICpp\omcWrapper\omcZeroMQ\src\omc.cpp (2 hits)
	Line 167:     std::string set_omhome_var = string("OPENMODELICAHOME=") + openmodelicaHome;
	Line 170:     status = SetEnvironmentVariable("OPENMODELICAHOME", TEXT(openmodelicaHome.c_str()));
  
  e:\dev\OpenModelica\OMCompiler\SimulationRuntime\OMSICpp\runtime\src\Core\ReduceDAE\com\ModelicaCompiler.cpp (2 hits)
	Line 23:     char* omhome = getenv("OPENMODELICAHOME"); //should get value for OM home
	Line 28:         std::cout << "OPENMODELICAHOME variable doesn't set" << std::endl;
  
  e:\dev\OpenModelica\OMCompiler\SimulationRuntime\ParModelica\explicit\openclrt\ocl_offcomp.c (2 hits)
	Line 85:     const char* OMHOME = getenv("OPENMODELICAHOME");
	Line 173:        printf("Couldn't find OPENMODELICAHOME!\n");
  
  e:\dev\OpenModelica\OMCompiler\SimulationRuntime\ParModelica\explicit\openclrt\ocl_offcomp.cpp (2 hits)
	Line 680:     const char* OMHOME = getenv("OPENMODELICAHOME");
	Line 768:        printf("Couldn't find OPENMODELICAHOME!\n");
  
  e:\dev\OpenModelica\OMCompiler\SimulationRuntime\ParModelica\explicit\openclrt\omc_ocl_util.cpp (2 hits)
	Line 289:     const char* OMHOME = getenv("OPENMODELICAHOME");
	Line 292:        printf("Couldn't find OPENMODELICAHOME!\n");
  
  e:\dev\OpenModelica\OMEdit\OMEditLIB\OMEditApplication.cpp (1 hit)
	Line 68:   const char *omhome = getenv("OPENMODELICAHOME");
  
  e:\dev\OpenModelica\OMEdit\OMEditLIB\Util\Helper.cpp (1 hit)
	Line 744:       return tr("Could not find environment variable OPENMODELICAHOME. Please make sure OpenModelica is installed properly.");
  
  e:\dev\OpenModelica\OMNotebook\OMNotebook\OMNotebookGUI\cellapplication.cpp (3 hits)
	Line 118:     const char *omhome = getenv("OPENMODELICAHOME");
	Line 121:       QMessageBox::critical(0, tr("Error"), tr("OPENMODELICAHOME not set"), "OK");
	Line 162:       QMessageBox::critical( 0, "OpenModelica Error", tr("The environment variable OPENMODELICAHOME=%1 is not a valid directory").arg(openmodelica) );
  
  e:\dev\OpenModelica\OMOptim\OMOptim\Core\OMC\MOomc.cpp (1 hit)
	Line 1428:         const char *omhome = getenv("OPENMODELICAHOME");
  
  e:\dev\OpenModelica\OMOptim\OMOptim\Core\OMC\OMCHelper.cpp (1 hit)
	Line 91:         return "Could not find environment variable OPENMODELICAHOME. Please make sure OpenModelica is installed properly.";
  
  e:\dev\OpenModelica\OMOptim\OMOptim\Core\OMC\omcinteractiveenvironment.cpp (2 hits)
	Line 130:       std::string OMCPath( getenv( "OPENMODELICAHOME" ) );
	Line 133:         throw std::runtime_error( "Could not find environment variable OPENMODELICAHOME" );
  
  e:\dev\OpenModelica\OMOptim\OMOptim\Core\OpenModelica\OpenModelica.cpp (1 hit)
	Line 726:     QString omHome = env.value("OPENMODELICAHOME");
  
  e:\dev\OpenModelica\OMOptim\OMOptim\Core\Util\Helper.cpp (1 hit)
	Line 592:       return tr("Could not find environment variable OPENMODELICAHOME. Please make sure OpenModelica is installed properly.");
  
  e:\dev\OpenModelica\OMOptim\OMOptim\Core\Util\Utilities.cpp (2 hits)
	Line 83:     QString om = env.value("OPENMODELICAHOME");
	Line 136:     static QString om = env.value("OPENMODELICAHOME") + QDir::separator() + "bin";
  
  e:\dev\OpenModelica\OMOptim\OMOptim\GUI\Tabs\TabOMC.cpp (2 hits)
	Line 68:     QString openmodelica( getenv( "OPENMODELICAHOME" ) );
	Line 70:         QMessageBox::critical( 0, "OMShell Error", "Could not find environment variable OPENMODELICAHOME, command compleation will not work" );
  
  e:\dev\OpenModelica\OMShell\OMShell\OMShellGUI\oms.cpp (1 hit)
	Line 266:     QMessageBox::critical( 0, "OMShell Error", "Could not find environment variable OPENMODELICAHOME, command completion will not work" );

Change History (3)

comment:1 by Francesco Casella, 5 years ago

Milestone: Future2.0.0
Priority: highcritical

comment:2 by Adeel Asghar, 5 years ago

OMEdit is fixed. See d741743/OpenModelica.

comment:3 by Adeel Asghar, 5 years ago

OMShell and OMNotebook no longer use environment variables. See 01ec712/OpenModelica.

Note: See TracTickets for help on using tickets.