How to invoke clang to use current OS GLIBC? - c++

I am building an application in which the application is using GN and ninja to build files. The application is currently building on Ubuntu 20.04 and I am using clang to compile files. But the issue is when I try to build and execute the executable in Ubuntu 18.04, it is giving me this error:-
./application: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /path/to/lib.so)
So, this basically means that clang is not able to build the files according to the current OS. Is there any flag I need to use to make it work with the current OS? or is there any other to overcome this issue?

Related

opencv2/opencv.hpp: No such file or directory using Eclipse IDE

I'm trying to test OpenCV (3.0.0) with Eclipse IDE (Version: Mars Release (4.5.0)) but for some reason I fail to successfully include all the library path.
Can you tell me how is it possible that the include directory is in the project explorer with the file *opencv.hpp* in it but still fails to find it during the build process? And how can I fix it?
I'm not sure what operating system you are using or how you installed OpenCV but I faced the same problem when installing OpenCV 3.1.0 on Ubuntu 15.10. I was following these instructions.
It turns out that after I ran make I forgot to run make install to actually install the compiled libraries.
I'm not sure if this problem has anything to do with Eclipse.

Wrong GLIBCXX version when running a program that was compiled on the same machine

How is it possible that a program that I compile, link and run on the same machine to have GLIBCXX version errors when I try to run it? Does anyone know?
Here is the error I am getting:
0.01s$ build/test/gamgee_test
build/test/gamgee_test: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by build/test/gamgee_test)
build/test/gamgee_test: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by build/test/gamgee_test)
full output (with VERBOSE=1) including building and running is here:
https://travis-ci.org/broadinstitute/gamgee/jobs/39751787
This wasn't happening before, only after I switched to cmake. Also the same code runs fine with Clang (using a bundled version of libstdc++ since I haven't installed libc++ on the VM). That log is here: https://travis-ci.org/broadinstitute/gamgee/jobs/39751786
very puzzled.
Runtime paths are different to compile paths. Sounds like you have more than one version of your libraries on your system. check your LD_LIBRARY_PATH env variable and call your executable with ldd to see what libraries it is using/trying to use.

Qt 5.1.1 compiler setup on Ubuntu

First of all, I should point out that I've never used linux before.
I have a clean install of 64bit ubuntu, I downloaded Qt 5.1.1 for linux 64 bit from http://qt-project.org/downloads, ran the .run file, installed it and gcc which is included in that download, opened Qt Creator, made a new project and tried to compile it. It wont compile and I keep getting this error message
:-1: error: Qt Creator needs a compiler set up to build. Configure a compiler in the kit options.
I added a gcc compiler, but what do I need to put for the compiler path, platform codegen flags, platform linker flags and ABI?
You don't have to input the path of your compiler because gcc and g++ paths are available in the $PATH enovironment variable. So just use "gcc" and "g++" and that should work. Just make sure you restart Qt Creator after the installation of g++.
One more thing. You need a compiled version of Qt installed on your computer. So also install Qt libraries with
sudo apt-get install qt4-dev-tools
If you want to use the new version of the library you have to add it to $PATH. You can do this in the terminal with
export PATH=/path/to/Qt/qtbase:$PATH
And then run Qt Creator from the same terminal, in which you did the last command.
Good luck!
You will have to install the dependencies as well. I got it working when I followed the steps in the following link.
Try this:
http://wiki.qt.io/Building_Qt_5_from_Git

strlen runtime error on Ubuntu

I develop a CGI C++ application that I compiled under Debian. Running this app on an Ubuntu system I am getting the error:
relocation error: /lib32/libresolv.so.2: symbol strlen, version GLIBC_2.0 not defined in file libc.so.6 with link time reference
What can I do now? Should I recomile on the Ubunto system? Can I replace a library?
Edit
I link my application with -static.
Running the command ldd --version on the Ubuntu system showed my that EGLIB is used there.
What this error means is that your program was compiled/linked against an older version of GNU libc, which is not supported on the system where you want to run your executable.
You have few options to solve it:
Make sure you use the same or compatible version of libc when compiling and running.
Link against a static runtime.
Install older version of libc on Ubuntu system to match the Debian's environment.

Building zlib libz.a for 32 bit

I am trying to compile a 32-bit version (MinGW) of a program I wrote using zlib. Until now, I've never has to compile for 32-bit so the version of zlib I compiled from source (libz.a) is 64-bit. I tried to rerun the makefile in the zlib-1.2.5 directory but it only compiles a 64bit version of libz.a.
I can't seem to find an option to build 32-bit.
Does anyone know how to do this?
Thanks!
Jeffrey Kevin Pry
Checking the configure file, you can see some env.
On 64bit debian, following command line will build the 32bit version of libz
CFLAGS=-m32 ./configure
It turns out I had to get the 32bit version of MinGW and compile it with that. I was using MinGW64.
Using CFLAGS=-32 won't do it for me, configure script still shouts out telling me to use win32/Makefile.gcc instead all the time.
The recent version of zlib is 1.2.11, so it should be minimal gap of difference up until today. Without any context on system, the following might be useful for other users facing this similar problem these days.
I cross compile on Linux (Ubuntu 18.04), and target 32-bit version of zlib to be produced. What I did is as follows.
./configure (this is just to let us have required file to building process, we will be using different Makefile though)
Modify win32/Makefile.gcc for its PREFIX=i686-w64-mingw32- (for 64-bit you change it to PREFIX=x86_64-w64-mingw32-.
make -fwin32/Makefile.gcc
Install to your desire location via make install -fwin32/Makefile.gcc SHARED_MODE=1 INCLUDE_PATH=/tmp/zlib-win32/include LIBRARY_PATH=/tmp/zlib-win32/lib BINARY_PATH=/tmp/zlib-win32/bin. Notice that you need to specify INCLUDE_PATH, LIBRARY_PATH, and BINARY_PATH. BINARY_PATH will contains result .dll file.