Hans Henry von Tresckow wrote:
Hello,
I am just getting started with openmodelica and I was wondering what
the current state of x86_64 support was?

Thank you very much,


Hi,

While you can compile OpenModelica on 64bit platforms
(some tweaking is necessary) some of testsuite will fail
due to numerical differences caused by extended precision.

To make the testsuite work we force 32bit compilation
even on 64bit platform. See the attached email.

Cheers,
Adrian Pop/
_____________________________________________________________________
Adrian Pop                      | PhD
Open Source Modelica Consortium | Technical Coordinator
Department of Computer Science  | http://www.ida.liu.se/~adrpo
Linköping University            | phone:+46 76 2343499/+46 13 285781
S-581 83 Linköping, Sweden      | fax:  +46 13 142231
OSMC & LiU/IDA/PELAB            | office: 3B:478
                
--- Begin Message ---
Hi,

Here is how you can compile in 32bit mode.

Cheers,
Adrian Pop/

-------- Original Message --------
Subject: Re: testsuite for 64 bit arch.
Date: Wed, 17 Sep 2008 10:06:08 +0200
From: Adrian Pop <[EMAIL PROTECTED]>
To: Filippo Donida <[EMAIL PROTECTED]>, Adrian Pop <[EMAIL PROTECTED]>, Francesco Casella <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>



Hi,

I compiled a 32bit OpenModelica on Ubuntu 64 bit in
my virtual machine. It is a pain, but it can be done.
All testsuite works for me now.

See the attached files and prepare
for some heavy compilation :)
I assumed:
mico2.3.13.tar.gz unpacked into:
/home/openmodelica/dev/mico
antlr2.7.7.tar.gz unpacked into:
/home/openmodelica/dev/antlr
MetaModelica/RML Compiler subversion into:
/home/openmodelica/dev/mmc
OpenModelica Compiler subversion into:
/home/openmodelica/dev/OpenModelica
So you might need to do some
small changes to the commands.

Some changes are needed to the current
code of both RML and OpenModelica, but
they are quite minor. See the attached
patches.

Cheers,
Adrian Pop/


Adrian Pop wrote:

Hi,

I think you might need to change also the ld to
ld -b elf32-i386
This will generate 32bit output files, otherwise
they will be made 64bit.

I Googled a bit and found something else which might work:
Try this:
$ cd OpenModelica
$ make clean
$ CC='gcc -m32' CXX='g++ -m32' linux32 make
This might work better, but I don't know for sure.

Of course, I don't know if you realize this, but
also MetaModelica compiler, antlr and mico need
to be compiled in 32 bit, otherwise the linking
will not work.

I just made a virtual machine with 64bit Ubuntu
and I will try myself to see if I can fix this
somehow.

Cheers,
Adrian Pop/

Filippo Donida wrote:
Hi Adrian,

I tried to create a script for the gcc call, but when rebuilding the executable, I encountered the following problem:

ld -r -x -o main.xxx main.o
ld: Relocatable linking with relocations from format elf32-i386 (main.o) to format elf64-x86-64 (main.xxx) is not supported
make[2]: *** [main.o] Error 1
make[2]: Leaving directory `/home/fildo/Work/OpenModelica/trunk/c_runtime/libf2c'
make[1]: *** [libf2c.a] Error 2
make[1]: Leaving directory `/home/fildo/Work/OpenModelica/trunk/c_runtime'
make: *** [omc] Error 2

Cheers

Filippo.

------------------------------------------
Filippo Donida
Politecnico di Milano
Dipartimento di Elettronica e Informazione
Piazza Leonardo da Vinci 32
20133 Milano - Italia

Phone +39 02 2399 3669 (Milano)
Phone +39 02 2399 7760 (Cremona)
Fax   +39 02 2399 3412 (Milano)
e-mail: [EMAIL PROTECTED]


Index: Makefile.in
===================================================================
--- Makefile.in	(revision 3643)
+++ Makefile.in	(working copy)
@@ -35,7 +35,7 @@
 
 omcd:	
 	(cd c_runtime && $(MAKE) -f Makefile)
