missing linkers in Qt - c++

I have downloaded this project https://github.com/owncloud/sync-qt
next i did some modification to it.
I have added this files https://github.com/frankosterfeld/qtkeychain and sqlite3.h because of a missing libraries
Now the problem is that i have got those issues:
error: cannot find -lqtkeychain
error: cannot find -lsqlite3
error: cannot find -lkparts
error: cannot find -lkdeui
error: cannot find -lkdecore
error: collect2: error: ld returned 1 exit status
My OS is Fedora 18 64bit
I am using Qt Creator 2.5.0 Based on Qt 4.8.2 (64 bit)
I think this error is that i have some missing linkers !! but i don't know how to fix that ??

It is not the "linkers" which are missing, but some (development) libraries which are required to link the final executable (the linker takes the object files produced from your sources and all required libraries and links them together to produce the final executable file).
You need to make sure that the necessary -devel packages are installed - e.g. for the kde libraries, you need to install kdelibs4-devel. Since you have been able to compile the sources, it seems like these packages are already available on your system (they also contain the #include files, so without them compilation would already fail).
It seems that fedora stores these libraries below /usr/lib/kde4/devel/ (or /usr/lib64/kde4/devel/) - check that these files are there (e.g. /usr/lib64/kde4/devel/libkdecore.so). If not, install the respective -devel package, like
# yum install kdelibs4-devel

Related

xcb linking errors with premake (C++)

I can't seem to make my premake5.lua configuration to link against xcb.
I get undefined reference to "xcb_connect". So far I've tried (in premake5.lua):
libdirs {os.findlib("xcb")}
links {"xcb", "xcb-randr" }
Notice that os.findlib returns the same path for both xcb and xcb-randr.
I tried installing all sorts of packages, running pkg-config on both libs to see the required flags and also inspecting if the generated make file ones matched.
I don't know if it is related but I'm running Debian under wsl.
Maybe i'm missing something. Thanks for the help.

How do you use C++ fmt on CentOS9?

I installed fmt using dnf install fmt. It was successful. But when I try to use it as #include <fmt/format.h> it says it is not found. I downloaded include from fmt git page so it finds format.h now with -I... but I have compilation errors.
undefined reference to `fmt::v8::vformat[abi:cxx11](fmt::v8::basic_string_view<char>, fmt::v8::basic_format_args<fmt::v8::basic_format_context<fmt::v8::appender, char> >)'
collect2: error: ld returned 1 exit status
I tried -lfmt but it errors with
/usr/bin/ld: cannot find -lfmt
I cant find any help for this type of use on the git.
How do you use fmt lib on CentOS9 without building fmt project manually?
EIDT: dnf install output
Fedora/RHEL/CentOS uses the following naming convention for all packages that installed shared libraries:
name - this package contains runtime shared libraries that are needed to run programs that are linked with this library.
name-devel - the "devel" packages contains header files and the symbolic links that allow you to link with the shared library when developing applications that use this library.
You need both packages to compile the code that uses the library. The devel package specifies a dependency on the main package, so dnf install name-devel is going to install both packages.
You should invest a little bit of time to learn how to build your own rpm packages. It's not that complicated. When you build your package rpmbuild will take care of analyzing the resulting binary, discovering which shared libraries it links with, then recording the appropriate dependency in your own rpm package, so installing it will pull in only the main name package.

g++ ld shared library error with code::blocks

There are similar topics, but I haven't managed to find my answer in them.
I am building a test console application using the code::blocks IDE. It needs to load a DVB shared library called libhdhomerun.so (from Silicon Dust) for the HD Homerun DVB tuners. The HDHR tuner library has being installed using ./configure, ..., sudo make install, ldconfig etc and it all works with their utilities (built at the same time). So - the library is there and OK.
The library installed itself into /usr/local/lib. There is actually no symlink to it as there is with other shared libraries, but then it doesn't have any version information on the end either.
When I build the code (having explicitly included /usr/local/lib/libhdhomerun.so), the ld stage fails with
"cannot find -lhdhomerun.so"
I have tried every combination of including (/usr/local/lib/) libhdhomerun.so, hdhomerun.so, libhdhomerun, hdhomerun, creating a symlink to it etc. Nothing makes any difference.
The bizarre thing is that I have udev, mysql and libdvbv5 shared libraries included in exactly the same way, and they are fine. The only one that will not link is hdhomerun.
If I run a manual verbose link step from the command line "ld -lhdhomerun.so --verbose", it does fail - because it is trying to find libhdhomerun.so.so.
Any suggestions gratefully received - but I do need to keep using code::blocks.
To link the library properly, you need to have library path defined in your environment, and use proper library name with -l flag. Library path is defined in LD_LIBRARY_PATH environment variable. For -l flag to g++, library extension should not be provided - as you already observed, so in your case it should be like this:
-lhdhomerun

DSO missing from command line (With CMake)

I am trying to convert a c++ project from Windows to Debian by compiling everything again with Cmake.
I am not really use to work on Linux but I have managed to install everything properly.
This is the error:
/usr/bin/ld: ../shared/libshared.a(BigNumber.cpp.o): undefined reference to symbol 'BN_new##OPENSSL_1.0.2d'
//usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.2: error adding symbols: DSO missing from command line
This actually seems like a common question but I don't know what to do with Cmake. I already saw few answers like:
DSO missing from command line
How do I tell CMake to link in a static library in the source directory?
How to add linker or compile flag in cmake file?
I am a bit confused, could you help me to understand what I need to do with Cmake please?
Thank you
It is hard to guess what may be going wrong without seeing the CMake file itself, but here are some possible solutions.
Based on the similar error in your first referenced answer (DSO missing from command line), it would seem you may have simply forgotten to link to the libcrypto.so.1.0.2 library (or perhaps missed the ssl library as well). In my experience, these are often used in tandem, so linking both may be what you need. Use the target_link_libraries command to link these libraries to your CMake target:
target_link_libraries(MyLib PRIVATE ssl crypto)
I've also seen cases where this error arises due to a mismatch in the OpenSSL versions. For example, OpenSSL version 1.1 may be installed on your machine, but the library or packages you are using require version 1.0.2 (as the error suggests). If this is the case, you can uninstall the current OpenSSL version (1.1) and install the older version (1.0.2):
apt-get purge libssl-dev
apt-get install libssl1.0-dev
The error you are getting is about a missing link for a function that was called in the BigNumber.cpp file.
What's is happening is that CMakeLists.txt is most likely missing a library in:
TARGET_LINK_LIBRARIES( youApp
library1
library2
)
PS: the order in which you call the libraries is also important to get the linker to work properly.

How to compile OpenCV with extra modules on OS X?

I've previously compiled OpenCV 3.0 successfully following this guide, which essentially consists of the following steps:
Download all the prerequisites (XCode, Command Line Tools, CMake and OpenCV source)
Build static libs by configuring CMake (via gui) with:
Uncheck BUILD_SHARED_LIBS
Uncheck BUILD_TESTS
Add an SDK path to CMAKE_OSX_SYSROOT (if it matters, I used /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk).
Add x86_64 to CMAKE_OSX_ARCHITECTURES (emphasis mine, this seems to be the issue, I'm sure I've followed this step)
Uncheck WITH_1394
Uncheck WITH_FFMPEG
Configure and generate via CMake, then make and sudo make install from the CLI.
All of the above alone works fine.
I'm now looking to compile OpenCV with the extra modules. According to their read-me it should be as simple as filling out OPENCV_EXTRA_MODULES_PATH to <opencv_contrib>/modules in CMake and then building as usual.
I followed the steps outlined above with the added parameter and building OpenCV succeeds, however, when trying to use one of the extra modules in a program (namely cv::ximgproc::createStructuredEdgeDetection, if it matters), I'm getting the following error when compiling:
Undefined symbols for architecture x86_64:
"cv::ximgproc::createStructuredEdgeDetection(cv::String const&, cv::Ptr<cv::ximgproc::RFFeatureGetter const>)", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've included the header which should include the above:
#include <opencv2/ximgproc.hpp>
I'm compiling via XCode, where I've set an additional header search path of /usr/local/include and a library search path of /usr/local/lib for the project, am I missing something here?
Standard OpenCV functionality works fine.
What could be the issue and how would I go about solving it?
OpenCV contrib modules are built correctly.
You just need to add the contrib libs to your dependencies, in this case adding: -lopencv_ximgproc.
All available libs can be found under <OPENCV_DIR>/install/ folder.
E.g. in my 32bit vc12 static build are in<OPENCV_DIR>/install/x86/vc12/staticlib folder.