I am having trouble compiling my program which uses libcurl.
The environment I am using is CentOS 6.6 on a VM, and I am getting errors which suggests that the library has either:
not installed correctly or
cannot be found.
I did a
sudo yum install libcurl followed by a
sudo yum install libcurl-devel followed by a
sudo yum update
It seems that the curl.h has been put under /usr/include/curl which seems correct so I am unsure as to why this has occurred.
It is worth noting that a test program with #include <curl/curl.h> is compiling.
Also, when libcurl-devel is not installed (and only libcurl is),
gcc complained it couldn't find curl.h, as expected,
there was also no curl directory under /usr/include/, as expected,
however libcurl did install a curl file under /usr/bin/, as expected.
In Ubuntu I only had to install libcurl-openssl
Some example gcc errors:
$gcc new.c -lcurl
new.c: In function ‘main’:
new.c:74: error: ‘CURLOPT_MAIL_FROM’ undeclared (first use in this function)
new.c:74: error: (Each undeclared identifier is reported only once
new.c:74: error: for each function it appears in.)
new.c:81: error: ‘CURLOPT_MAIL_RCPT’ undeclared (first use in this function)
If you are installing libcurl-devel from the CentOS RPM then it absolutely should not be putting the header, or anything else, in /usr/local/curl. /usr/local is for locally-built components, not for components provided by the OS. Exactly what that means can be a subject for debate, but I can confirm that the CentOS 6 RPM for libcurl-devel installs the headers in /usr/include/curl.
With that being the case, if CentOS's libcurl-devel is installed, then you shouldn't need any special compiler flags to get the compiler to resolve
#include <curl/curl.h>
correctly, but if you happen to have a different curl.h somewhere on your system then you could cause it to be chosen instead. Still, although I could maybe believe the compiler finding /usr/local/include/curl/curl.h automatically (that is, without -I/usr/local/include), I would be very surprised to hear that it finds /usr/local/curl/curl.h automatically.
But that probably isn't your problem. CentOS 6 provides version 7.19 of libcurl. That version does not provide the macros you are trying to use, at least not in libcurl-devel. I have checked for a possible add-on package corresponding to Ubuntu's libcurl-openssl, but there is no CentOS 6 package (or EPEL/el6 package) that has both "curl" and "ssl" in its name.
If you can identify what minimum version of libcurl you need, you can probably build it yourself. In such cases I prefer to take a source RPM from Fedora's Koji system, build RPMs from it on the local system, and install them (possibly updating existing RPMs in the process). Alternatively, you can probably build and use a private copy, but in that case you will want to link it statically into your program.
Related
I am attempting to use libusb for a project and my C++ is rusty. I think I've resolved the dependencies for libtool and libdev on my ubuntu box, but now when I run, I get the following error.
/usr/lib/gcc/x86_64-linux-gnu/10/include/stdatomic.h:40:9: error: ‘_Atomic’ does not name a type
I found How to include C11 headers when compiling C++ with GCC?, but not sure how this helps me.
The problem appears to be in gcc somehow, but not sure how to go about fixing it. I'm using C++ 20 in CLion.
I'm running on Ubuntu and I had tried
sudo apt install libusb
to no avail. On a hunch I tried
sudo apt install libusb-dev
And it worked, so now I don't need to build it.
I need to remember to search for the library name if it isn't obvious.
I have already compiled a Script on my Desktop Computer, but now I have to compile it on a Server where I don't have root access.
So I chose to install Anaconda and work with Conda environments.
So, I'm installing a GCC 9.3 Compiler, among with a GXX 9.3 Compiler because I need the execution policies from C17++.
I also installed GSL library through conda install gsl and indeed, on conda list it appears to be:
gsl 2.4 h14c3975_4
so, I decided to compile the script via : x86_64-conda_cos6-linux-gnu-cpp SCRIPT_NAME -o _OUTNAME_ -lgsl since this is the way Anaconda says to call it's compilers (said so on build log)
but I get this error:
mpi_final.cpp:1:10: fatal error: gsl/gsl_math.h: No such file or directory
1 | #include <gsl/gsl_math.h>
| ^~~~~~~~~~~~~~~~
compilation terminated
I have managed to include GSL but ONLY when I install it manually. and then I have problem with other libraries, so I decided to fix anaconda environments. But I dont know how to proceed.
Any Idea on where to look?
I have a c++ code that is written and compile on my PC and executed on a remote server.
I changed recently my pc ans so set up everything uptodate on it. But now execution of my code on the unchanged server failed with this error:
./ReactionThermo: relocation error: ./ReactionThermo: symbol _ZTINSt8ios_base7failureB5cxx11E, version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference
I look a bit on the web and it appears to be gcc fault. And indeed it's on my pc 5.4 and 4.8 on my server. I tried to upgrade it but got following error:
sudo apt-get install gcc-4.9
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
gcc-4.9 : Depends: cpp-4.9 (= 4.9.4-2ubuntu1~14.04.1) but it is not going to be installed
Depends: libgcc-4.9-dev (= 4.9.4-2ubuntu1~14.04.1) but it is not going to be installed
munge : Depends: libmunge2 (= 0.5.11-1ubuntu1) but 0.5.11-1ubuntu1.1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
I tried the apt-get -f install comand but it's not improving thinks.
Any ideas.
Thanks
PS: I knoz it's look like GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference but I don't want tu downgrade cpp, rather to upgrade it
In general, you need to build C/C++ binaries on the oldest operating system version you want to support, using the system compiler (or other vendor-supported compilers such as the Toolchain Module for SUSE Linux Enterprise Server or Developer Toolset for Red Hat Enterprise Linux). You cannot compile your program on a newer system and copy it to a different environment with an older (or different) operating system release. In simple cases, it might work, but in other cases, you will get dynamic linker failures at run time (like you did), or even silent data corruption.
Furthermore, you should look at build tools such as pbuilder and mock to automate building your software in a well-defined build environment.
I am new to x64_86, but forced to use it because RedHat dropped its 32-bit OS support in RHEL 7.x. I have to complile a lot of code, and am not ready to jump to x64 yet (because I do not need 64-bit addresses and do not want to face all related porting issues). So I have considered using -m32 and -mx32, and decided that -mx32 is the best route for me. However, while -m32 works fine on my build machine, when I use -mx32, I get this error:
In file included from /usr/include/features.h:399:0,
from /usr/include/string.h:25,
from zz.cpp:1:
/usr/include/gnu/stubs.h:13:28: fatal error: gnu/stubs-x32.h: No such file or directory
# include <gnu/stubs-x32.h>
^
compilation terminated.
I searched the web for solutions and some links indicate that I have to install some mysterious "multilib" rpms for g++ and gcc, however, I cannot find these anywhere. Others suggest that I have to install Linux in the x32 mode and build libgcc for x32, which sound extreme. Any ideas or leads? Did someone actually try g++ -mx32? Maybe it is not even supported on the RH platform... Thanks!
P.S. In order to get the "-m32" option to work I had to install:
yum install glibc-devel.i686 libgcc.i686 libstdc++-devel.i686 ncurses-devel.i686
This one fails (yum cannot find these RPMs) - allegedly these are required for -mx32 to work:
yum install gcc-multilib g++-multilib
:(
Multilib is indeed your answer, but do not know why your repo does not support it. I installed mine via apt-get:
sudo apt-get install gcc-multilib
Although it uses 64-bit instructions, it uses the 32-bit ABI so annoyingly will not run under WSL (Windows Linux subsystem), which only supports the 64-bit one.
I'm trying to build OPAM within Cygwin in Windows 8. Here is the error information during the configure stage:
configure: error: You must install the Camlp4 pre-processor. On some
operating systems, these are separate packages from the main OCaml
compiler, such as camlp4-extra on Debian.
I've searched cygwin repository using keywords "caml" and installed all the packages provided; however, the configuration still shows this error message. How can I install this Camlp4 pre-processor?
As long as OPAM doesn't work on windows, you can try GODI (windows port). It has basic windows support and you can install the most common packages through it.
I don't think OPAM works with windows quite yet. I've installed it on OSX and Linux and love it. On windows, though, there is a compilation error with unix_waitpid. This is because ocp-build/ocp-build.boot is a binary packaged with the OPAM source that requires the unix_waitpid instead of the win_waitpid function. I'm not exactly sure why they did this. But, after that their could be other issues.
Regarding the camlp4, running setup.exe of cygwin, I was easily able to find ocaml-camlp4 under interpreters. Depending on the tool-chain, I found it easy enough to just use the mingw binaries found through the ocaml website.