OMNeT++/OMNEST Bug Tracker - OMNeT++
View Issue Details
0000085OMNeT++simulation kernelpublic2009-07-15 20:242010-12-10 16:45
andras 
rhornig 
normalminoralways
resolvedfixed 
MinGW 4.2.1-sjlj (mingw32-2)Windows
4.0 
4.1 
0000085: linker errors when building statically linked simulations in release mode
With the MinGW compiler bundled with OMNeT++ 4.0, there are linker errors when building statically linked simulations in release mode.

Sample errors:
liboppsim.a(cmessage.o):cmessage.cc:(.text+0x840): multiple definition
 of `cPacket::setBitLength(long long)'
liboppsim.a(cmessage.o):cmessage.cc:(.text+0x2670): multiple definition of `cPacket::cPacket(char const*, short, long long)'
etc.

1. Set SHARED_LIBS=no in configure.user
2. ./configure, make cleanall, make (or make MODE=release)
3. Build stops with linker errors at the first sample simulation, Aloha
These errors are specific to the given compiler, they do not occur on any other platform including the Linux MinGW cross-compiler of the same version (i586-mingw32msvc-gcc (GCC) 4.2.1-sjlj (mingw32-2)).

Also, they only occur when ALL of the following are met:
- static linking selected (SHARED_LIBS=no)
- release build (make MODE=release)
- CFLAGS_RELEASE contains -O2

The error does not manifest itself when compiling with -O1 or -O3!
No tags attached.
Issue History
2009-07-15 20:24andrasNew Issue
2009-07-15 20:26andrasNote Added: 0000157
2009-07-15 20:26andrasStatusnew => confirmed
2009-07-15 20:27andrasNote Added: 0000158
2010-03-31 17:00rhornigStatusconfirmed => to be tested
2010-12-10 16:45rhornigNote Added: 0000351
2010-12-10 16:45rhornigStatusto be tested => resolved
2010-12-10 16:45rhornigFixed in Version => 4.1
2010-12-10 16:45rhornigResolutionopen => fixed
2010-12-10 16:45rhornigAssigned To => rhornig

Notes
(0000157)
andras   
2009-07-15 20:26   
Will be resolved by shipping the new version of MinGW (4.4.0) with OMNeT++ 4.1.
(0000158)
andras   
2009-07-15 20:27   
Suggested workaround: uncomment CFLAGS_RELEASE in configure.user, and change -O2 to either -O1 or -O3.
(0000351)
rhornig   
2010-12-10 16:45   
The new gcc 4.5 compiler bundled with OMNeT 4.1 resolves this issue. (tested)