Unable to compile C++ code with simulink with libmwfl.so errors - c++

We are trying to compile some C++ code with simulink /matlab . We are getting some libmwfl.so errors. We have made sure that the files are linked . Also on doing a search for the file libmwfl.so it seems that it exists. So at the moment a bit clueleess. The error log is as below.
/usr/bin/ld: warning: libmwfl.so, needed by /usr/local/MATLAB/R2015b/bin/glnxa64/libmat.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libmwi18n.so, needed by /usr/local/MATLAB/R2015b/bin/glnxa64/libmat.so, not found (try using -rpath or -rpath-link)
Regards

Related

g++ failing to link statically when compiling to binary format: "skipping incompatible libm.a when searching for -lm"

While attempting to write a kernel in C++, I've run into a peculiar issue.
When prompting g++ to compile even a very basic C++ file statically and to binary, it simply keeps skipping over the static math library (libm.a), ultimately failing to compile.
Attempting to compile a simple C++ file:
test.cpp
int main() {
return 0;
}
using this g++ command:
g++ -static test.cpp -Wl,--oformat=binary
I receive the following error output:
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /lib/x86_64-linux-gnu/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /lib/x86_64-linux-gnu/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.a when searching for -lm
/usr/bin/ld: cannot find -lm: No such file or directory
I am running Linux Mint Cinnamon V. 21 (Vanessa) on a VirtualBox VM.
In my attempt to narrow down the issue, I have also attempted to exclude the -static flag:
g++ test.cpp -Wl,--oformat=binary
Which results in a different error entirely:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
After thorough research, I was made aware that this could be caused by an incompatibility between 32-bit libraries and 64-bit files. Everything is supposed to be in 64 bit.
I did attempt to determine bitness of libm.a using file.
When using the file command on /usr/lib/x86_64-linux-gnu/libm.a, I receive the following output:
libm.a: ASCII text
indicating neither bitness. This led me to conclude that perhaps the library is damaged and needs updating. After running sudo apt-get install libc6-dev, the issue persists, however.
I'm not sure what to do at this point.
Update:
I've opened libm.a in a text editor and the entire contents of the file are:
/* GNU ld script
*/
OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /usr/lib/x86_64-linux-gnu/libm-2.35.a /usr/lib/x86_64-linux-gnu/libmvec.a )
Update 2: apparently this is a linker script. Both referenced files libm-2.35.a and libmvec.a are present in my directory and are, according to objdump, 64-bit-versions.
Based on the compiler's error output, it seems that in my case, for whatever reason, g++ (or more specifically, ld) fails to use this linker script. What could possibly cause this?
I have come to the conclusion that it is not normally possible to statically link C++ code involving object oriented features into a fully functional binary file, as libm.a can apparently be linked to ELF only.
besides: even the static version of glibc, which is also required, references other dynamic libraries, making it useless for kernel code.
there might be some sort of workaround, but it seems that g++ does not support this functionality by default.

Error => /usr/bin/ld: cannot find -lQt5::Core -lQt5::Gui -lQt5::Test -lQt5::Concurrent -lQt5::OpenGL

