Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Model check without error but fails to compile

Model check without error but fails to compile

gcc   -falign-functions -msse2 -mfpmath=sse   -I"C:/OpenModelica1.9.0//include/omc" -I. -L"C:/Dymola"   -c -o Sterilisation.Tests_assemblage.Test.o Sterilisation.Tests_assemblage.Test.c

cc1.exe: out of memory allocating 65536 bytes
mingw32-make: *** [Sterilisation.Tests_assemblage.Test.o] Error 1

The same model compiles well with dymola (using the MSVC++)

Thank you for your help,

Assaad

Re: Model check without error but fails to compile

How much RAM does your computer have?

Re: Model check without error but fails to compile

I have 8 GB ram

Re: Model check without error but fails to compile

OK, but running Windows so limited to 3GB per process. I would recommend Linux and clang current/smile You can also change to MSVC using OpenModelica, but it uses up more memory than GCC.

Re: Model check without error but fails to compile

Hi,

The story is a bit more involved.
The MinGW GCC that comes with OpenModelica is a 32 bit executable and compiles to 32 bit executable.
So basically gcc can use only 2GB of memory when compiling.

I did change gcc.exe to be large address aware (but i don't remember if i did that too for cc1.exe)
which means it can go up to 4GB of memory.

You could try to compile with omc +target=msvc which uses cl (Visual Studio) compiler to compile the executable.

Also you could try to restart your computer and then try to compile immediately after that as you'll have more
contiguous memory available that way.

Cheers,
Adrian Pop/

Re: Model check without error but fails to compile

Disabling some optimizations for gcc might also help, so instead of -O3 you could use -O0.
I think you can do that via MODELICAUSERCFLAGS env. variable, set it to -O0.

Cheers,
Adrian Pop/

Re: Model check without error but fails to compile

Or using getCFlags() + setCompilerFlags(... + "-O0") API (don't ask me why they are different...)

Re: Model check without error but fails to compile

Thanks for these ideas.

I didn't succeed with setting the parameter to -O0.

However I have problem to switch the compiler to msvc. I used in openmodelica shell setCompiler("msvc") but i have a message saying that MinGW32 doest not recognize msvc which mean that it is still GCC that compiles.

How I can do this switch?

Thanks

Re: Model check without error but fails to compile

You need to use +target=msvc. It needs to create a different set of makefiles.
See also https://openmodelica.org/index.php/foru … =892#p3340

There are 0 guests and 0 other users also viewing this topic
You are here: