linking error cxx: cannot find -lvulkan - c++

When I tried to compile example from Anvil framework for Vulkan I get following errors:
[ 97%] Linking CXX executable OutOfOrderRasterization
/usr/bin/ld: cannot find -lvulkan
collect2: error: ld returned 1 exit status
CMakeFiles/OutOfOrderRasterization.dir/build.make:126: recipe for target 'OutOfOrderRasterization' failed
make[2]: *** [OutOfOrderRasterization] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/OutOfOrderRasterization.dir/all' failed
make[1]: *** [CMakeFiles/OutOfOrderRasterization.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
How i need to configure Vulkan to resolve it? (Ubuntu)

Check you LIBRARY paths. You might need to download and install vulkan. There should a .so file in one your library paths(/usr/lib{,64},/lib{,64}, /usr/share/lib{,64}) named to the effect of libvulkan.numbers.so.
See this ask ubuntu question: https://askubuntu.com/questions/796442/ld-cannot-find-lvulkan

CMake versions 3.7 and later ship with a FindVulkan.cmake module that finds the Vulkan includes and library for you if you have a Vulkan SDK installed and the VULKAN_SDK environment variable set. The CMake module also finds the includes and library if you have installed a Vulkan package to your system directories. The Getting Started guide on the LunarXchange website has some additional detail.

Related

Using OPCUA Library in a New Cmake Project

In this time, I want to use Freeopcua to create a library to use in other project.
I have install all the tools in debian.soft file and build with following command sudo sh build.sh, cmake ., make, sudo make install. Although, in directory /usr/local/include and /usr/local/lib, there are opc directory and libopc*.so respectively, when I create a new cmake project, there is an error. Hope someone can help me or give some suggest. Thanks everyone~~~
I have refer to Libraries in /usr/local/lib not found, but it doesn't work for me
CMakeLists.txt
cmake_minimum_required(VERSION 2.8.12)
project(OPCUAIndependent)
include_directories(/usr/local/include/)
link_directories(/usr/local/lib/)
add_executable(sourceCode sourceCode.cpp)
target_link_libraries(sourceCode opc)
Error
[ 50%] Linking CXX executable sourceCode
/usr/bin/ld: cannot find -lopc
collect2: error: ld returned 1 exit status
CMakeFiles/sourceCode.dir/build.make:96: recipe for target 'sourceCode' failed
make[2]: *** [sourceCode] Error 1
CMakeFiles/Makefile2:82: recipe for target 'CMakeFiles/sourceCode.dir/all' failed
make[1]: *** [CMakeFiles/sourceCode.dir/all] Error 2
Makefile:90: recipe for target 'all' failed
make: *** [all] Error 2

Error while generating the run-time armadillo library on ubuntu16.04

According to the Linux and macOS: Installation guide for Armadillo, on Debian machine(ubuntu-16.04) I was trying for installing the armadillo library and after executing the command : $cmake .
The full stop separated from "cmake" by a space is important.
I executed the command : $ make (also tried with root privileges still), the following error was thrown.
piyush#ubuntu:~/armadillo$ sudo make
Scanning dependencies of target armadillo
[ 33%] Building CXX object CMakeFiles/armadillo.dir/src/wrapper1.cpp.o
[ 66%] Building CXX object CMakeFiles/armadillo.dir/src/wrapper2.cpp.o
[100%] Linking CXX shared library libarmadillo.so
/usr/bin/ld: /usr/local/lib/libsuperlu.a(util.c.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libsuperlu.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
CMakeFiles/armadillo.dir/build.make:123: recipe for target 'libarmadillo.so.9.800.2' failed
make[2]: *** [libarmadillo.so.9.800.2] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/armadillo.dir/all' failed
make[1]: *** [CMakeFiles/armadillo.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
This library is available in Ubuntu. Just do
sudo apt install libarmadillo-dev
P.S. Never run sudo make, it's a very bad practice.

Vulkan SDK Version 1.1.85.0 linking on Kubuntu 18.10

I'm currently working on a game engine with vulkan.
I just wanted to try whether it compiles on linux, but I don't know how to link my Vulkan SDK libraries. I downloaded the "vulkansdk-linux-x86_64-1.1.85.0.tar.gz" from the LunarG homepage, but now I dont know what I should link under "target_link_libraries".
I tried to link the "libvulkan.so" from the lib folder, but it does not work.
Some help from you would be great, because I never worked with CMAKE on linux.
/usr/bin/ld: cannot find -lvulkan
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/Untitled.dir/build.make:669: ../output_linux /Untitled] Error 1
make[2]: *** [CMakeFiles/Makefile2:73: CMakeFiles/Untitled.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/Untitled.dir/rule] Error 2
make: *** [Makefile:118: Untitled] Error 2
Thanks for help,
Marlon
The SDK's Linux Getting Started Guide found in your SDK tarball and at this link explains much of this. In fact, there's even a section called "Using Vulkan in CMake Projects" that shows how to use the FindVulkan CMake module. The SDK also contains numerous example programs, also built with CMake.

static link glibc & boost_python36 for python extension

I'm writting a extension for pyton3.6. My develop machine run gcc7.3, and production environment os is centos6. I use the following link option to static link glibc to avoid upgrade glibc2.12 to glibc2.14+.
-Wl,-Bdynamic -lpython3.6m -Wl,-Bstatic -lboost_python36
But get error:
[ 50%] Linking CXX shared module helloext.so
/usr/bin/x86_64-linux-gnu-ld: cannot find -lgcc_s
/usr/bin/x86_64-linux-gnu-ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
CMakeFiles/helloext.dir/build.make:94: recipe for target 'helloext.so' failed
make[2]: *** [helloext.so] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/helloext.dir/all' failed
make[1]: *** [CMakeFiles/helloext.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Anyone known? Thanks.
The reason might be although libgcc is present it may not be in the paths known to ldconfig. Check this by doing
/sbin/ldconfig -p | grep libgcc
Does the output show that there is a link to libgcc corresponds to paths that you have listed above?
A work around for you may be to add the link to the relevant library to your compile command e.g.
... -L /usr/lib/gcc/x86_64-linux-gnu/4.6/
Another may be to create a symbolic link to the library yourself.
ln -s /usr/lib/gcc/x86_64-linux-gnu/4.6/libgcc_s.so /usr/lib/gcc/libgcc_s.so
You have not informed us about Linux you are using. Update 4.6 with the proper number in the command above.

Building Google glog with CMake on Windows (failed)

I need the glog library (https://github.com/google/glog) for a C++ project (Windows 10, Qt 5.10) and try to build it from sources using CMake. The CMake configuration process was succesful, the path to gflags is also set correctly.
After configurating glog with CMake, I tried to compile it with MinGW (command mingw32-make in the build folder). After 64%, the building process stopped with an error:
[ 64%] Linking CXX executable utilities_unittest.exe
libglog.a(symbolize.cc.obj):symbolize.cc:(.text+0x15f): undefined reference to `_imp__SymFromAddr#20'
libglog.a(symbolize.cc.obj):symbolize.cc:(.text$_ZN6google14SymInitializerC1Ev[__ZN6google14SymInitializerC1Ev]+0x2f): undefined reference to `_imp__SymSetOptions#4'
libglog.a(symbolize.cc.obj):symbolize.cc:(.text$_ZN6google14SymInitializerC1Ev[__ZN6google14SymInitializerC1Ev]+0x51): undefined reference to `_imp__SymInitialize#12'
libglog.a(symbolize.cc.obj):symbolize.cc:(.text$_ZN6google14SymInitializerD1Ev[__ZN6google14SymInitializerD1Ev]+0x12): undefined reference to `_imp__SymCleanup#4' libglog.a(demangle.cc.obj):demangle.cc:(.text+0x9e): undefined reference to `_imp__UnDecorateSymbolName#16'
collect2.exe: error: ld returned 1 exit status
CMakeFiles\utilities_unittest.dir\build.make:98: recipe for target 'utilities_unittest.exe' failed
mingw32-make[2]: *** [utilities_unittest.exe] Error 1
CMakeFiles\Makefile2:482: recipe for target 'CMakeFiles/utilities_unittest.dir/all' failed
mingw32-make[1]:
*** [CMakeFiles/utilities_unittest.dir/all] Error 2
Makefile:159: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
Do you have any idea how to fix it?
I already tried to enable the
CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
option, but this did not solve the problem.
Thank you for your help!