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

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:
make[1]: Entering directory '/c/omnet561/oversim-20190424/src'
Creating executable: ../out/gcc-debug/src/OverSim_dbg.exe
C:/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
collect2.exe: error: ld returned 1 exit status
make[1]: *** [Makefile:418: ../out/gcc-debug/src/OverSim_dbg.exe] Error 1
make[1]: Leaving directory '/c/omnet561/oversim-20190424/src'
make: *** [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
make: *** [Makefile:11: all] Error 2 OverSim C/C++ Problem
make[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.

Try to add path to libgmp libraries using Makefrag.
Go to OverSim-20190424 Project Properties, choose OMNeT++ | Makemake | select src | Options | Custom | Makefrag and write:
LIBS += -L/c/libraries/libgmp
It is assumed that libgmp libraries (*.dll or *.a) are in C:\libraries\libgmp.
EDIT
Open Makefrag from oversim-20190424\src\ in a text editor, and then change LIBS and OMNETPP_LIBS to proper values:
LIBS += -L/sw/lib -L/c/omnet561/omnetpp-5.6.1/tools/win64/mingw64/bin
OMNETPP_LIBS += -lgmp
or
OMNETPP_LIBS += -lgmp-10

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 10 or has an idea of how it can be fixed, then please feel free to post.

Related

Omnet++ fatal error: 'inet/.../something.h' file not found

I am trying to create a new project from Windows 10/11 in Omnet++ 5.7 referenced to inet (Right Clicked on First Project - > Properties - > Project References - > Marked Inet) but it fails because it can't find the inet's classes.
I tried to recompile everything (including inet after adding my .cc files), but nothing seems to work.
That's a sample of how I included the files in my .cc classes:
#include "inet/common/INETDefs.h"
#include "inet/common/geometry/common/Coord.h"
#include "inet/common/packet/Packet.h"
This is my error:
23:26:01 **** Incremental Build of configuration release for project project ****
make MODE=release all
cd src && /usr/bin/make
make[1]: Entering directory '/c/Users/cyb/Desktop/omnetpp-5.7/samples/project/src'
gpsr/Gpsr.cc
In file included from gpsr/Gpsr.cc:22:
gpsr/Gpsr.h:23:10: fatal error: 'inet/common/INETDefs.h' file not found
#include "inet/common/INETDefs.h"
^~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [Makefile:112: ../out/clang-release/src/gpsr/Gpsr.o] Error 1
make[1]: Leaving directory '/c/Users/cyb/Desktop/omnetpp-5.7/samples/project/src'
make: *** [Makefile:2: all] Error 2
"make MODE=release all" terminated with exit code 2. Build might be incomplete.
23:26:04 Build Failed. 3 errors, 0 warnings. (took 2s.194ms)
I've already tried to recreate a new "makemake" file, but still this error occurs.
I also tried the suggestions I found here Omnet++ inet::EtherAppCli not found and here Omnet++ fatal error: 'inet/common/INETDefs.h' file not found . Same error occurs when I create a new project from 0 or even if I use a different version of Omnet++/Inet (I tried omnet 4,5 and 6) or O.S (such as Windows or Linux). Anyone could help me?

Error when compiling OpenCV for Qt

In order to use OpenCV in Qt, I have to compile it with MinGW by cmake.
Software are the following:
Qt 5.4.0
Opencv 2.4.11
CMake 3.2.2
MinGW version unknown, GCC 4.8.1
A fatal error occurred when I make file and I have no idea how to solve it at all.
[ 29%] Automatic moc for target opencv_highgui
Generating moc_window_QT.cpp
Exit code 0xc000007b
AUTOGEN: error: process for C:/opencvbuild/modules/highgui/moc_window_QT.cpp failed:
Exit code 0xc000007b
moc failed...
modules\highgui\CMakeFiles\opencv_highgui_automoc.dir\build.make:48: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui_automoc' failed
mingw32-make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui_automoc] Error 1
CMakeFiles\Makefile2:2066: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui_automoc.dir/all' failed
mingw32-make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui_automoc.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
These messages are shown in cmd.
Then I revised CMakeLists.txt, SET(CMAKE_AUTOMOC OFF)
modules\highgui\CMakeFiles\opencv_highgui_automoc.dir\build.make:64: recipe for target 'modules/highgui/qrc_window_QT.cpp' failed
Does anybody know a solution?
2 items to try.
Try running make with VERBOSE=1 to increase the output on the makefile. That should give you a better idea of what is wrong.
Try running with cmake-gui, then turn on advanced mode to check out what CMake found for the different Qt5 dependencies. On Mac, I install the latest Qt to my home directory, causing me to have to manually set variables. This is what it looks like for me.
Hopefully this provides some useful information.

Error building MLT framework on Windows

I've been following the official building guide provided here. I need MLT to create a video player and I opted to only install the first 4 libraries, as stated on the guide (FFmpeg, SDL, dlfcn-win32, and libXML). I'm also using QT as my main framework for my application.
I'm a bit confused as far as this guide goes because I find the instructions for where the libraries should go a bit confusing. This is my current folder structure:
$HOME = C:\MinGW\msys\1.0\home\TKB (TKB is my user)
$HOME/build/lib -> libraries
$HOME/build/bin -> binaries
$HOME/build/include -> includes
$HOME/build/share/ffmpeg -> for the "presets" folder
At the same time, because I was confused, I have the same folders (bin, lib, include, share) inside $HOME/.
Then I have $HOME/src/mlt with the mlt files.
When I run the configure command I get this (I disabled the libraries I didn't install to reduce the output on the console):
Command: ./configure --prefix=$HOME/build --target-os=MinGW --enable-gpl --disable-decklink --disable-frei0r --disable-gtk2 --disable-sox --disable-jackrack --disable-swfdec --disable-resample
Configuring framework:
Configuring modules:
Configuring modules/avformat:
- libavformat not found: disabling
Configuring modules/core:
Configuring modules/feeds:
Configuring modules/kdenlive:
Configuring modules/linsys:
- does not build on OS X or Windows:disabling
Configuring modules/lumas:
Configuring modules/motion_est:
Configuring modules/normalize:
Configuring modules/oldfilm:
Configuring modules/opengl:
- movit not found: disabling
Configuring modules/plus:
Configuring modules/plusgpl:
Configuring modules/qt:
- Libexif not found, disabling exif features (auto rotate)
- Qt not found: disabling
Configuring modules/rtaudio:
Configuring modules/sdl:
Configuring modules/vid.stab:
- vid.stab not found: disabling
Configuring modules/videostab:
Configuring modules/vmfx:
Configuring modules/xine:
Configuring modules/xml:
- xml2 not found: disabling xml module
Configuring mlt++:
Configuring swig:
GPLv2 license used; GPLv3 components disabled
I have ffmpeg and the xml2 libraries on the folders but it looks like the script is not able to find them. I also have QT installed on the default folder and it also doesn't seem to find it.
I tried installing anyway (make all install) and I get the following error:
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -ldl
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lpthread
collect2.exe: error: ld returned 1 exit status
make[1]: *** [libmlt-6.dll] Error 1
make[1]: Leaving directory '/home/TKB/src/mlt-0.9.6/src/framework'
make: *** [all] Error 1
Can anyone help me with these errors?
Thank you for your time.
EDIT:
I found out that I made a naming mistake when creating the pkgconfig folder, changing that solved the xml2 not being detected problem. Also, I've added the paths for ffmpeg and qt manually and that also seemed to solve the problem. So now what I get with the configure is the following:
./configure --prefix=/home/TKB/build --enable-gpl --disable-decklink --disable-frei0r --disable-gtk2 --disable-sox --disable-jackrack --disable-swfdec --disable-resample --qt-libdir=C:/Qt/5.3/mingw482_32/lib --qt-includedir=C:/Qt/5.3/mingw482_32/include --avformat-shared=/home/TKB/share/ffmpeg --avformat-static=/home/TKB/bin
Configuring framework:
Configuring modules:
Configuring modules/avformat:
Configuring modules/core:
Configuring modules/feeds:
Configuring modules/kdenlive:
Configuring modules/linsys:
- does not build on OS X or Windows:disabling
Configuring modules/lumas:
Configuring modules/motion_est:
Configuring modules/normalize:
Configuring modules/oldfilm:
Configuring modules/opengl:
- movit not found: disabling
Configuring modules/plus:
Configuring modules/plusgpl:
Configuring modules/qt:
- Libexif not found, disabling exif features (auto rotate)
- Qt version 5.x detected
- Include directory: C:/Qt/5.3/mingw482_32/include
Configuring modules/rtaudio:
Configuring modules/sdl:
Configuring modules/vid.stab:
- vid.stab not found: disabling
Configuring modules/videostab:
Configuring modules/vmfx:
Configuring modules/xine:
Configuring modules/xml:
Configuring mlt++:
Configuring swig:
GPLv2 license used; GPLv3 components disabled
When I run make all install I still get an error, which is the following:
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -ldl
collect2.exe: error: ld returned 1 exit status
make[1]: *** [libmlt-6.dll] Error 1
make[1]: Leaving directory '/home/TKB/src/mlt/src/framework'
make: *** [all] Error 1
EDIT2: I have added dlfcn-win32's bin, lib and include to the respective bin, lib and include folders in c:/Qt/Tools/mingw482_32, which solved my problem. Now I am getting a new error, which seems of similar solution but I don't see what -lbz2 is.
The error follows below:
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lbz2
collect2.exe: error: ld returned 1 exit status
make[2]: *** [../libmltavformat.dll] Error 1
make[2]: Leaving directory '/home/TKB/src/mlt/src/modules/avformat'
make[1]: *** [all] Error 1
make[1]: Leaving directory '/home/TKB/src/mlt/src/modules'
make: *** [all] Error 1
EDIT3: Right now I'm getting the following error:
After the compile code runs (it generates the .o) I get "undefined reference to 'ffmpeg_function'" in every file of the avformat module. I've noticed that it locates the includes correctly, so the problem must be in finding the libs.
I've noticed that on the config.mak file the LDFLAGS are like this:
LDFLAGS+=-L/home/TKB/bin/libavformat -L/home/TKB/bin/libavcodec -L/home/TKB/bin/libavutil
LDFLAGS+=-L/home/TKB/bin/libswscale
LDFLAGS+=-L/home/TKB/bin/libavdevice
Shouldn't it be -l (lower case) to identify a file instead of a folder? Or is it expecting one folder per lib? Besides the ffmpeg libs are named differently (e.g. avformat-56.dll)
EDIT4: To test things out I have added the following to the config.mak of the avformat module:
LDFLAGS+=-l/home/TKB/bin/avformat-56 -l/home/TKB/bin/avcodec-56 -l/home/TKB/bin/avutil-54
LDFLAGS+=-l/home/TKB/bin/swscale-3
LDFLAGS+=-l/home/TKB/bin/avdevice-56
The previous error disappeared but now I am getting the following one:
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lC:/MinGW/mysys/1.0/home/TKB/bin/avformat-56
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lC:/MinGW/mysys/1.0/home/TKB/bin/avcodec-56
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lC:/MinGW/mysys/1.0/home/TKB/bin/avutil-54
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lC:/MinGW/mysys/1.0/home/TKB/bin/swscale-3
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lC:/MinGW/mysys/1.0/home/TKB/bin/avdevice-56
collect2.exe: error: ld returned 1 exit status
make[2]: *** [../libmltavformat.dll] Error 1
make[2]: Leaving directory '/home/TKB/src/mlt/src/modules/avformat'
make[1]: *** [all] Error 1
make[1]: Leaving directory '/home/TKB/src/mlt/src/modules'
make: *** [all] Error 1
The dlls are on that folder.
EDIT5: It seems I finally managed to compile! I changed the LDFLAGS to the following:
LDFLAGS+=-L/home/TKB/bin
LDFLAGS+=-lavformat-56 -lavcodec-56 -lavutil-54
LDFLAGS+=-lswscale-3
LDFLAGS+=-lavdevice-56
And it finished without errors.
Thank you Brian for all the time and help you gave me!
Make sure you have pkg-config installed:
http://www.mltframework.org/pub/Shotcut/SetupWindowsDev/pkg-config.exe
You should be able to run pkg-config from the command line and get a good response. e.g:
# pkg-config --modversion libxml-2.0
2.9.1
# pkg-config --modversion QtGui
4.8.6
If you don't get a good response from pkg-config, you may need to set PKG_CONFIG_PATH to point at the .pc files for each of the dependencies.
Also, have a good look at the pkg-config documentation. There are some special considerations you may need to make for Windows:
http://linux.die.net/man/1/pkg-config
You also need to install dlfcn-win32. From the MLT Windows instructions:
Download dlfcn-win32
cd ~/src/dlfcn-win32-r19
./configure --enable-shared make all install
To make this redistributable, copy /mingw/bin/libdl.dll to your build directory.
If you did follow those instructions, perhaps you need to find a place to put libdl.dll so that the linker finds it.
For the "-lbz2" error, it looks like you need to download, compile and install the bzip2 library to match the one that ffmpeg was compiled against:
bzip2 1.0.6
Have a look at the README.txt file that came with the ffmpeg-shared package you downloaded. There is a long list of external libraries that ffmpeg was compiled against. bzip2 is the first one. You might need to download/compile/install more of those.
EDIT 3:
You should not specify both --avformat-shared and --avformat-static - they are mutually exclusive. You could try specifying neither of them. Or, try setting --avformat-shared=$HOME/build/
EDIT 4:
I think the reason that you are having trouble linking is because the Zeranoe builds no longer include pkg-config files (.pc).
http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=7&t=532&hilit=pkg+config
The MLT configure script relies on pkg-config to set the correct linker flags. The MLT configure script could be extended to allow the user to specify the correct linker flags. Until that happens, I think that hacking config.mak (like you did) will be the only way to make it work on Windows.
I'm glad you got it to work. Cheers!

Project Compilation Error - cannot find -lwxmsw28

While compiling a project i get the following error as
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find lwxmsw28
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/MinGW-Windows/libRegistration.dll] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
I am using wxwidgets libraries however when i ran a command in cmd as
wx-config --libs
i could not see lwxmsw28 either let me know if it is downloadable from somewhere or any workaround to resolve this issue.
Thanks
This is a linker error, rather than a compilation error.
"lwxmsw28" looks to me like a wxwidgets v2.8 microsoft windows library. Should the linker be looking for this? Since you are using mingw, I would think you should NOT be linking to msw libraries. However, I am not familiar with mingw, so maybe this is the name used for mingw libraries.
If this is the correct library, then the next question is: have you built the wxWidgets libraries? The libraries are NOT "downloadable from somewhere" - you must download the source and build the libraries yourself.
A simple test to find out if you have built the libraries - try to build one of the sample projects.

libQGLViewer installation on MacOS 10.7.2: Asking for Qt3 Support?

I am trying to install libQGLViewer2.3.13 (recent version) on MacOS 10.7.2 but it is giving me these errors after compiling some part of libqglviewer:
...
In file included from computerPlayer.cpp:33:
ui_computerPlayerInterface.Qt4.h:35:42: error: Qt3Support/Q3MimeSourceFactory:
No such file or directory
make[3]: *** [.obj/computerPlayer.o] Error 1
make[2]: *** [sub-Viewer-make_default] Error 2
make[1]: *** [sub-agora-make_default] Error 2
make: *** [sub-examples-contribs-make_default-ordered] Error 2
Can somebody please tell me how to resolve this issue?
Thank you!
Atlast I contacted QGLViewer Developers and they have fixed this problem. Please follow the instructions given on this link for installation:
http://www.libqglviewer.com/index.html
and to compile your own QGLViewer project please follow this link:
http://www.libqglviewer.com/compilation.html#pro
It explains how to create your own .pro file to generate the Makefile.