errors during link when building glfw in fedora 27 - c++

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

Related

Linking problems with dlib: recompile with -fPIC

I would like to use this ROS package which relies on dlib. I compile with catkin build, but I get this error in linking I guess:
/usr/bin/ld: /usr/lib/libdlib.a(threads_kernel_shared.o): relocation R_X86_64_PC32 against symbol `_ZN4dlib21threads_kernel_shared14thread_starterEPv' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [/home/alberto/tiago_dual_public_ws/devel/.private/gazr/lib/libgazr.so] Error 1
make[1]: *** [CMakeFiles/gazr.dir/all] Error 2
make: *** [all] Error 2
I have installed dlib using sudo apt-get install libdlib-dev on my Ubuntu 18.05 (ROS Melodic) machine. How can I solve this problem? Documentation of dlib and the repo instruction does not help me a lot.
Thanks in advance.
I found 2 possible solution to the problem.
Installing dlib with sudo apt-get install libdlib-dev
In this case you should link dlib to your library target like target_link_libraries(gazr dlib ${OpenCV_LIBRARIES})
Rememberto use find_package(dlib REQUIRED)
Installing dlib from source
It's also possible to use directly the dlib source file. In this case you need to add the dlib source directory to the project using add_subdirectory(your_path/dlib dlib) and add it to the library target_link_libraries(gazr dlib ${OpenCV_LIBRARIES}).
ATTENTION: In this case you shall not use find_package(dlib REQUIRED)
Hope this is helpful!

Ipopt installation

I tried to install the Ipopt package on my Mac (macOS Catalina, 10.15.0) following this installation guide:
https://coin-or.github.io/Ipopt/INSTALL.html
I installed ASL as the linear solver and made it to the point 3. makewithout any further issues. However, when I run make test, I receive the following error message:
cd test; /Applications/Xcode.app/Contents/Developer/usr/bin/make test
CXX hs071_main.o
CXX hs071_nlp.o
CXXLD hs071_cpp
CC hs071_c.o
CCLD hs071_c
ln -s ../examples/hs071_f/hs071_f.f hs071_f.f
F77 hs071_f.o
F77LD hs071_f
ld: library not found for -lmkl_core
collect2: error: ld returned 1 exit status
make[1]: *** [hs071_f] Error 1
make: *** [unitTest] Error 2
Does anyone know how to fix this issue? It seems like it can't find the mkl library...
Yes, you have to install the Intel MKL library https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html since it is not part of Mac OS.

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

usr/bin/ld: cannot find -lncurses

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

failed to build shared libraries with boost 1.48

I am trying to build boost 1.48 on an amd64 machine however shared libraries are not built due to a relocation error. Which I assumed due to -fPIC and that is the reason however could not fix that.
More specifically, here is what I get, with the boost from the trunk,
$ ./b2
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a(codecvt.o): relocation R_X86_64_32S against `vtable for std::codecvt<wchar_t, char, __mbstate_t>' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
I also tried these
./bjam -d2
./bjam address-model=64 cxxflags=-fPIC
as explained/discussed here
http://boost.2283326.n4.nabble.com/fPIC-option-for-boost-td3176976.html
however did not help. I could not manage to build the shared libraries that I configure with boostrap.sh.
I had a similar issue trying to build mosh-1.2.2 on a standard debian squeeze installation. The following worked for me:
# cd /usr/lib/gcc/x86_64-linux-gnu/4.4.5
# rm libstdc++.so
# ln -s ../../../x86_64-linux-gnu/libstdc++.so.6 libstdc++.so
To explain in a more detail, the existing symlink was pointing to a non-existent file:
# cd /usr/lib/gcc/x86_64-linux-gnu/4.4.5
# ls -l libstdc++.so
..
lrwxrwxrwx 1 root root 23 May 3 2011 libstdc++.so -> ../../../libstdc++.so.6
..
I located the correct file location
# dpkg -S 'libstdc'
..
libstdc++6: /usr/lib/x86_64-linux-gnu/libstdc++.so.6
..
Then repaired the symlink as described in the first code segment.
The error I was getting during compiling was:
make[3]: *** [mosh-client] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a(functexcept.o): relocation R_X86_64_32 against `std::bad_typeid::~bad_typeid()' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a: could not read symbols: Bad value
No idea how this particular debian squeeze server broke. I've been compiling on other squeeze systems with no trouble.