Change History (3)
comment:1 by , 19 years ago
comment:2 by , 19 years ago
I'm able to build OMC revision 2159 by going through this procedure:
[x05andre@pan2 ~]$ svn co
svn+ssh://remote.ida.liu.se/home/pelab/subversion/modelica/OpenModelica/trunk
OpenModelica
[x05andre@pan2 OpenModelica]$ ./configure --with-CORBA
[x05andre@pan2 OpenModelica]$ make omc
I'm using the following setup:
Fedora Core 4
antlr-2.7.4
mico-2.3.11
rml-2.3.0
omc rev 2159
There are no errors or warnings, so obviously revision 2159 works for me. Please
provide information about building rev 2159.
Either this bug is resolved or I have some settings that affect the build in
some way.
comment:3 by , 19 years ago
I hopefully fixed all the Linux related compilation issues
in revision 2175.
Also added updated info in a new README.Cygwin.or.Linux.txt
After compiling OpenModelica under Linux, I have some experiences
that I would like to share. I had a hard time building
OpenModelica, mainly because the configure and/or makefiles did not work
properly and some tweaking was necessary in order to make it compile.
Since it is claimed that the svn distribution should compile under Linux, if
the provided pach is applied, and given the problems I encountered, I
think that these are major bugs in the installation process.
The problems may be due to that I had a different configuration than what
was expected, and in this case I would be happy to get some info on how
to set the system up in order to make it compile without doing the fixes
I had to do.
Ok, here we go.
The following configuration was used:
Linux, Fedora Core 4
antlr-2.7.2
mico-2.3.12
rml-2.3.0
OpenModelica rev 2134, downloaded using svn on 20060215
Problems and suggested solutions:
*) Contrary to what is stated on the home page, the supplied patch is needed
even if OpenModelica is obtained via svn. The patch works fine though.
*) There is an error in c_runtime/libf2c/makefile.u:
--- Line 181-185
arith.h: arithchk.c
---
It seems that the cygwin gcc is assumed. The problem is solved by applying
the patch
*
Index: c_runtime/libf2c/makefile.u
===================================================================
--- c_runtime/libf2c/makefile.u
+++ c_runtime/libf2c/makefile.u
@@ -181,6 +181,6 @@
+ ./a.out >arith.h
+ rm -f a.out arithchk.o
*
*) There is a compile error for omc_communication.cc:
g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DYYTEXT_POINTER=1
-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1
-DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
-DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_VPRINTF=1
-DHAVE_GETCWD=1 -DHAVE_SELECT=1 -DHAVE_STRDUP=1 -DHAVE_STRERROR=1
-DHAVE_SCANDIR=1 -DUSE_CORBA -DCYGWIN
-I/work/jakesson/software_tools/OpenModelica/RML/rml-2.3.0-src/x86-linux-gcc/include/plain
-I../../c_runtime -I../
-I/work/jakesson/software_tools/OpenModelica/MICO/mico/installation/include -c
-o omc_communication.o omc_communication.cc
omc_communication.cc:8:31: error: omc_communication.h: No such file or directory
.
.
.
more errors...
.
.
.
The error seems to appear in a file generated by the mico package and
is solve by the following patch
Index: Compiler/runtime/Makefile
===================================================================
--- Compiler/runtime/Makefile
+++ Compiler/runtime/Makefile
@@ -24,7 +24,7 @@
-CFLAGS += -I$(RMLINCLUDE) -I../../c_runtime -I../ $(CORBAINCL)
+CFLAGS += -I$(RMLINCLUDE) -I../../c_runtime -I../ -I. $(CORBAINCL)
*
Basically, the include statement at line 8 of omc_communication.cc reads
#include <omc_communication.h>
which implies that -I. should be given as an argument to the compiler
since omc_communication.h resides in the same directory. The other
solution would be to change the include statement to
#include "omc_communication.h"
This seems to be a bad idea since the code is automatically generated
during compilation.
*) With these changes OpenModelica compiles, and mosh can be run.
However, there is a problem when compiling a simulation model. The
makefile automatically generated by mosh looks something like
*
#Makefile generated by OpenModelica
CXX=g++
dcmotor: dcmotor.cpp
-I$(OPENMODELICAHOME)/c_runtime/ -lsim -lg2c -lc_runtime
which does not work for a few reasons. First, there is no libg2c.a.
If, however, the makefile is changed to
*
#Makefile generated by OpenModelica
CXX=g++
dcmotor: dcmotor.cpp
-L$(OPENMODELICAHOME)/c_runtime/libf2c -I$(OPENMODELICAHOME)/c_runtime/ -lsim
-lf2c -lc_runtime
the simulation application can be compiled. However, mosh (or rather,
the script invoked by mosh) expects the resulting file to have the
name of the Modelica model, without the .exe extension. A working
makefile is then
#Makefile generated by OpenModelica
CXX=g++
dcmotor: dcmotor.cpp
-L$(OPENMODELICAHOME)/c_runtime/libf2c -I$(OPENMODELICAHOME)/c_runtime/ -lsim
-lf2c -lc_runtime
To make mosh generate this makefile I applied the following patch
Index: Compiler/SimCodegen.rml
===================================================================
--- Compiler/SimCodegen.rml
+++ Compiler/SimCodegen.rml
@@ -134,5 +134,5 @@
a package. *)
+ "\t $(CXX) -o ",cname," ",
+ " -L$(OPENMODELICAHOME)/c_runtime/", "
-L$(OPENMODELICAHOME)/c_runtime/libf2c",
+ " -lsim -lf2c -lc_runtime ",libs', "\n"
which modifies the code generating the makefile.
With this change I can run the dcmotor example including instantation,
translation and simulation. However, the plotting does not work. This
is discussed in another bug report.
I realize that some of these fixes are not robust, but still, they
enabled me to build OpenModelica. I would very much appreciate
feedback on this matter and I hope that this may be useful for others
using OpenModelica under Linux.