How to uninstall libc++ after installing from source? - linux

I installed libc++ from source using following script. The make uninstall is not supported. What would be the best way to uninstall it?
git clone --depth=1 https://github.com/llvm-mirror/llvm.git llvm-source
git clone --depth=1 https://github.com/llvm-mirror/libcxx.git llvm-source/projects/libcxx
git clone --depth=1 https://github.com/llvm-mirror/libcxxabi.git llvm-source/projects/libcxxabi
export C_COMPILER=clang
export COMPILER=clang++
# Build and install libc++
mkdir llvm-build && cd llvm-build
cmake -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} \
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr \
../llvm-source
make cxx
sudo make install-cxxabi install-cxx

Well, after lot of searching, it is clear that there is no automatic or even semi-automatic way to uninstall when make unintsall is not implemented. There are two ways to get around this:
If using cmake then run the install again but set the flag like -DCMAKE_INSTALL_PREFIX=./output. This will cause cmake to put all files in ./output. Now you can observe the files, and manually delete them. I think by default cmake would put these files at /usr/local.
Another cool trick you can use if install_manifest.txt file is generated: cat install_manifest.txt | xargs echo sudo rm | sh.

Related

LFS CoreUtils-8.30 fails with aclocal-1.15 missing

I have a standard core i5 laptop and I'm trying to make LFS (Linux From Scratch) it has all worked fine (after a couple of retries) until I try and make Coreutils-8.30 when I do the Make I get:
lfs#robert-HP-EliteBook-8760w:/mnt/lfs/sources/coreutils-8.30$ make
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /mnt/lfs/sources/coreutils-8.30/build-aux/missing aclocal-1.15 -I m4
/mnt/lfs/sources/coreutils-8.30/build-aux/missing: line 81: aclocal-1.15: command not found
WARNING: 'aclocal-1.15' is missing on your system.
You should only need it if you modified 'acinclude.m4' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'aclocal' program is part of the GNU Automake package:
<http://www.gnu.org/software/automake>
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
<http://www.gnu.org/software/autoconf>
<http://www.gnu.org/software/m4/>
<http://www.perl.org/>
Makefile:6034: recipe for target 'aclocal.m4' failed
make: *** [aclocal.m4] Error 127
I've gone around and around on this and I'm not getting anywhere. I've found a couple of references to gettext but that hasn't helped.
Thanks for any guidance.
Just got through the same issue. You need to install libtool-bin, automake and makeinfo
sudo apt-get install libtool-bin automake makeinfo
Then run autoreconf -f -i in the mpfr directory. After that you can run ./configure etc.
I ran into this issue when I applied the patch for coreutils that was provided in the downloads. I noticed the instructions did not tell me to apply this patch at this step so I tried to build again without the patch applied and it worked.
I just met and solved this problem,My solution is not necessarily the best。
This questions because you don't have "aclocal" tools with version 1.15,
This tools provided by automake-1.15, which depended by autoconf-2.69 or later.
So My solution is installing autoconf-2.69 and automake-1.15:
1. installing autoconf-2.69
tar -xvf autoconf-2.69.tar.xz
./configure --prefix=/tools
make && make install
2. installing automake-1.15
tar -xvf automake-1.15.tar.xz
./configure --prefix=/tools
make && make install
then you can compile your coreutils-8.30
Check if autoinfo from gettext is installed OK.
This error when building coreutils is caused by absence of autopoint.

How do I install Cppcheck using the tar file on Linux?

