How to repair boost installation? - c++

I have removed all header files within the below path due to numerous errors i was seeing
/usr/include/boost
The following is my install procedure...
cd boost_1_49_0
./bootstrap.sh --prefix=$SRC_HEAD/third-party/build/boost_1_49_0
./b2 install
After a successful install i still do not see any include files within:
/usr/include/boost!
Can someone please advise, many thanks

Well, as this suggests
./bootstrap.sh --prefix=$SRC_HEAD/third-party/build/boost_1_49_0
it will install into $SRC_HEAD/third-party/build/boost_1_49_0, which is not /usr/include/boost obviously.
BUT I'm not suggesting you do this manually. Which distribution are you using? You should use the package manager, which comes with it to perform this task (reinstalling boost).

Related

How to build boost with correct paths

I tried to build boost in a separate path on my Ubuntu 18 Linux system. I cloned the GIT repository since I want to have the latest version available (the package repositories provide an old version only). The library I want to use is boost::timer.
This is what I did:
git clone --recursive https://github.com/boostorg/boost.git
cd boost
./bootstrap.sh
./b2 headers
./b2
This kind of worked. However I expected the static library to be located in a different path. It was compiled into this path:
.../boost/bin.v2/libs/timer/build/gcc-9/release/link-static/threading-multi/visibility-hidden/libboost_timer.a
This path is very verbos and it contains the compiler and its version which means I would need to update the paths when updating GCC or changing the compiler.
I would have expected it here:
.../boost/libs/timer/libboost_timer.a
Did I do something wrong? Is the placement expected that way?
Ok, when reading the build output carefully even a fool like me could notice that the actual path is boost/stage/lib. All built libs can be found there.

Linking problem to libraries installed with Homebrew since Mojave update

I have recently updated to Mojave and since then am experiencing linking problems to libraries (gsl, Cuba etc.) that I had installed with Homebrew.
When compiling my code, gcc (tried g++-6 and g++-8, also installed with brew) does not seem to search the directories where brew stores the header files for those libraries. The code compiled when I manually set the paths to
GSL_INCLUDE_PATH=/usr/local/include/gsl/
GSL_LIB_PATH=/usr/local/lib/
CUBA_PATH=/usr/local/include/
But since I am using this in all my make-files I do not want to do this every time...
Before I was using Sierra and I have included in my .bash_profile the following:
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
This seemed to do the trick before. But now /usr/local/sbin did not exist anymore. I ran brew doctor which suggested:
You should create these directories and change their ownership to your account.
sudo mkdir -p /usr/local/Frameworks /usr/local/sbin
sudo chown -R $(whoami) /usr/local/Frameworks /usr/local/sbin
I did just that and reinstalled the libraries but it did not sort out the issue.
I have tried to include
export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/include:/usr/local/lib:$PATH
in the bash-profile, but that did not help either. (Maybe I did it wrong, I am not familiar with setting paths) At this point I am not sure whether brew installs the libraries in a weird place or if gcc just does not look in the correct location.
I have installed Xcode and the command tools. I have tried everything I found (and could understand) that I found as solutions for related problems.
I would like for gcc to look in the directories that brew installs the libraries to by default.
I would be really grateful for a suggestion of a clean fix for this issue.
Please excuse the long essay; if you need additional information please do tell, this ist my first time asking for help here.

C++ program requiring libsnappy

I am trying to make and build a C++ program (available here https://github.com/mortehu/text-classifier) which requires libsnappy and Capn Proto. I believe I am having an issue with libsnappy as after running the following commands:
configure
make -L/Users/liamflynn/Desktop/Kaggle/Truly_Native/Mortehu/text-classifier-master/tools/text-classifier/capnproto-c++-0.5.3/src
sudo make install
I get the error "base/columnfile.cc:7:10: fatal error: 'snappy.h' file not found"
I have tried linking various folders related to libsnappy in the make stage to no avail. I have also tried to install snappy in a few different ways, such as:
brew install snappy
and
sudo gem install libsnappy
But Im not exactly sure where the library is getting saved too. Ideally, I would be able to find the folder containing 'snappy.h' and I would be able to link this in the make stage. Any help with where I am going wrong would be much appreciated, thank you.
The headers are read by the preprocessor. You can add preprocessor command line flags by changing the CPPFLAGS variable. Use the LDFLAGS variable for linker flags:
./configure CPPFLAGS="-I/path/to/header/" LDFLAGS="-L/path/to/library/"
Since you tagged homebrew I'm assuming that you're on MacOS and have brew installed. With this you can run the following command to install the libsnappy library:
$ brew install snappy

redhat6: how to uninstall package when it's installed from source

I installed a package from its source files by using "make install", if I want to remove the package, how should I do? I looked into Makefile, but not many options.
Thanks in advance
Yang
Usually when you use make install, there is no good way to uninstall. This is why it's often advisable to use the --prefix option to the configure script to specify a special directory for each application that's installed in this way.
Another good option is to make the extra effort to pack up an RPM, then you can use rpm to install and uninstall. But it's too late for you to do this after you've already done the install.
So, I think you will be left to try to find the files that were installed and remove them individually. Hopefully the makefile installed to /usr/local instead of /usr.
You might try searching by time range, that way you might be able to find all the files that were installed at the same time.

why can't I to install boost in /usr/include?

I'm trying to install boost into include directory for avoid -I flag use in each g++ compiler call,I installed using this command line: ./bjam --prefix=/usr/include install
see --prefix value, it install in /home/myusername, why?
Thanks in advance.
You would need root permissions to install in /usr/include.
Actually your system has done you a favor by not letting you do that. The --prefix option says where to install everything -- headers, libraries, executables, documentation, etc. For example, the header files would be installed in /usr/include/include, which is not going to be in your compiler's search path.
Disclaimer:: This assume that ./bjam --prefix=... behaves similarly to ./configure --prefix=.... I haven't actually used bjam. If bjam's --prefix option means something else, please correct me.
Depending on your system, you may be able to install Boost from a repository rather than building it from source. For Debian or Ubuntu, for example, something like sudo apt-get install libboost might work.
Note that I said something like that; it appears that Boost consists of a number of packages; apt-cache search boost, or better yet, do a Google search to see how to install Boost on your particular system.
Try running
sudo ./bjam
Doing this should run bjam with appropriate privileges to install to /usr/local/include and /usr/local/lib, both of which should be in your search path...