-	(cd Compiler/rml2sig && $(MAKE) -f Makefile)
+	#(cd Compiler/rml2sig && $(MAKE) -f Makefile)
 	(cd Compiler && $(MAKE) -f Makefile debug)
 	(cp -p doc/*.pdf $(builddir_doc)/)
 	(cp -p Examples/*.* $(builddir_doc)/testmodels/)
@@ -43,7 +43,7 @@
 
 omc:	
 	(cd c_runtime && $(MAKE) -f Makefile)
-	(cd Compiler/rml2sig && $(MAKE) -f Makefile)
+	#(cd Compiler/rml2sig && $(MAKE) -f Makefile)
 	(cd Compiler && $(MAKE) -f Makefile release)
 	(cp doc/*.pdf $(builddir_doc)/)
 	(cp -p Examples/*.* $(builddir_doc)/testmodels/)
Index: modelica_parser/test/lexer/Makefile.in
===================================================================
--- modelica_parser/test/lexer/Makefile.in	(revision 3643)
+++ modelica_parser/test/lexer/Makefile.in	(working copy)
@@ -5,9 +5,6 @@
 builddir_doc=$(top_builddir)/build/doc
 
 
-CC=gcc
-CXX=g++
-
 ANTLR_HOME = @antlrhome@
 
 ANTLR_INCP = [EMAIL PROTECTED]@
Index: modelica_parser/test/parser/Makefile.in
===================================================================
--- modelica_parser/test/parser/Makefile.in	(revision 3643)
+++ modelica_parser/test/parser/Makefile.in	(working copy)
@@ -5,8 +5,6 @@
 builddir_doc=$(top_builddir)/build/doc
 
 
-CC=gcc
-CXX=g++
 
 ANTLR_HOME = @antlrhome@
 
Index: modelica_parser/src/Makefile.in
===================================================================
--- modelica_parser/src/Makefile.in	(revision 3643)
+++ modelica_parser/src/Makefile.in	(working copy)
@@ -4,8 +4,6 @@
 builddir_inc=$(top_builddir)/build/include
 builddir_doc=$(top_builddir)/build/doc
 
-CC=gcc
-CXX=g++
 AR=ar -r
 
 [EMAIL PROTECTED]@
Index: flat_modelica_parser/src/Makefile.in
===================================================================
--- flat_modelica_parser/src/Makefile.in	(revision 3643)
+++ flat_modelica_parser/src/Makefile.in	(working copy)
@@ -6,8 +6,6 @@
 builddir_doc=$(top_builddir)/build/doc
 
 
-CC=gcc
-CXX=g++
 AR=ar -r
 
 MODELICA_PARSER=$(top_builddir)/modelica_parser/src
Index: c_runtime/Makefile
===================================================================
--- c_runtime/Makefile	(revision 3643)
+++ c_runtime/Makefile	(working copy)
@@ -3,7 +3,6 @@
 builddir_lib=$(top_builddir)/build/lib
 builddir_inc=$(top_builddir)/build/include
 
-CC = gcc
 FC = g77
 AR = ar -ru
 UNAME := $(shell uname -m)
@@ -42,7 +41,7 @@
 	$(MAKE) -f Makefile
 else
 PLTPKGCMD = mkdir -p sendData/release && \
-g++ -c -o sendData/libsendData.o sendData/humbug.cpp && \
+$(CXX) -c -o sendData/libsendData.o sendData/humbug.cpp && \
 ar -ru sendData/release/libsendData.a sendData/libsendData.o
 endif
 
Index: c_runtime/libf2c/makefile.u
===================================================================
--- c_runtime/libf2c/makefile.u	(revision 3643)
+++ c_runtime/libf2c/makefile.u	(working copy)
@@ -13,7 +13,6 @@
 # to the CFLAGS = line below.
 
 .SUFFIXES: .c .o
-CC = cc
 SHELL = /bin/sh
 CFLAGS = -fexceptions -O
 OS = $(shell uname -s)
@@ -22,11 +21,11 @@
 .c.o:
 	$(CC) -c -DSkip_f2c_Undefs $(CFLAGS) $*.c
 ifeq ($(OS),Darwin)
-	ld -r -o $*.xxx $*.o
+	#ld ${LDFLAGS} -r -o $*.xxx $*.o
 else
-	ld -r -x -o $*.xxx $*.o
+	#ld ${LDFLAGS} -r -x -o $*.xxx $*.o
 endif
-	mv $*.xxx $*.o
+	#mv $*.xxx $*.o
 ## Under Solaris (and other systems that do not understand ld -x),
 ## omit -x in the ld line above.
 ## If your system does not have the ld command, comment out
@@ -87,7 +86,7 @@
 ## of "cc -shared".
 
 libf2c.so: $(OFILES)
-	cc -shared -o libf2c.so $(OFILES)
+	${CC} -shared -o libf2c.so $(OFILES)
 
 ### If your system lacks ranlib, you don't need it; see README.
 
Index: testsuite/mosfiles/Matrix.mos
===================================================================
--- testsuite/mosfiles/Matrix.mos	(revision 3643)
+++ testsuite/mosfiles/Matrix.mos	(working copy)
@@ -6,7 +6,7 @@
 //
 // 
 loadFile("Matrix.mo");
-system("gcc -c -o libFunc.a Func.c");
+system("gcc -m32 -c -o libFunc.a Func.c");
 checkModel(tt);
 instantiateModel(tt);
 buildModel(tt,numberOfIntervals=1);
Index: testsuite/mosfiles/ExternalLibraries.mos
===================================================================
--- testsuite/mosfiles/ExternalLibraries.mos	(revision 3643)
+++ testsuite/mosfiles/ExternalLibraries.mos	(working copy)
@@ -6,8 +6,8 @@
 //
 //
 loadFile("ExternalLibraries.mo");
-system("gcc -c -o libExternalFunc1_ext.o ExternalFunc1.c");
-system("gcc -c -o libExternalFunc2.a ExternalFunc2.c");
+system("gcc -m32 -c -o libExternalFunc1_ext.o ExternalFunc1.c");
+system("gcc -m32 -c -o libExternalFunc2.a ExternalFunc2.c");
 simulate(ExternalLibraries1, tolerance=1e-5, numberOfIntervals=100);
 val(x,0.0);
 val(x,0.2);
Index: testsuite/mosfiles/ExtObj.mos
===================================================================
--- testsuite/mosfiles/ExtObj.mos	(revision 3643)
+++ testsuite/mosfiles/ExtObj.mos	(working copy)
@@ -5,7 +5,7 @@
 //  Simulate model with external object.
 //
 loadFile("ExtObj.mo");
-system("gcc -c -o ExtObj.lib ExtObj.c");
+system("gcc -m32 -c -o ExtObj.lib ExtObj.c");
 simulate(testextobj, tolerance=1e-5, numberOfIntervals=100);
 {val(t.y,0.0),val(t.y,0.1),val(t.y,0.2),val(t.y,0.3),val(t.y,0.4),val(t.y,0.5),
 val(t.y,0.6),val(t.y,0.7),val(t.y,0.8),val(t.y,0.9),val(t.y,1.0)};
Index: testsuite/mosfiles/InOutStrings.mos
===================================================================
--- testsuite/mosfiles/InOutStrings.mos	(revision 3643)
+++ testsuite/mosfiles/InOutStrings.mos	(working copy)
@@ -2,8 +2,8 @@
 // keywords: array, string, external function
 // status:   correct
 
-system("g++ -c -o libInOutStrings1.o InOutStrings_fkn1.cc");
-system("g++ -c -o libInOutStrings2.o InOutStrings_fkn2.cc");
+system("g++ -m32 -c -o libInOutStrings1.o InOutStrings_fkn1.cc");
+system("g++ -m32 -c -o libInOutStrings2.o InOutStrings_fkn2.cc");
 loadFile("InOutStrings.mo");
 simulate(c1);
 echo(false);
Index: Compiler/Makefile.in
===================================================================
--- Compiler/Makefile.in	(revision 3643)
+++ Compiler/Makefile.in	(working copy)
@@ -21,7 +21,6 @@
 LIBSOCKET = @LIBSOCKET@
 
 SHELL	= /bin/sh
-CC	= gcc
 CFLAGS	= $(USE_CORBA) -DCYGWIN
 RMLHOME	= @rmlhome@
 #RML	= @rmlc_bin@ -g -Wc,-O3 -Wr,-East,-Ecps,-Efol
Index: Compiler/runtime/Makefile.in
===================================================================
--- Compiler/runtime/Makefile.in	(revision 3643)
+++ Compiler/runtime/Makefile.in	(working copy)
@@ -36,7 +36,6 @@
 endif
 
 SHELL	= /bin/sh
-CC	= gcc
 IDL	= idl 
 CFLAGS	+= -I$(RMLINCLUDE) -I$(top_builddir)/c_runtime -I$(srcdir) -I. $(CORBAINCL)
 CXXFLAGS = $(CFLAGS)
Index: Compiler/runtime/systemimpl.c
===================================================================
--- Compiler/runtime/systemimpl.c	(revision 3643)
+++ Compiler/runtime/systemimpl.c	(working copy)
@@ -274,9 +274,9 @@
     last_ptr_index = -1;
     memset(ptr_vector, 0, sizeof(ptr_vector));
 
-	set_cc("gcc");
-  set_cxx("g++");
-  set_linker("gcc -shared -export-dynamic");
+	set_cc("gcc -m32");
+  set_cxx("g++ -m32");
+  set_linker("gcc -m32 -shared -export-dynamic");
 #if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER)
   /* 
    * if we are on i386 or x86_64 or compiling with 
@@ -1550,12 +1550,12 @@
     last_ptr_index = -1;
     memset(ptr_vector, 0, sizeof(ptr_vector));
 
-	set_cc("gcc");
-  set_cxx("g++");
+	set_cc("gcc -m32");
+  set_cxx("g++ -m32");
 #if defined(__sparc__)
   set_linker("gcc -G");
 #else
-  set_linker("gcc -shared -export-dynamic");
+  set_linker("gcc -m32 -shared -export-dynamic");
 #endif /* __sparc__ */
 
 #if defined(__i386__) || defined(__x86_64__)
Index: Compiler/omc_release/Makefile.in
===================================================================
--- Compiler/omc_release/Makefile.in	(revision 3643)
+++ Compiler/omc_release/Makefile.in	(working copy)
@@ -18,7 +18,6 @@
 CORBAHOME = @CORBAHOME@
 
 SHELL	= /bin/sh
-CC	= gcc
 CFLAGS	= $(USE_CORBA)
 RMLHOME	= @rmlhome@
 RMLINC  = -I$(RMLHOME)/include/plain
@@ -38,7 +37,7 @@
 	LIBSOCKET=
 	CORBALIB=-L$(CORBAHOME)/lib -lmico -lwsock32
 else
-	CORBALIB=-L$(CORBAHOME)/lib -lmico -lcrypto -lssl -lpthread
+	CORBALIB=-L$(CORBAHOME)/lib `mico-config --libs`
 endif
 
 ifdef USE_CORBA
@@ -98,7 +97,7 @@
 	(cd $(srcdir)/absyn_builder && $(MAKE) vctarget)
 
 $(PROG): $(SRCO) $(AST) $(RTOBJ)
-	g++ -o $(PROG)$(EXEEXT) $(SRCO) $(AST) $(RTOBJ) $(LDFLAGS) $(PLTPKGFLAGS)
+	$(CXX) -o $(PROG)$(EXEEXT) $(SRCO) $(AST) $(RTOBJ) $(LDFLAGS) $(PLTPKGFLAGS)
 
 subdirs: $(SRCHSRCDIR) $(SUBDIRS)
 
Index: Compiler/omc_debug/Makefile.in
===================================================================
--- Compiler/omc_debug/Makefile.in	(revision 3643)
+++ Compiler/omc_debug/Makefile.in	(working copy)
@@ -13,7 +13,6 @@
 LIBSOCKET = @LIBSOCKET@
 
 SHELL	= /bin/sh
-CC	= gcc
 CFLAGS	= $(USE_CORBA)
 RMLHOME	= @rmlhome@
 RMLINC  = -I$(RMLHOME)/include/plain
@@ -38,7 +37,7 @@
 	LIBSOCKET=
 	CORBALIB=-L$(CORBAHOME)/lib -lmico -lwsock32
 else
-	CORBALIB=-L$(CORBAHOME)/lib -lmico -lcrypto -lssl -lpthread -lreadline
+	CORBALIB=-L$(CORBAHOME)/lib `mico-config --libs`
 endif
 
 ifdef USE_CORBA
@@ -95,7 +94,7 @@
 	(cd $(srcdir)/absyn_builder && $(MAKE) vctarget)
 
 $(PROG): $(SRCO) $(AST) $(RTOBJ)
-	g++ -o $(PROG)$(EXEEXT) $(SRCO) $(AST) $(RTOBJ) $(LDFLAGS) $(PLTPKGFLAGS)
+	${CXX} -o $(PROG)$(EXEEXT) $(SRCO) $(AST) $(RTOBJ) $(LDFLAGS) $(PLTPKGFLAGS)
 
 subdirs: $(SRCHSRCDIR) $(SUBDIRS)
 
Index: Compiler/absyn_builder/Makefile.in
===================================================================
--- Compiler/absyn_builder/Makefile.in	(revision 3643)
+++ Compiler/absyn_builder/Makefile.in	(working copy)
@@ -6,9 +6,6 @@
 builddir_doc=$(top_builddir)/build/doc
 
 
-CC=gcc
-CXX=g++
-
 ANTLR_HOME = @antlrhome@
 
 ANTLR_INCP = [EMAIL PROTECTED]@

# apply patch-mmc.patch to mmc
$ cd ~/dev/mmc
$ patch < patch-mmc.patch

# apply patch-omc.patch to OpenModelica
$ cd ~/dev/OpenModelica
$ patch < patch-omc.patch


$ sudo apt-get install ia32-libs
$ sudo linux32 apt-get install libc6-dev-i386
$ sudo apt-get install gcc-multilib
$ sudo apt-get install g++
$ sudo apt-get install g++-multilib

# compile mico 2.3.13
$ cd ~dev/mico
$ CC='gcc -m32' CXX='g++ -m32' linux32 ./configure 
--prefix=/home/openmodelica/dev/mico32bit
$ CC='gcc -m32' CXX='g++ -m32' linux32 make
$ CC='gcc -m32' CXX='g++ -m32' linux32 make install

# install SMLNJ
$ cd ~/dev
$ mkdir smlnj
$ cd smlnj
$ wget http://smlnj.cs.uchicago.edu/dist/working/110.67/config.tgz
$ tar -zxf config.tgz
$ linux32 ./config/install.sh


# compile MetaModelica
# svn co https://openmodelica.ida.liu.se/svn/MetaModelica/trunk mmc
$ cd ~/dev/mmc
$ sudo apt-get install bison flex
$ export SMLNJ_HOME=~/dev/smlnj
$ export PATH=${PATH}:${SMLNJ_HOME}/bin
$ CC='gcc -m32' CXX='g++ -m32' linux32 ./configure 
--prefix=/home/openmodelica/dev/mmc
$ CC='gcc -m32' CXX='g++ -m32' make
$ CC='gcc -m32' CXX='g++ -m32' make-install

# compile antlr
$ cd ~/dev/antlr
$ CC='gcc -m32' CXX='g++ -m32' linux32 ./configure 
--prefix=/home/openmodelica/dev/antlr
$ CC='gcc -m32' CXX='g++ -m32' linux32 make
$ CC='gcc -m32' CXX='g++ -m32' linux32 make install

# compile OpenModelica
$ sudo apt-get install sun-java6-jdk lib32readline5 lib32readline5-dev 
libreadline5-dev
$ export RMLHOME=~/dev/mmc
$ export ANTLRHOME=~/dev/antlr
$ export MICOHOME=/home/openmodelica/dev/mico32bit
$ export CLASSPATH=${ANTLRHOME}/antlr.jar:${CLASSPATH}
$ export PATH=${PATH}:${MICOHOME}/bin
$ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MICOHOME}/lib
$ CC='gcc -m32' CXX='g++ -m32' linux32 ./configure --with-CORBA=~/dev/mico32bit
$ CC='gcc -m32' CXX='g++ -m32' linux32 make

# running the tests
# unpack the Modelica library
$ cd ~/dev/OpenModelica/build
$ tar -zxf ../Compiler/VC7/Setup/zips/ModelicaLib.tar.gz
$ cd ../testsuite
$ export OPENMODELICAHOME=~/dev/OpenModelica/build
$ export OPENMODELICALIBRARY=~/dev/OpenModelica/build/ModelicaLibrary
$ export PATH=${PATH}:./
$ CC='gcc -m32' CXX='g++ -m32' linux32 make


Index: config/x86-linux-gcc/variables.mk
===================================================================
--- config/x86-linux-gcc/variables.mk	(revision 142)
+++ config/x86-linux-gcc/variables.mk	(working copy)
@@ -1,10 +1,10 @@
 # variables for Intel x86 / Linux / gcc
-CC=gcc
+CC=gcc -m32
 CFLAGS=
 COFLAGS=-O2 -fomit-frame-pointer
 CPFLAGS=-fno-omit-frame-pointer -pg
 CGFLAGS=-g -DRML_DEBUG
 RANLIB=ranlib
-CPP=gcc -x c -E -ansi
+CPP=gcc -x c -E -ansi -m32
 AS=as
-LD=ld
+LD=ld -b elf32-i386


--- End Message ---

Reply via email to