Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3376 closed enhancement (fixed)

Command prompt under Windows

Reported by: Rüdiger Franke Owned by: Adeel Asghar
Priority: high Milestone: 1.9.4
Component: Installation program Version: trunk
Keywords: Cc:

Description

OpenModelica installs under Windows the omc compiler and a complete MinGW environment. Unfortunately it is hard to use these tools.

For example: simulate Modelica.Blocks.Examples.PID_Controller from OMEdit. Then open a cmd prompt, go to OMEdit's work folder and retype the compilation command:

"C:\OpenModelica1.9.2\\MinGW\bin\mingw32-make.exe" -j4 -f Modelica.Blocks.Examples.PID_Controller.makefile

This raises the linker errors:

c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lexpat
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lexpat
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -llapack-mingw
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -ltmglib-mingw
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lblas-mingw
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lf2c
collect2.exe: error: ld returned 1 exit status

Couldn't OpenModelica prepare a command prompt with appropriate environment variables set, so that omc.exe and model compilation work?

Visual Studio is a good reference for best practices under Windows. Each version provides under Start a menu item "Visual Studio Command Prompt".

Change History (8)

comment:1 by Adrian Pop, 9 years ago

The issues are mostly because of another MinGW you have installed and the PATH setting.
Search for Compile.bat in the OpenModelica installation to see how we compile files.
You could probably make a prompt.bat that does what you want very easily.

Of course, your suggestion seems like a good idea and we should be able to integrate something like that in some OMEdit menu, maybe Tools->"OpenModelica command prompt" which opens a cmd in the temp directory where OMEdit generates the files with all the environment variables setup needed.

comment:2 by Rüdiger Franke, 9 years ago

Better (and maybe easier) if this would be available through the Windows Start menu, besides e.g. OpenModelica Connection Editor and OpenModelica Notebook under

Start -> All Programs -> OpenModelica -> OpenModelica Command Prompt

Re-compilation works if I prepend OpenModelica's bin folders to my PATH:

> PATH=C:\OpenModelica1.9.2\bin;C:\OpenModelica1.9.2\MinGW\bin;%PATH%
> mingw32-make.exe -f Modelica.Blocks.Examples.PID_Controller.makefile

or when calling

> C:\OpenModelica1.9.2\share\omc\scripts\Compile.bat Modelica.Blocks.Examples.PID_Controller

Thank's for the hint -- now I also know how to use msvc!

There still is a problem when recompiling FMU's.

> PATH=C:\OpenModelica1.9.2\bin;C:\OpenModelica1.9.2\MinGW\bin;%PATH%
> mingw32-make.exe -f Modelica_Blocks_Examples_PID_Controller_FMU.makefile

raises the error:

dlltool -d Modelica_Blocks_Examples_PID_Controller.def --dllname Modelica_Blocks_Examples_PID_Controller.dll --output-lib Modelica_Blocks_Examples_PID_Controlle
r.lib --kill-at
dlltool: Can't open def file: Modelica_Blocks_Examples_PID_Controller.def
mingw32-make.exe: *** [Modelica_Blocks_Examples_PID_Controller_FMU] Error 1

This looks more like an error in the makefile generated from OMEdit -> FMI -> Export FMU!?

comment:3 by Martin Sjölund, 9 years ago

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:4 by Adeel Asghar, 9 years ago

I added a command prompt in 7d939b5/OMEdit. It is available via Tools->OpenModelica Command Prompt menu. It automatically opens in the working directory of OMEdit. Note that you can only compile models with MinGW i.e., mingw32-make because that is the only compiler we ship with OpenModelica. If you want to compile using Visual Studio you need to call vcvarsall.bat of your respective Visual Studio compiler version.

I will also try to add it to the start menu.

comment:5 by Rüdiger Franke, 9 years ago

Recently I had noticed that OMEdit also got the menu

Tools -> Open Terminal

What's the difference to the new OpenModelica Command Prompt?

It's fine with me if the command prompt / terminal is available from OMEdit.

Btw, exploiting the new cross-compilation under Linux, one can run an X server like VcXsrv under Windows and launch OMEdit in a virtual box. The menu
Tools -> OpenTerminal then launches a Linux terminal on the Windows desktop.

in reply to:  5 comment:6 by Adeel Asghar, 9 years ago

Resolution: fixed
Status: newclosed

Replying to rfranke:

Recently I had noticed that OMEdit also got the menu

Tools -> Open Terminal

What's the difference to the new OpenModelica Command Prompt?

Open terminal just opens launches a command specified in the settings for Terminal Command in the working directory of OMEdit.

OpenModelica Command Prompt just launches cmd.exe and sets the path required to compile OpenModelica generated code and run it. It is only available in Windows.

It's fine with me if the command prompt / terminal is available from OMEdit.

Then I will close this ticket.

Btw, exploiting the new cross-compilation under Linux, one can run an X server like VcXsrv under Windows and launch OMEdit in a virtual box. The menu
Tools -> OpenTerminal then launches a Linux terminal on the Windows desktop.

comment:7 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.4-1.9.x

Milestone renamed

comment:8 by Martin Sjölund, 9 years ago

Milestone: 1.9.4-1.9.x1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.