I'm trying to install Cppcheck via telnet on a Linux box. I have the cppcheck-1.67.tar file and I untar it. I don't see anything that will install it for me. Am I approaching this the correct way?
Actual on a date publication of this answer.
Download file from there https://sourceforge.net/projects/cppcheck/
Go to the folder with for downloads
cd ~/Downloads/
Unpack archive
tar -xvf cppcheck-1.76.1.tar.bz2
Go to unpacked folder
cd cppcheck-1.76.1/
Install package as root
sudo make install
Check up result
$ which cppcheck
/usr/bin/cppcheck
Testing it
$ touch simple.c
$ echo "int main(){ int a; a + 1; return 0}" > simple.c
$ cppcheck simple.c
Checking simple.c ...
[simple.c:1]: (error) Uninitialized variable: a
This package also exists in a standard repository.
$ aptitude search cppcheck
p cppcheck - tool for static C/C++ code analysis
Testing environment
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.6 (jessie)
Release: 8.6
Codename: jessie
$ uname -a
Linux localhost 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux
The instructions are in the readme.txt file. The short answer is make install.
Remember never to install things from a tar file when you can use your distribution's package manager.
The readme.txt file makes no mention of "make install".
It looks like the supplied Makefile is borked:
It passes "CFG=" param to compile, without DESTDIR
But "make install" prepends DESTDIR to CFGDIR
In my case, I edited Makefile to remove DESTDIR from make install, and cppcheck is happy with that.
For me the magic lines turned out to be the following in Docker on Ubuntu 18.04 (Bionic Beaver):
RUN cd /tmp \
&& git clone https://github.com/danmar/cppcheck.git \
&& cd cppcheck \
&& git checkout 1.72 \
&& make SRCDIR=build CFGDIR=/usr/bin/cfg HAVE_RULES=yes install \
&& cd /tmp \
&& rm -rf /tmp/cppcheck \
&& ldconfig
I assume the following will work for any version. I am not sure where it makes sense to install the configuration to. This works for me:
make SRCDIR=build CFGDIR=/usr/bin/cfg HAVE_RULES=yes install
If you want a later version than in the other answers, and you want to install it, then you can use the bash script below which is up to date and builds on the other answers. It should also clean itself up afterwards. It works for version 2.7 on debian/ubuntu but you can change the git checkout tag and try your luck on newer versions.
installcppcheck.sh
#!/usr/bin/env bash
set -e
cd /tmp
git clone https://github.com/danmar/cppcheck.git
cd cppcheck
git checkout 2.7
make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" install
cd /tmp
rm -rf /tmp/cppcheck
ldconfig
cppcheck --version
If you don't have sudo privileges you can follow #Seti Volkylany's answer, replacing step 5 with
OUT_PATH=/home/user/bin # target location of binary
make SRCDIR=build CFGDIR=~/Downloads/cppcheck-1.76.1/cfg PREFIX=$OUT_PATH
make install CFGDIR=$OUT_PATH/cppcheck-1.76.1/cfg PREFIX=$OUT_PATH

unable to install git from source code

I am new to using git. So i first install git from terminal using apt-get but then i remove it as in ubuntu the version is very old.
After this i install git from source code which i download from https://code.google.com/p/git-core/downloads/list. Then these are the commands used by me
sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential
tar -zxf git-1.9.0.tar.gz
cd git-1.9.0/
make prefix=/usr/local all
sudo make prefix=/usr/local install
Then when i put these commands it is behaving in this manner.
~/git-1.9.0$ which git
/usr/local/bin/git
~/git-1.9.0$ git --version
bash: /usr/bin/git: No such file or directory
Your shell remembers where it found the executable file for commands you run, to save itself the trouble (and you the delays) of hunting them down repeatedly. which isn't a bash builtin, so it doesn't know about that. When you've installed new code it's rarely a bad idea to
$ hash -r # reset the command-lookup hashtable
or if you've got just one particular command in mind,
$ hash -dcommand# forget wherecommandcame from
You might need to add /usr/local/bin/ to your $PATH, perhaps in ~/.bashrc; you might want to put it before /usr/bin/ there.
And you could simply type the entire path of the binary, e.g.
/usr/local/bin/git --version
or
/usr/local/bin/git status
You might try to use strace to understand what is going on.
Did you read git INSTALL file? You probably want to go the autoconf way (e.g. make configure first, then configure with appropriate arguments....) and you surely need to give relevant arguments at configure time, in particular --exec-prefix= and/or --libexecdir= ....

Install TCL/TK without root

