usr/bin/ld: cannot find -lncurses - c++

I am attempting to link with the ncurses library. This doesn't work, though. These are the error messages:
/usr/bin/ld: cannot find -lcurses
/usr/bin/ld: cannot find -lncurses
collect2: error: ld returned 1 exit status
Makefile:102: recipe for target 'ch_lab' failed
make[1]: *** [ch_lab] Error 1
My question is, which package should I install to get this working on Ubuntu?

You should install libncurses
sudo apt-get install libncurses5-dev

Related

Compilation Failing for xalan-c in Ubuntu

I am trying to build xalan-c (version 1.12) with icu in Ubuntu but it fails.
Could anyone help me with this.
Environment : Ubuntu 20.04
Steps to reproduce :
Clone xalan-c
cmake -G "Unix Makefiles" -DCMAKE_PREFIX_PATH="path to vcpkg installed libraries" -DCMAKE_INSTALL_PREFIX=./install/Xalan-c -DCMAKE_BUILD_TYPE=Debug -Dtranscoder=icu "path to source"
make
Error
[ 95%] Linking C executable SimpleXPathCAPI
/usr/bin/ld: /home/minhaaj/app/vcpkg/installed/x64-linux/lib/libicuuc.a(rbbistbl.ao): undefined reference to symbol '_ZTVN10__cxxabiv121__vmi_class_type_infoE##CXXABI_1.3'
/usr/bin/ld: /lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [samples/CMakeFiles/SimpleXPathCAPI.dir/build.make:90: samples/SimpleXPathCAPI] Error 1
make[1]: *** [CMakeFiles/Makefile2:842: samples/CMakeFiles/SimpleXPathCAPI.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Please note I have applied a patch for configuration error as below in src/xalanc/Utils/MsgCreator/CMakeLists.txt
target_link_libraries(MsgCreator ICU::uc ICU::i18n)
changed to
target_link_libraries(MsgCreator ICU::uc ICU::i18n ICU::data)

I am trying to install gameplay game engine ,But encountered an error

I am trying to install gameplay game engine on my ubuntuMATE 17.10, following steps here. After cmake I type make and get errors below:
/usr/bin/ld: /home/samdare/Downloads/extracts/GamePlay-master/external-deps/lib/linux/x86_64/libgameplay-deps.a(btVoronoiSimplexSolver.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /home/samdare/Downloads/extracts/GamePlay-master/external-deps/lib/linux/x86_64/libgameplay-deps.a(SphereTriangleDetector.o): relocation R_X86_64_32S against symbol `_ZTV22SphereTriangleDetector' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /home/samdare/Downloads/extracts/GamePlay-master/external-deps/lib/linux/x86_64/libgameplay-deps.a(trees.o): relocation R_X86_64_32S against symbol `_length_code' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
samples/browser/CMakeFiles/sample-browser.dir/build.make:745: recipe for target 'samples/browser/sample-browser' failed
make[2]: *** [samples/browser/sample-browser] Error 1
CMakeFiles/Makefile2:235: recipe for target 'samples/browser/CMakeFiles/sample-browser.dir/all' failed
make[1]: *** [samples/browser/CMakeFiles/sample-browser.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
GamePlay : The linker in Ubuntu 16.04 - amd64 is OK with GamePlay as is.
sudo apt install g++ cmake libglu1-mesa-dev libogg-dev libopenal-dev libgtk2.0-dev curl lib32z1-dev
git clone https://github.com/gameplay3d/GamePlay.git
cd GamePlay/
./install.sh
mkdir build && cd build/ && cmake .. && make
Executable´s created :
build/samples/browser/sample-browser
build/samples/racer/sample-racer
build/samples/character/sample-character
build/samples/spaceship/sample-spaceship
The Ubuntu 16.04 files seem to work perfect with Ubuntu 17.10 - amd64. My result "build/" → gameplay-build/ was uploaded as gameplay-build_ubuntu16_amd64.tar.gz (240MB) . Can be unpacked to any location in /home/*
Link https://drive.google.com/file/d/1EIggScf8bGdbBCTMOpjbmKbQcWgs0tpv/view?usp=sharing

errors during link when building glfw in fedora 27

When i try to make the project i get :
[pepe#localhost glfw-3.2.1]$ make
....
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/7/../../../libXinerama.so when searching for -lXinerama
/usr/bin/ld: skipping incompatible //lib/libXinerama.so when searching for -lXinerama
/usr/bin/ld: skipping incompatible //usr/lib/libXinerama.so when searching for -lXinerama
/usr/bin/ld: cannot find -lXinerama
collect2: error: ld returned 1 exit status
make[2]: *** [examples/CMakeFiles/wave.dir/build.make:129: examples/wave] Error 1
make[1]: *** [CMakeFiles/Makefile2:185: examples/CMakeFiles/wave.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
I have xinerama installed but aparently there is no way to link it with make.
See all of those "skipping incompatible" messages? That is because those libraries have the wrong instruction set.
It looks to me as if it is trying to build 32 bit code against 64-bit libraries. Or vice versa.
Here is what I get on my Fedora system for a library search. You need to install the right "*-devel" package for your build type. You can't have both the i686 and x86_64 devel packages installed at the same time.
$ sudo dnf list 'libXine*'
Installed Packages
libXinerama.i686 1.1.3-9.fc27 #fedora
libXinerama.x86_64 1.1.3-9.fc27 #fedora
Available Packages
libXinerama-devel.i686 1.1.3-9.fc27 fedora
libXinerama-devel.x86_64 1.1.3-9.fc27 fedora
This will do for glfw-3.2.1 :
dnf install mesa-libGL-devel.x86_64 libXi-devel.x86_64 libXcursor-devel.x86_64 doxygen libXrandr-devel.x86_64 libXmu-devel libXinerama-devel.x86_64
cd glfw-3.2.1/
mkdir build
cd build/
cmake ../
make

Undefined reference to symbol, DSO missing from command line

I'm trying to compile the Lotech framework under Debian Jessie, but I'm can't seem to get past a specific point in compilation. I've searched the error messages that come up, and almost all of them seem to be resolved by installing or linking a missing dependency, but I can't figure out what that dependency is in this situation.
cp buildtmp.linux/liblt.a linux/
cd clients/glfw/ && make LTCFLAGS="-O3 -DNDEBUG -DLTLINUX " && cp ltclient ../../
make[1]: Entering directory `/home/jake/Desktop/copy-lotech-master/clients/glfw'
g++ -O3 -DNDEBUG -DLTLINUX -I../../linux/include -L../../linux ltclient.cpp \
-o ltclient -static-libstdc++ -static-libgcc ../../linux/liblt.a ../../linux/libpng.a ../../linux/libz.a ../../linux/liblua.a ../../linux/libvorbis.a ../../linux/libbox2d.a ../../linux/libglfw.a ../../linux/libGLEW.a ../../linux/libopenal.a ../../linux/libcurl.a -lX11 -lGL wrap_memcpy.o -Wl,--wrap=memcpy
/usr/bin/ld: ../../linux/libopenal.a(helpers.o): undefined reference to symbol 'dlclose##GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [ltclient] Error 1
make[1]: Leaving directory `/home/jake/Desktop/copy-lotech-master/clients/glfw'
make: *** [ltclient] Error 2
For me this does the trick
set (CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -ldl")
Useful links
Link1
Link2
Link3 <- Cmake how to find libraries
Link4
Link5
DSO means Dynamic Shared Object. Add the option "-lpthread" works for me.

linking things in c++ using object file

PROBLEM SOLVED:::
I am using LEDA library in c++.
command used to make object file.
g++ -I$LEDAROOT/incl -c mult.cpp
this command runs fine
I am getting eroor while linking step.
HERE IS THE EROOR
varun#Kinley:~/Documents/LEDA/test/numbers$ g++ -L$LEDAROOT mult.o -lleda -lX11 -lm
/usr/bin/ld: cannot find -lX11
collect2: error: ld returned 1 exit status
I think I need to install some package,because when I googled this error the most of problems are solved by installing some package .
I didn't find lx11 error
some of the eroor messages that I googled.
error 1
/usr/bin/ld: cannot find -lfreetype collect2: ld returned 1 exit
status
error 2
/usr/bin/ld: cannot find -lz collect2: ld returned 1 exit status
Links where I find these posts
http://www.qtcentre.org/threads/21069-collect2-ld-returned-1-exit-status
http://www.cyberciti.biz/faq/centos-rhel-redhat-usrbinld-cannot-findlc-error/
Do I need to install some package or there is some other problem
Could be two things
1) The X11 library is installed in a non-standard path. Use the search command to see if libX11.a or libX11.so is available on your system. If yes add the directory path to the -L option.
2) You are missing the libX11 library.
In this case, login as admin and use yum (assuming linux) to install this library.
Eg:
"yum install libX11.i386" or "yum install libX11.x86_64", depending on your architecture (32 bit or 64 bit).