After installing a Library through conda, compiling a C++ script, won't see its headers files - c++

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?

Related

caffe: error with protobuf version

I've previously installed caffe and Fast-RCNN, so I should have all the required libraries and dependencies.
I need to install it again for another repository(https://github.com/ronghanghu/natural-language-object-retrieval) that uses Caffe.
When I run
make all
it gives me the following error:
CXX .build_release/src/caffe/proto/caffe.pb.cc
In file included from .build_release/src/caffe/proto/caffe.pb.cc:5:0:
.build_release/src/caffe/proto/caffe.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
#error This file was generated by a newer version of protoc which is
^
.build_release/src/caffe/proto/caffe.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
#error incompatible with your Protocol Buffer headers. Please update
^
.build_release/src/caffe/proto/caffe.pb.h:14:2: error: #error your headers.
#error your headers.
^
In file included from .build_release/src/caffe/proto/caffe.pb.cc:5:0:
.build_release/src/caffe/proto/caffe.pb.h:26:55: fatal error: google/protobuf/generated_enum_reflection.h: No such file or directory
#include <google/protobuf/generated_enum_reflection.h>
compilation terminated.
make: *** [.build_release/src/caffe/proto/caffe.pb.o] Error 1
I thought maybe protobuf has been updated, and tried
protoc --version
which returns
libprotoc 2.5.0
It seems like newer version of protobuf has been released (2.6 or up).
So my question would be:
1) Is there a simple way to update it?
2) If I do update it, will it affect caffe and fast-rcnn that I previously installed, which depends on the older version of protobuf?
I suspect your problem is that you have multiple versions of protobuf in your include path. It may be picking up the headers from the older version instead of the latest. I can confirm that latest caffe (git master as of right now) compiles cleanly against the libprotobuf-dev-2.5.0-9ubuntu1 which is in ubuntu 14.04LTS.
I guess before you get this problem, you have used protoc to generate caffe.pb.h`. If you did, my solution maybe be useful to you.
Firstly, you should know how many protoc installed in your OS.
For example, in my OS:
Prompt> whereis protoc
protoc: /usr/bin/protoc /home/xxx/.conda/envs/python27/bin/protoc/usr/share/man/man1/protoc.1.gz
So, there are 2 protoc in my OS. You can use which protoc and protoc --version in order to find which version protoc is used default. In my OS:
Prompt> which protoc
/home/xxx/.conda/envs/python27/bin/protoc
Prompt>protoc --version
libprotoc 3.5.1
Finally, use another protoc to create caffe.pb.h again.
let the dir to caffe/src/caffe/proto, and execute:
/usr/bin/protoc --cpp_out=. caffe.proto
I solved this on my computer and maybe it can help you. My environment is Ubuntu16.04, and I installed Anaconda(for python2.7) before I install Caffe. It happens that I used conda to install libprotobuf-dev, and this leads to conflict with the caffe's 'sudo apt-get install libprotobuf-dev' command, for 'apt-get' and conda installed different on my computer which can be find by 'locate protobuf', so I remove the Anaconda's version of libprotobuf, and no problem happens again.
conda uninstall libprotobuf
When you install tensorflow before install Caffe, this problem will also happen, because of the libprotobuf conflict.
I solve the problem by
conda uninstall libprotobuf
then remove the caffe folder and download a new one
git clone https://github.com/BVLC/caffe.git
then do
make all -j8

Missing function definitions with libcurl-devel on CentOS 6.6

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.

octave install Error: A BLAS library was detected but found incompatible with your Fortran 77 compiler settings

I'm trying to install octave 3.8.1 on a cluster running Redhat+IBM LSF. I don't have write access to any directory except my home dir. I have loaded three modules 1) pcre 8.33 2) blas 08/2013 3) lapack 3.5.0. But when I run ./configure, I got the error "configure: error: A BLAS library was detected but found incompatible with your Fortran 77 compiler settings.", as the image below shows.
I have tried loading module gfortran64 and add F77=gfortran as command line parameter, but this doesn't work. Could you please help me with this problem? If you need any information please tell me in this webpage. Thank you.
I've had the same problem. On a fresh install of CentOS 6.3 I was able to compile octave 4.0.0 successfully.
After installing the necessary dependencies (notably blas, lapack and pcre) I created symlinks to liblapack and libblas in some directory, e.g.:
mkdir /some/path
cd /some/path
ln -s /usr/lib64/libblas.so.3 libblas.so
ln -s /usr/lib64/liblapack.so.3 liblapack.so
Then put the relevant directory in LDFLAGS, e.g., in bash/sh:
LDFLAGS=-L/some/path ./configure
So either octave's configure didn't look in /usr/lib64, or it requires the name of the libraries to end in ".so" (not ".so.3"). I haven't investigated which of the two was the problem since the above worked for me.
/some/path can be deleted when octave has been installed.
My octave repository was compiling flawlessly, until the day I installed gfortran and started to get the same message. I had been using f77 (from the fort77 package). Somehow, the configure script defaulted to gfortran, which [I believe] is incompatible with the BLAS libraries.
I would suggest using f77 in octave compilation instead of gfortran.
I compiled octave 4.0.0 on Mint 17.1, but I believe the issue is the same.

Error: boost/scoped_ptr.hpp: No such file or directory while using libkml

I am developing a software which uses Google Map database. I searched google and I found a library in C++ can do that - libkml. I've downloaded some examples code in this website, but when I compiled with this command: g++ main.cpp -lkml, it occured an error:
fatal error: boost/scoped_ptr.hpp: No such file or directory
What is "boost/scoped_ptr.hpp"? I try finding this file in terminal
locate boost/scoped_ptr.hpp
but there's nothing.
You need to install the boost libraries from http://www.boost.org/
Depending on your OS there will be pre-built solutions that you can install. For example on Ubuntu you can do sudo apt-get install libboost-all-dev. On Mac see this thread Boost: MacOSX binaries for Boost
On Windows this may help: http://boost.teeks99.com/

Boost "no such file or directory"

I'm trying to set up my Code::Blocks work environment on a new computer and I'm having some problems. It's been a long time since I first did this, and now when I open my major project Boost is causing me problems.
I'm fairly new to C++ still and fixing this type of problem is something I have limited experience with.
When I open my project and try to compile it, I get this error:
fatal error: boost/algorithm/string.hpp: No such file or directory|
At this part of one of my header files:
#include <boost/algorithm/string.hpp>
I placed the Boost v1.51.0 library at C:\boost since that is where I'd had it on my other computer. My project is set to search that directory for additional includes but it doesn't seem to be finding the files?
My project used an older version of Boost previously but I doubt that's an issue.
I'm not sure how difficult it is to debug this problem with this limited information so if there's anything else I can provide please let me know.
I'm using Code::Blocks, and have just set up minGW and Visual C++ 2010.
In Ubuntu use
sudo apt-get install libboost-dev
Ensure that you have installed boost-devel package
In Centos execute as root:
yum install boost-devel
then
root#centos6 /]# find / -name boost
/usr/include/boost
/usr/lib64/boost
[root#centos6 /]#