I'm trying to install TCL/TK as a regular user on RedHat 5:
TCL_VERSION=8.6.1
BASE_PATH=/myownpath
tar -xzf tcl${TCL_VERSION}-src.tar.gz
cd tcl${TCL_VERSION}/unix
./configure \
--prefix=${BASE_PATH} \
--without-tzdata \
--enable-64bit
make -j9
sed -e "s#^\(TCL_SRC_DIR='\).*#\1${BASE_PATH}'#" \
-e "/TCL_B/s#='\(-L\)\?.*unix#='\1${BASE_PATH}/lib#" \
-i tclConfig.sh
make install
make install-private-headers
chmod -v 755 ${BASE_PATH}/lib/libtcl*.so
So far so good: ${BASE_PATH}/include/tcl.h exists and ${BASE_PATH}/lib/tclConfig.sh looks fine:
# String to pass to the compiler so that an extension can
# find installed Tcl headers.
TCL_INCLUDE_SPEC='-I/myownpath/include'
Then I try installing TK:
tar -xzf tk${TCL_VERSION}-src.tar.gz
cd tk${TCL_VERSION}/unix
./configure \
--prefix=${BASE_PATH} \
--enable-64bit \
--with-tcl=${BASE_PATH}/lib \
make -j9
sed -e "s#^\(TK_SRC_DIR='\).*#\1${BASE_PATH}'#" \
-e "/TK_B/s#='\(-L\)\?.*unix#='\1${BASE_PATH}/lib#" \
-i tkConfig.sh
make install
make install-private-headers
chmod -v 755 ${BASE_PATH}/lib/libtk*.so
It fails at make with the following message:
tk8.6.1/unix/../generic/tk.h:19:17: error: tcl.h: No such file or directory
What did I miss?!?
I followed below steps to install tcl, tk on Linux(Ubuntu).
please use sudo to avoid any permission related issue
Create directory of your choice say /opt/tcltk
install tcl
Create dir /opt/tcltk
Download tcl8.6.9-src.tar.gz, tk8.6.9.1-src.tar.gz from (http://www.tcl.tk/software/tcltk/download.html)
Move above these two tar files in opt/tcltk/
cd /opt/tcltk/ to install tcl8.6.9
/opt/tcltk> sudo gunzip -c tcl8.6.9-src.tar.gz | tar -xf -
cd /opt/tcltk/tcl8.6.9/unix/
/opt/tcltk/tcl8.6.9/unix> sudo ./configure --prefix=/opt/tcltk
/opt/tcltk/tcl8.6.9/unix> sudo make
Optional you can check make by executing “sudo make test”
/opt/tcltk/tcl8.6.9/unix> sudo make install
verify installation by executing "/opt/tcltk/bin/tclsh8.6" on cli
Install tk
cd /opt/tcltk/ to Extract tk tar
/opt/tcltk/>sudo gunzip -c tk8.6.9.1-src.tar.gz | tar -xf -
/opt/tcltk/tk8.6.9/unix>sudo ./configure --prefix=/opt/tcltk
/opt/degrib/tcltk/tk8.6.9/unix>sudo make
sudo make install
Please fell free to comments if there is any issue while installation
If you're wanting to install Tcl as a normal user, it's easy to do so starting with the source distribution (you'll need to pick the version you want; I recommend 8.6.1 in general right now, but that's a recommendation that's bound to change over time).
Then, change to the unix directory inside the unpacked source distribution and run ./configure; IMPORTANT: to install as non-root you must specify the --prefix option to configure to say where it is going to be installed, and you have to specify it as a full path. For example, if I was to install it beneath my home directory, I'd use:
./configure --prefix=/home/dkf
Then, just do make and make install. Or combine into one as make all install; if you're not installing as a different user, you can do it as one step. After this, I'll find I can run Tcl 8.6.1 by doing /home/dkf/bin/tclsh8.6 and the binary library and tclConfig.sh will be in /home/dkf/lib; adjust in the obvious way for the path you specify. If you do not specify the --prefix, the source distribution uses /usr/local as a default, but that's a directory which is only normally writable by the root user.
The reason you have to specify the path like this is that the path to Tcl's support scripts is baked into the binary library. (It's runtime overridable, but I don't recommend doing that when you can easily just get things right to start out with.)
When building Tk, you need a sibling Tcl build. Currently, you're recommended to have them be the same version too. You should also specify --with-tcl= and give the path to the tclConfig.sh that you just installed; while it might work without, it's easiest to just do it this way. Once you've built and installed Tcl and Tk, you (probably) don't need to keep the source trees around.
OK, I admit that I do keep them around, but I'm a data packrat…

Installing Git with non-root user account

I've already set up a Git repository on GitHub and committed a few changes from my Windows machine.
But tomorrow I'll have to work in this repository from a machine running Ubuntu with limited privilege (i.e. no sudo).
Is there a portable version of Git for Linux? Or some source that allows me to compile and install Git only for the current user?
You can download the git source and do ./configure --prefix=/home/user/myroot && make && make install to install git to your home directory provided you have the build tools. If you don't have the build-essential package installed (dpkg --list|grep build-essential), you will need to install those to your home directory as well.
I don't like link-only answers, but this link I followed step-by-step on a Fedora machine and it worked without modification. Very, very easy. The binaries end up in your ~/bin directory. You download a tarball, extract the sources, run make and run make install and that is it.
As the author states, the 2 prerequisites are gcc and ssh and if you meet these git should work for you as a non-root user.
To install git and dependencies from source the following maybe useful.
Replace with the location you are installing your non-root apps and consider checking for latest versions of source code.
wget https://curl.haxx.se/download/curl-7.47.1.tar.gz
tar -xf curl-7.47.1.tar.gz
mkdir <local_curl_dir>
cd curl-7.47.1
./configure --prefix=<local_curl_dir>
make
make install
wget http://downloads.sourceforge.net/expat/expat-2.1.0.tar.gz
tar -xf expat-2.1.0.tar.gz
mkdir <local_expat_dir>
cd expat-2.1.0
./configure --prefix=<local_expat_dir>
make
make install
wget https://github.com/git/git/archive/v2.6.4.tar.gz
tar -xf v2.6.4
mkdir <local_git_dir>
cd git-2.6.4
make configure
./configure --prefix=<local_git_dir>/git --with-curl=<local_curl_dir>/curl --with-expat=<local_expat_dir>/expat
make
make install
This is what I ended up doing, the main trick being the make flags:
wget -O git.tar.gz https://github.com/git/git/archive/v2.17.0.tar.gz
tar zxf git.tar.gz
mv git-2.17.0 git
cd git
make configure
./configure --prefix=`pwd` --with-curl --with-expat
# ./configure --prefix=`pwd`
# Make flags from https://public-inbox.org/git/CAP8UFD2gKTourXUdB_9_FZ3AEECTDc1Fx1NFKzeaTZDWHC3jxA#mail.gmail.com/
make NO_GETTEXT=Nope NO_TCLTK=Nope
make install NO_GETTEXT=Nope NO_TCLTK=Nope
Credits:
79E09796's answer above was a good tip, but didn't work for my case on Cloudways and did not require compiling curl and expat.
A random email record I found on the internet: https://public-inbox.org/git/CAP8UFD2gKTourXUdB_9_FZ3AEECTDc1Fx1NFKzeaTZDWHC3jxA#mail.gmail.com/
A related answer is https://askubuntu.com/a/350.
I could get it work with the third method proposed:
apt-get source git
cd git_vXXX
./configure --prefix=$HOME
make
make install
I don't know why, but when I had tried to install from the source download from github instead, I had a lot of problems with missing dependencies
Overkill workaround
Install Anaconda as a user and install git with conda.
Advantages
Anaconda can be installed as user, and a conda environment can be created which can help you to install other packages. This way you don't need to compile git from source, nor you need to install libcurl and perl, so you won't get the error
git: 'remote-https' is not a git command. See 'git --help'
after successfully compiling git.
Steps to install Anaconda, then git
read the Anaconda installation manual which points to the download page's shell script file.
Download the script file:
copy to your local machine and then copy with scp (e.g. winscp) to the Linux machine or
use a terminal on the Linux machine and issue wget https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh.
add executable rights to yourself on the file by issuing chmod +x Anaconda3-2020.11-Linux-x86_64.sh
follow the installation instructions where you can also specify into which folder you want to install anaconda
after installation, chose one of the possibilities below to successfully invoke git later:
you either activate a conda environment, which is useful e.g. if you need to create different conda environments (it is common if you work with python). To activate an environment, you need to ask the installer (at the end of the installation) to add the conda initialization code into your ~/.bashrc file [see below]. Using this method, your path won't be polluted, and you will see if conda-related binaries are also in your current path. Or you can
add the installed bin's folder to your path, e.g. if you installed anaconda into /home/myusername/anaconda3, it will be in /home/myusername/anaconda3/bin. Your new executable file conda will be also there which will help you to install packages like git, python or pandoc, or
cd into the binary folder of anaconda, e.g. cd /home/myusername/anaconda3/bin, and execute the commands below.
don't forget to take into effect the new settings by, e.g., closing and opening the terminal again if you selected method 1. or 2. in point 5. If you selected 1, you will see something like (base) myusername#servername indicating you are using the base conda environment.
Now you can install git using conda by issuing conda install -c anaconda git.
Your .bashrc will contain likes like this if you told the Anaconda installer to initialize conda for you:
# content of your .bashrc in your home dir
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/myusername/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/myusername/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/myusername/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/myusername/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
for the latest version(which i mean git-2.25.0-rc1 or upper), you need to
wget https://github.com/git/git/releases/tag/v2.25.0-rc1 -O git.zip
unzip git.zip
cd git-2.25.0-rc1
export PATH=`pwd`:$PATH
and of course, you can add the last line into your .bashrc or .zshrc or something else for more convenience.

Resources