How to fix 'cannot find -lgmp' build error on OMNeT++?

Skip to first unread message


Apr 6, 2020, 9:12:14 AM4/6/20
to OMNeT++ Users

I have become aware that OverSim can be used with the newer versions of OMNeT++. I installed OMNeT++ 5.6.1 on Windows 10 by following the instructions in InstallGuide. Then, I imported INET 3.6.5 in OMNeT++ and built it, there were no errors. Finally, I imported OverSim-20190424 and when I build it I get the following error at the end of the build process:

[1]: Entering directory '/c/omnet561/oversim-20190424/src'
Creating executable: ../out/gcc-debug/src/OverSim_dbg.exe
:/omnet561/omnetpp-5.6.1/tools/win64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgmp
.exe: error: ld returned 1 exit status
[1]: *** [Makefile:418: ../out/gcc-debug/src/OverSim_dbg.exe] Error 1
[1]: Leaving directory '/c/omnet561/oversim-20190424/src'
: *** [Makefile:11: all] Error 2
"make MODE=debug -j8 all" terminated with exit code 2. Build might be incomplete.

12:15:59 Build Failed. 3 errors, 0 warnings. (took 12s.448ms)

The other two errors are:
Description    Resource    Path    Location    Type
: *** [Makefile:11: all] Error 2    OverSim             C/C++ Problem
[1]: *** [Makefile:418: ../out/clang-debug/src/OverSim_dbg.exe] Error 1    OverSim             C/C++ Problem

Does anyone know how this error can be fixed? I have tried using OverSim on Windows 7 as well and tried using OMNeT++ 5.4.1 but the same error is still produced.

The libgmp libraries (libgmp-10.dll and libgmpxx-4.dll) are in the directory "C:/omnet561/omnetpp-5.6.1/tools/win64/mingw64/bin". I think the problem here might be that the software is using the wrong directory to search for the libraries but I'm not sure how to fix such an issue.


Apr 12, 2020, 10:27:32 AM4/12/20
to OMNeT++ Users
For anyone who encounters the same problem, I managed to solve it by using OMNeT++ 5.6.1 and Oversim 20190424 on Ubuntu 18.04. When I built Oversim, I got an error "Could not find gmp.h", to solve that error I installed libgmp3-dev -

apt-get install libgmp3-dev

If somebody manages to get it to work on Windows or has an idea of how it can be fixed, then please feel free to post.

Rudolf Hornig

Apr 14, 2020, 9:38:19 AM4/14/20
to OMNeT++ Users
On windows you may need to specify 

OMNETPP_LIBS += -lgmp-10

as a library name and you may need to add also -L/c/mingw64/bin to the linker command line.

Reply all
Reply to author
0 new messages