I am getting these errors
`/usr/bin/ld: cannot find -lQt5::Core /usr/bin/ld:
cannot find -lQt5::Gui /usr/bin/ld:
cannot find -lQt5::Widgets /usr/bin/ld:
cannot find -lQt5::Test /usr/bin/ld:
cannot find -lQt5::Concurrent /usr/bin/ld:
cannot find -lQt5::OpenGL collect2: error: ld`
when i am makeing the project [https://github.com/estranho/facialSketchRecognition] .When i am making without ENABLE_SAMPLES i fotn get any error but when building Samples i m getting these errors.
https://github.com/estranho/facialSketchRecognition the project readme says cmake.. and make thats it but couldnt run any executable so building Samples is needed.
You must:
either install globally the Qt5 development library
define your LD_LIBRARY_PATH to allow the system to find the Qt5 library, when performing the linking step (which is exactly what /usr/bin/ld is trying to do)
Under Ubuntu the package is named qtdeclarative5-dev.

cuDNN library not found when building tensorflow example with bazel

I tried to test the tensorflow example, with c++ api, described here: https://www.tensorflow.org/tutorials/image_recognition#usage_with_the_c_api
I was able to install tensorflow from sources, but when I wanted to build the example with: bazel-bin/tensorflow/examples/label_image/label_image
I get this error :
ERROR: /home/user/tensorflow_sources/tensorflow/tensorflow/examples/label_image/BUILD:14:1: Linking of rule '//t
ensorflow/examples/label_image:label_image' failed (Exit 1)
/usr/bin/ld: warning: libcudnn.so.6, needed by bazel-out/k8-opt/bin/_solib_local/_U_S_Stensorflow_Sexamples_Slabel_
Uimage_Clabel_Uimage___Utensorflow/libtensorflow_framework.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libcufft.so.8.0, needed by bazel-out/k8-opt/bin/_solib_local/_U_S_Stensorflow_Sexamples_Slabe
l_Uimage_Clabel_Uimage___Utensorflow/libtensorflow_framework.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libcurand.so.8.0, needed by bazel-out/k8-opt/bin/_solib_local/_U_S_Stensorflow_Sexamples_Slab
el_Uimage_Clabel_Uimage___Utensorflow/libtensorflow_framework.so, not found (try using -rpath or -rpath-link)
The issue is exactly the same as described here: https://github.com/tensorflow/tensorflow/issues/15029
But the solution is not clear :
I need configure LPATH to include path of libcudnn.so. Although I
put the lib at the standard location.
What is this LPATH variable ? What is the standard location for this library? Because for me actually, it is /usr/local/cuda
I tried to reconfigure many times my tensorflow installation, I exported the LD_LIBRARY_PATH with the correct path to the folder containing the file libcudnn.so.6 but none of these solution worked.
My configuration :
tensorflow r1.4
Cuda 8.0
cuDNN 6.0
bazel 0.9.0

/usr/bin/ld: warning: libavcodec.so.53, needed by xxx not found

I am trying to compile a given source code with makefile, but the problem I am facing is the fact that it uses libavcodec.so.53. The version installed is 54, the libavutil and libavformat versions are also different from the Linux version. I can't change the version of them in Linux because I don't have root access. So I will use a local folder where opencv, libavutil.so, libavformat.so and libavcodec.so.53 are.
I put this folder name into the makefile.config as it follows:
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /home/me/lib
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/local /home/me/lib
But when I compile it I have the following errors:
/usr/bin/ld: warning: libavcodec.so.53, needed by
/home/anselmo/lib/lib/libopencv_highgui.so, not found (try using -
rpath or -rpath-link)
/usr/bin/ld: warning: libavformat.so.53, needed by
/home/me/lib/libopencv_highgui.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libavutil.so.51, needed by
/home/me/lib/libopencv_highgui.so, not found (try using -rpath or rpath-link)
/home/anselmo/lib/lib/libopencv_highgui.so: undefined reference to
`avcodec_flush_buffers#LIBAVCODEC_53'
/home/me/lib/libopencv_highgui.so: undefined reference to
`av_freep#LIBAVUTIL_51'
/home/me/lib/libopencv_highgui.so: undefined reference to
`av_read_frame#LIBAVFORMAT_53'
libavutil.so.51, libavformat.so.53 and libavcodec.so.53 are in /home/me/lib as indicated in the makefile. How to show linux how to use them instead of the ones installed in the machine? again, I cannot be root.

error in compiling using cmake utility

I am trying to compile my gcc code using the following make command .
OS :Redhat ,gcc - 4.1
But I am getting error as follows :
rmtrain#lintrni130 $ /usr/local/bin/make all
[ 21%] Built target GCVCore
Linking CXX executable CFE
/usr/bin/ld: warning: libicui18n.so.36, needed by ../../Generic/icu/lib/libicuio.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libxalanMsg.so.110, needed by ../../Generic/Xalan/lib/libxalan-c.so, not found (try using -rpath or -rpath-link)
CMakeFiles/CFE.dir/trnuser1/rmtrain/DevelopmentEnv/Generic/ConvUI/GCVConvUISetting.o: In function `xercesc_2_6::XMLAttDefList::~XMLAttDefList()':
GCVConvUISetting.cpp:(.text._ZN11xercesc_2_613XMLAttDefListD0Ev[xercesc_2_6::XMLAttDefList::~XMLAttDefList()]+0x2f): undefined reference to `xercesc_2_6::XMemory::operator delete(void*)'
Please Help with this .
The warnings means that some libraries you link to have dependencies on other shared libraries, and those libraries weren't found in the linker's search path. The linker manual describes how it forms that search path in the docs for the -rpath-link option
They're only warnings, so haven't caused your link to fail. It will be a problem if those required libs aren't found at run-time, but is not necessarily a problem at link-time.
If you want to silence the warnings you will need to find out which directory contains libicui18n.so.36 and libxalanMsg.so.110 and use one of the methods described in the manual to tell the linker to look in that directory.
The last line is the real problem, and indicates you are not linking to the library which defines that symbol. You'll need to find out which library it is and link to it with -lfoo, it will probably be something like -lxerces
i reinstalled icu 3.2 instead of 3.6.It worked fine then.