I have a problem with the installation of OMNeT++ on Ubuntu. The error occurs during the ./configure
command and relates to the math library: configure: error: Standard C math library -lm not found
.
I have installed all the necessary packages (e.g., libc6-dev, build-essential) and followed all the installation instructions. Moreover, when I write a simple C code and link it with the math library using -lm
, it works correctly. So why does this error occur during ./configure
?
This is the output of the ./configure
:
configure: Environment variables (PATH and PYTHONPATH) are correctly set.
configure: Reading configure.user for your custom settings.
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for clang... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking for clang++... clang++
checking whether we are using the GNU C++ compiler... yes
checking whether clang++ accepts -g... yes
checking for clang++... clang++
checking for c++14 support... yes
checking for ranlib... ranlib
checking whether LLD linker is available... no
checking whether clang++ supports -fno-omit-frame-pointer... no
checking whether clang++ supports -glldb... no
checking whether clang++ supports -ggdb3... no
checking whether clang++ supports -fstandalone-debug... no
checking whether clang++ supports -fno-limit-debug-info... no
checking whether clang++ supports -Wl,--no-as-needed... no
checking whether clang++ supports -Wl,--as-needed... no
checking for swapcontext... no
checking if shared libs need -fPIC... failure
configure: WARNING: COULD NOT FIGURE OUT HOW TO BUILD SHARED LIBRARY -- reverting to static libs
checking for dlopen with CFLAGS="" LIBS=""... no
checking if --export-dynamic linker option is supported/needed... test failed
checking for flags needed to link with static libs containing simple modules... no solution found
configure: WARNING: Avoid linking with static libraries containing simple modules
configure: WARNING: and other dynamically registered components. Those components
configure: WARNING: will not be found by the simulation program, because the linker
configure: WARNING: leaves them out from the executable.
checking whether linker supports -rpath... no
checking for bison... bison -y
checking for flex... flex
checking lex output file root... lex.yy
checking lex library... none needed
checking whether yytext is a pointer... no
checking for make... make
checking for perl... perl
checking for swig... not found
checking for python3... python3
checking if all necessary Python modules are available... yes
checking for math with CFLAGS="" LIBS=""... no
checking for math with CFLAGS="" LIBS="-lm"... no
configure: error: Standard C math library -lm not found
Maybe is a problem with the LLD library? The script says that LLD linker is unavailable, but it is installed. This is the output of ld.lld --version
: Ubuntu LLD 14.0.0 (compatible with GNU linkers)
Thank you for your help.
I tried to remove and re-install the libraries, but it's not working.
sudo apt install libstdc++-12-dev
should solve the problem.