I'm trying to compile cgminer on Mac, and the compilation cannot complete, citing "ld: library not found for -lrt"
Exact terminal output:
CCLD cgminer
ld: library not found for -lrt
collect2: ld returned 1 exit status
make[1]: *** [cgminer] Error 1
make: *** [install-recursive] Error 1
Any solution for how to install the linker library via command line?
Related
I get the following error while compiling xpdf using make. I've tried using the command:
LIBS=-lm make
However, it doesn't work. I know the problem is that the c compiler cannot recognise the math symbols in the source code because the math library is not available to it, but I don't know how to fix it.
[ 71%] Linking CXX executable pdftohtml
/usr/bin/ld: CMakeFiles/xpdf_objs.dir/Gfx.cc.o: undefined reference to symbol 'acos##GLIBC_2.2.5'
//usr/lib64/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [xpdf/CMakeFiles/pdftohtml.dir/build.make:219: xpdf/pdftohtml] Error 1
make[1]: *** [CMakeFiles/Makefile2:428: xpdf/CMakeFiles/pdftohtml.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
I have put my Makefile and makeLists.txt on pastebin for more information
I realised I had to use the g++ compiler instead of gcc after reading the man page for gcc which stated:
The usual way to run GCC is to run the executable called gcc, or
machine-gcc when cross-compiling, or machine-gcc-version to run a
specific
version of GCC. When you compile C++ programs, you should invoke GCC as g++ instead.
When I am trying to compile a C code in HP-UX I am getting the following error :
gcc -g -O2 -o autocode /disk1/peru-dev/NIKIRATOOLS/FLEX/lib/hpux64/libfl.a grammer.o tokens.o pgen.o javapgen.o
ld: Mismatched Data ABI. Expected None but found EF_IA_64_ABI64 in file /disk1/peru-dev/NIKIRATOOLS/FLEX/lib/hpux64/libfl.a[libmain.o]
Fatal error.
collect2: ld returned 1 exit status
gmake[1]: *** [autocode] Error 1
I am not able to understand this "Mismatched Data ABI" error. Please help me out.
I am currently trying to install rng-tools on OSX, as I have a specific need for it to speed up a certain simulator that I am currently using. At first, I faced the problem of not having argp, so I installed argp-standalone from Homebrew. However, I still receive the following error message when trying to make rng-tools:
gcc -g -O2 -o rngtest stats.o rngtest.o librngd.a
Undefined symbols for architecture x86_64:
"_argp_parse", referenced from:
_main in rngtest.o
"_argp_usage", referenced from:
_parse_opt in rngtest.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[2]: *** [rngtest] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
I checked /usr/local/include/argp.h and it does seem to contain the correct function definitions referenced in rngtest.c, so any thoughts on what might be the problem?
I just needed rngtest which I managed to compile on OSX using this https://github.com/fproulx/rngtest (which also needs brew install argp-standalone). I made that into a homebrew formula which can be obtained here: https://github.com/oderwat/homebrew-experiments
I am trying to build osg 14.0 on slackware 14.0 from source. I get linker error while creating executable files from osgviewer:
Linking CXX executable ../../bin/osgviewer
../../lib/libosg.so.3.0.1: undefined reference to `std::__detail::_List_node_base::_M_transfer(std::__detail::_List_node_base*, std::__detail::_List_node_base*)'
../../lib/libosg.so.3.0.1: undefined reference to `std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
../../lib/libosg.so.3.0.1: undefined reference to `std::__detail::_List_node_base::_M_unhook()'
../../lib/libosgDB.so.3.0.1: undefined reference to `std::__detail::_List_node_base::swap(std::__detail::_List_node_base&, std::__detail::_List_node_base&)'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/osgviewer] Error 1
make[1]: *** [applications/osgviewer/CMakeFiles/application_osgviewer.dir/all] Error 2
make: *** [all] Error 2
This is ld.so.conf
/usr/local/lib
/usr/i486-slackware-linux/lib
/usr/lib/seamonkey
/usr/lib
Do you know where the problem could be ?
Thank you.
I added a third party library to my code and is getting errors like this when running make. Please help me understand this error.
(.text+0x9b4): undefined reference to `snd_strerror'
/home/bet/Tent/tun/app/Common/hl/lib/libGHAL.a(gfxhal.o): In function `GFX_create_region':
/home/bet/Tent/tun/app/Common/hl/src/GHAL/gfxhal.c:1141: undefined reference to `my_key_handler'
/home/bet/Tent/tun/app/Common/hal/src/GHAL/gfxhal.c:1141: undefined reference to `create_window'
collect2: ld returned 1 exit status
make[2]: *** [all] Error 1
make[2]: Leaving directory `/home/bet/Tent/tun/app/Common/c_app'
make[1]: *** [ctv_all] Error 2
make[1]: Leaving directory `/home/bet/Tent/tun/app/Common'
Those are Linking errors, which tell you the linker cannot find definitions for the library you are using.
You will have to link the library to your project.
gcc <your files for compilation> -lLibName
Read this for better understanding.
I still get the error even if
readline library is installed and
-lreadline is added to gcc compiling command.
The root cause of my issue is the order of the libraries/code: -lreadline (and other libraries) should be put right before -o options.