Related
I tried to install Valgrind with brew install Valgrind and got :
valgrind: This formula either does not compile or function as expected
on macOS versions newer than Sierra due to an upstream
incompatibility.
Error: An unsatisfied requirement failed this build.
I tried brew install --HEAD Valgrind.
Instead, after successfully installing the dependencies autoconf, automake and libtool, when it tries to install valgrind, I get a configure error:
Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x, 14.x, 15.x, 16.x and
17.x (Mac OS X 10.6/7/8/9/10/11 and macOS 10.12/13)
My OS is macOS Mojave(10.14), so does it mean that I can't install a functioning Valgrind with Homebrew presently?
A (rather painful) install from source workaround based on this patch, this post and this answer.
$ git clone https://github.com/Echelon9/valgrind.git
$ cd valgrind
$ git checkout feature/v3.14/macos-mojave-support-v2
$ ./autogen.sh
$ ./configure --prefix=/where/you/want/it/installed --enable-only64bit
$ make
If you get the following error: No rule to make target '/usr/include/mach/mach_vm.defs’, you will need to run xcode-select --install. You might need to install Xcode from the app store if you don't already have it. Once that's done, you will need to edit the coregrind/Makefile:
Search for:
am__append_19 = \
/usr/include/mach/mach_vm.defs \
/usr/include/mach/task.defs \
/usr/include/mach/thread_act.defs \
/usr/include/mach/vm_map.defs
After double checking the below folder exists, prefix every line with:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
End result should be:
am__append_19 = \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/mach/mach_vm.defs \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/mach/task.defs \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/mach/thread_act.defs \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/mach/vm_map.defs
Now run make again and the includes should be found. But that doesn't necessarily mean it will compile. I got the following error:
vg_preloaded.c:136:19: error: expected ';' before 'const'
__private_extern__ const char *__crashreporter_info__ = "Instrumented by Valgrind " VERSION;
A fix for this is to add the following line:
#define __private_extern__ extern
to the following files:
coregrind/m_syscall.c
coregrind/m_syswrap/syswrap-darwin.c
coregrind/vg_preloaded.c
Finally, you need to cross your fingers hoping no other errors show up:
$ make
$ make install
You may use Experimental Version of Valgrind for macOS 10.14.5 Mojave at:
https://github.com/sowson/valgrind
The command to use it is:
brew install --HEAD https://raw.githubusercontent.com/sowson/valgrind/master/valgrind.rb
It is still experimental and needs some work but for simple projects works already... Enjoy!
addition: I found this one worked for me on my OSX 10.14
brew install --HEAD https://raw.githubusercontent.com/LouisBrunner/valgrind-macos/master/valgrind.rb
A branch that is working to get OSX correct. something to tide us over until we get a real valgrind version fixed.
As others have mentioned, Louis Brunner maintains a working version at https://github.com/LouisBrunner/valgrind-macos.
brew tap LouisBrunner/valgrind
brew install --HEAD LouisBrunner/valgrind/valgrind
This worked for me for MacOS 10.15.7 Catalina.
I am having the same issue. It seems like valgrind is not compatible with the newest macOS(10.14 Mojave). Tried installing it the High Sierra way (https://www.gungorbudak.com/blog/2018/04/28/how-to-install-valgrind-on-macos-high-sierra/) and got the same output you described. The only solution I can offer you right now is either working on virtual machine (https://www.virtualbox.org/) or using Docker (https://www.gungorbudak.com/blog/2018/06/13/memory-leak-testing-with-valgrind-on-macos-using-docker-containers/).
I have just found a working solution to use VALGRIND on my Mac (Mojave 10.14.6). Just run this command :
brew install --HEAD https://raw.githubusercontent.com/LouisBrunner/valgrind-macos/master/valgrind.rb
(From https://github.com/LouisBrunner/valgrind-macos)
Hope it will work for you.
Not a proper solution for macOs, but for the time being, I created a docker image. After installing docker for macOS, this is how to start valgrind:
cd </path/to/source/directory/where/you/want/run/valgrind/with>
curl -O https://raw.githubusercontent.com/biocyberman/ValgrindDocker/master/startValgrind
./startValgrind # this will takes time for the first time, because it needs to fetch docker valgrind image
# you will get a root command prompt inside the docker image.
# do what ever you want
# type 'exit' to quit
As of 2019-NOV-30, it is possible to build against OS X 10.14.6 via https://github.com/sowson/valgrind and https://github.com/LouisBrunner/valgrind-macos
However, there are many test failures (see the LouisBrunner link), noise during runs, and SEGVs when running against non-trivial programs: installing is, well, installing. YMMV.
You can follow alex.m's answer to get valgrind, but if you'r using it on a int main() { return 0; } program, you'll get many weird errors, and non-existing allocs / free.
To 'hide' these annoying errors, you can follow theses steps (it's more a workaround than a real fix) (based on this wiki page and some research in Valgrind's source code):
First, create and compile a int main() { return 0; } program.
Execute the following command (to create file containing error suppression):
valgrind --leak-check=full --show-reachable=yes --error-limit=no --gen-supressions=all --log-file=$YOUR_LOG$ $YOUR_BINARY$
Using this gawk script, create the .supp valgrind file:
cat ./$YOUR_LOG$ | ./$YOUR_SCRIPT_FILE$ > minimal.supp
Copy and Past minimal.supp content at the end of $YOUR_VALGRIND_INSTALLATION_PATH$/lib/valgrind/default.supp file
And you are done! Weird and nonexistent errors will be ignored.
If you also want's to remove the non-existing allocs, frees etc, you can directly edit Valgrind's source code. Or just use heapusage for leak-tracking
(works on mojave 10.14.6)
brew install --HEAD https://raw.githubusercontent.com/sowson/valgrind/master/valgrind.rb
It seems like this specific version of OSX is problematic with valgrind, so it won't be easy as brew install the package. Fortunately the following way worked for me:
First download need MacOSX10.14 sdk, This comes with XCode but you can also download it here. The path where you unzip it will be referenced as <PATH TO OSX SDK>
Then do the following
$ git clone https://github.com/Echelon9/valgrind.git
$ cd valgrind
$ git checkout feature/v3.14/macos-mojave-support-v2
$ ./autogen.sh
$ ./configure --prefix=<installation_path> --enable-only64bit
Edit coregrind/Makefile, change this:
am__append_19 = \
/usr/include/mach/mach_vm.defs \
/usr/include/mach/task.defs \
/usr/include/mach/thread_act.defs \
/usr/include/mach/vm_map.defs
to
am__append_19 = \
<PATH TO OSX SDK>/MacOSX10.14.sdk/usr/include/mach/mach_vm.defs \
<PATH TO OSX SDK>/MacOSX10.14.sdk/usr/include/mach/task.defs \
<PATH TO OSX SDK>/MacOSX10.14.sdk/usr/include/mach/thread_act.defs \
<PATH TO OSX SDK>/MacOSX10.14.sdk/usr/include/mach/vm_map.defs
Then run
$ make
$ make install
I am using Windows 10. When I tried to build Chaincode it reported this error
# github.com/hyperledger/fabric/vendor/github.com/miekg/pkcs11
exec: "gcc": executable file not found in %PATH%
My chaincode imports:
import (
"fmt"
"strconv"
"github.com/hyperledger/fabric/core/chaincode/shim"
pb "github.com/hyperledger/fabric/protos/peer"
)
It's running fine in Docker.
gcc (the GNU Compiler Collection) provides a C compiler. On Windows, install TDM-GCC. The github.com/miekg/pkcs11 package uses cgo. Cgo enables the creation of Go packages that call C code.
If you are running Ubuntu do:
apt-get install build-essential
This solved the problem. It installs the gcc/g++ compilers and libraries.
I also encountered this message, but in my case, it was missing gcc.exe. I used choco and installed mingw, and then it worked.
details:
download choco
choco install mingw -y
check: gcc -v
1) Install .exe from > https://sourceforge.net/projects/mingw-w64/
1.2) ! use x86_64 architecture
2) Add C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin to PATH in User Variables and in System Variables. For me it works.
! To edit Path variable press Windows key, type 'path', choose 'Edit the system environment variables', click 'Environment Variables', find Path variable in System variables and in User variables then edit.
On Windows install http://tdm-gcc.tdragon.net/download, that is all.
If you are using an alpine based image with your Dockerfile
Install build-base which will be met with your requirements.
apk add build-base
$ go env
check CGO_ENABLED if its 1 change it to 0 by
$export CGO_ENABLED=0
For my case :
os: windows 10
command:
choco install mingw
install choco if not installed:
Link: https://www.liquidweb.com/kb/how-to-install-chocolatey-on-windows/
worked for me.
The proper explanations why go build does not work for hyperledger in Windows environment are given as other answers.
For your compilation purposes, just to make it work without installing anything extra, you can try the following
go build --tags nopkcs11
It worked for me. I hope same works for you too.
You can try - this is not a solution but a temp workaround
cgo_enabled=0 go build
Once you install gcc - and make sure %PATH has a way to find it (gcc.exe) - this should go away.
Also running this one will ensure the cgo_enabled variable will stay this way as long as terminal is open. That way you don't have to prefix it each time you do a build.
export cgo_enabled=0 go build
just followed instructions from following and it solve my issue
https://code.visualstudio.com/docs/cpp/config-mingw
it ask to install Mingw-w64 via MSYS2
important command is pacman -S --needed base-devel mingw-w64-x86_64-toolchain
then add C:\msys64\mingw64\bin to PATH
thanks
For Ubuntu, what worked for me was to simply run:
sudo apt install gcc
On Amazon Linux 2:
Install go
wget https://go.dev/dl/go1.18.1.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.18.1.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
Install gcc
sudo yum groupinstall "Development Tools"
I recommend using the package group, even though it can be done without it, because groupinstall gives you the necessary packages to compile software on Amazon Linux and Redhat, CentOS for that matter.
on Ubuntu its very easy but on windows need to do it:
download MinGW on http://www.mingw.org/
install on basic package Gcc-g++ (see this image)
add on environment Patch of windows variables.
restart and continue with "go get ..."
If you are running Ubuntu do:
sudo apt-get update
sudo apt-get install build-essential.
If the above commands do not work do:
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe"
The main component contains applications that are free software, can be freely redistributed and are fully supported by the Ubuntu team. & The universe component is a snapshot of the free, open-source, and Linux world.
Then install package by following command in terminal:
sudo apt-get update
sudo apt-get install build-essential.
For more info click here: https://itectec.com/ubuntu/ubuntu-problem-installing-build-essential-on-14-04-1-lts-duplicate/
Just add this to your Dockerfile
RUN apk add alpine-sdk
gcc should not be necessary, unless you are cross compiling for a non-windows platform, or use cgo.
If you still need gcc, however, you should install MinGW, which provides a gcc port for Windows (Cygwin and msys should also work, although I have never actually tested this).
Edit: I see from your error message now, that it is a dependency that requires gcc. If you didn't already know this, gcc is a c/c++ compiler, and in this case it is probably needed to compile c source files included by a dependency or sub-dependency.
Instruction to fix the "exec: “gcc”: executable file not found in %PATH%" error with MSYS2:
Download MSYS2.
Put MSYS2 folder into your $PATH.
Start the MSYS2 command line program.
Run this command: pacman -S gcc.
Kindly install the MINGW after GUI will automatically take.
http://mingw.org/wiki/Getting_Started
On Windows, you can install gcc by Scoop:
scoop install gcc
you need to download MingGW64
put MingGW64 folder into your $PATH
run go build xxx.go (with cgo library)
Hi jaswanth the main problem is that you haven't register your %GO_HOME%\pkg\tool\windows_amd64 to yuour Environment Path.
%GO_HOME% is the repository where you install your go at the first time.
same as other, just install tdm-gcc, but you can use its terminal, "MinGW", you can access it from start menu folder tdm-gcc, after start, browse to your project, and run it again
I'm a Windows user and I downloaded tdm-gcc (MinGW-w64 based) from the link below:
https://jmeubank.github.io/tdm-gcc/
After installation, it made a folder named "TDM-GCC-64".
I added "C:\TDM-GCC-64\bin" to my PATH, And it fixed my problem.
Can you tell me how to install valgrind on yosemite? When I try to install it i get " checking for the kernel version... unsupported (14.0.0)
configure: error: Valgrind works on Darwin 10.x, 11.x, 12.x and 13.x (Mac OS X 10.6/7/8/9) "
There is no official path or update, and I didn't found anything (except http://comments.gmane.org/gmane.comp.kde.devel.bugs/1553705 , but they didn't resolve that problem).
As there's no stable release that supports Yosemite, you can install the latest development version with
brew install --HEAD valgrind
Whilst it may have been the case in past OS X release cycles that Valgrind took a period of time before achieving reasonable feature support, basic OS X 10.10 support is already available in Valgrind trunk due to significant work on pre-release Yosemite.
From the mailing list:
There has been some effort recently to improve Valgrind's support for
Yosemite. If you develop on Mac OS, you might like to try out the
trunk (svn co svn://svn.valgrind.org/valgrind/trunk) and report any
breakage you get. Support for Yosemite is good enough that at least
one large graphical application (Firefox) runs OK. Support for the
previous release, 10.9 (Mavericks), is also substantially improved.
Note that the work has targetted 64 bit processes only. 32 bit might
work, and probably better on Mavericks, but I suspect it will be
increasingly problematic on Yosemite due to Valgrind's 32 bit x86
instruction set support not having progressed passed SSSE3.
Julian Seward
http://sourceforge.net/p/valgrind/mailman/message/33047840/
Full disclosure: I'm one of the new Valgrind developers who contributed patches to support OS X 10.10
Valerio's svn workflow will download every branch which is time and resource consuming. A better procedure is to download just the trunk:
svn co svn://svn.valgrind.org/valgrind/trunk valgrind
cd valgrind
./autogen.sh
./configure
make
make install
Here is my take on it. I more or less had a clean mac with xcode installed.
Got it compiling and running with the following:
# build/install autoconf/automake/libtool so that 'autogen' works
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz
tar -xzf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure && make && sudo make install
cd ..
curl -OL http://ftpmirror.gnu.org/automake/automake-1.14.tar.gz
tar -xzf automake-1.14.tar.gz
cd automake-1.14
./configure && make && sudo make install
cd..
curl -OL http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz
tar -xzf libtool-2.4.2.tar.gz
cd libtool-2.4.2
./configure && make && sudo make install
cd ..
svn co svn://svn.valgrind.org/valgrind/trunk valgrind
cd valgrind
./autogen.sh
# important: configure-params, otherwise make ends in errors
./configure -disable-tls --enable-only64bit --build=amd64-darwin
make
# sudo, otherwise it fails due to permissions
sudo make install
Note that callgrind_control (from valgrind-3.11.0 SVN) doesn't appear to work on OS X, looks like a perl-script and the commandline tool which it runs (vgdb -l) prints something 'unexpected' which that script doesn't correctly parse ( so it won't be able to find the other process running with valgrind ).
Alternatively, the perl script just calls vgdb, we can also directly do that ( just figure out your process-id manually):
vgdb --pid=2858 instrumentation on
Worked for me on 10.10.1 :
svn co svn://svn.valgrind.org/valgrind
cd valgrind
./autogen.sh
./configure
make
make install
All of the solutions listed here failed for me. What finally ended up working was to use mac ports.
sudo port install valgrind-devel
Here's how to install it using alternative sources besides the official svn (because it seems to be intermittently available).
https://crispyappstudiosblog.wordpress.com/2015/07/07/installing-valgrind-on-osx-yosemite/
1) Navigate to this git mirror of the svn and download the latest
available version: http://repo.or.cz/w/valgrind.git
2) You need VEX as well, so grab the latest version here:
http://repo.or.cz/w/vex.git
3) Extract both of them. Put the entire contents of the VEX folder
into a folder called VEX in the top level of the valgrind directory.
cd to the valgrind directory, and execute the following:
Run ./autogen.sh
Run ./configure
Run make
Run sudo make install
Test it out by running valgrind --version You should be running at
least 3.11.0 SVN for it work on Yosemite.
I installed it on my mac by installing homebrew and then running this 3 commands in the terminal.
brew update
brew doctor
brew install --HEAD valgrind
PS: I have Os X El Capitan (10.11) but this should work with previous versions too.
I finally got Valgrind to work on my OSX El Capitan 10.11.12.
User Kalmiya's answer worked for me first after I installed Xcode commandline tools.
Type this in the terminal:
xcode-select --install
Now follow Kalmiya's post, step by step.
https://stackoverflow.com/a/30366798/3633475
Here is another take on the svn install. The previous ones did not work for me, since I needed to have automake and autoconf installed, which I did not, even though I had the latest version of the Xcode command line tools installed.
I got the following from this site. I also had to link automake and autoconf after doing brew install automake and brew install autoconf by doing brew link automake and brew link autoconf for this to work.
# Check out their repo...
$ svn co svn://svn.valgrind.org/valgrind/trunk valgrind-trunk
# and hop into it.
$ cd valgrind-trunk
# You need to have autoconf and automake installed to build Valgrind
# This example uses Homebrew to install these dependencies
# (MacPorts should also work)
# (Permission error? add sudo!)
$ brew install automake
$ brew install autoconf
# run autogen.sh in valgrind-trunk
$ ./autogen.sh
# Tricky, there are some hard wired paths in the Valgrind sources.
# You need to symlink the mach folder in your XCode SDK to /usr/include/mach
# Be sure to use the proper Xcode SDK "MacOSX10.10.sdk" in the path!
$ ln -sv /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/mach /usr/include/mach
# Run configure + set install paths in valgrind-trunk
$ ./configure --prefix=/usr/local
# Run Make and make install (permission error? add sudo!) in valgrind-trunk
$ make
$ make install
# Check it works
$ valgrind --version
valgrind-3.11.0.SVN
I have used kalmiya's instructions to build valgrind as a conda package for OSX Yosemite. For those who work with anaconda/conda, just do
conda install -c https://conda.binstar.org/groakat valgrind
Side-note:
I needed to install the command line tools as described below to get valgrind compiled.
https://stackoverflow.com/a/30471647/2156909
I got valgrind on Yosemite compiled, but had to use a hack to do so. While I think you should be using xcode-select install to get all command line tools (after which valgrind should make properly), but if you don't want to do this (eg. size of Xcode tools too big), you can also get the Darwin OSX code and copy the following files to /usr/include/mach
mach_vm.defs
task.defs
thread_act.defs
vm_map.defs
This allowed a clean compile and install, although note it is a rather slack hack.
While running
./configure --prefix=/mingw
on a MinGW/MSYS system for a library I had previously run
'./configure --prefix=/mingw && make && make install'
I came across this message:
WARNING: A version of the Vamp plugin SDK is already installed. Expect worries and sorrows if you install a new version without removing the old one first. (Continuing)
This had me worried. What's the opposite of 'make install', i.e. how is a library uninstalled in Linux? Will 'make clean' do the job, or are there other steps involved?
make clean removes any intermediate or output files from your source / build tree. However, it only affects the source / build tree; it does not touch the rest of the filesystem and so will not remove previously installed software.
If you're lucky, running make uninstall will work. It's up to the library's authors to provide that, however; some authors provide an uninstall target, others don't.
If you're not lucky, you'll have to manually uninstall it. Running make -n install can be helpful, since it will show the steps that the software would take to install itself but won't actually do anything. You can then manually reverse those steps.
If sudo make uninstall is unavailable:
In a Debian based system, instead of (or after*) doing make install you can run sudo checkinstall to make a .deb file that gets automatically installed. You can then remove it using the system package manager (e.g. apt/synaptic/aptitude/dpkg). Checkinstall also supports creating other types of package, e.g. RPM.
See also http://community.linuxmint.com/tutorial/view/162 and some basic checkinstall usage and debian checkinstall package.
*: If you're reading this after having installed with make install you can still follow the above instructions and do a dpkg -r $PACKAGE_NAME_YOU_CHOSEN afterwards.
If you have a manifest file which lists all the files that were installed with make install you can run this command which I have from another answer:
cat install_manifest.txt | xargs echo rm | sh
If you have sudo make install you will need to add a sudo to your uninstall:
cat install_manifest.txt | xargs echo sudo rm | sh
How to uninstall after "make install"
Method #1 (make uninstall)
Step 1: You only need to follow this step if you've deleted/altered the build directory in any way: Download and make/make install using the exact same procedure as you did before.
Step 2: try make uninstall.
cd $SOURCE_DIR
sudo make uninstall
If this succeeds you are done. If you're paranoid you may also try the steps of "Method #3" to make sure make uninstall didn't miss any files.
Method #2 (checkinstall -- only for debian based systems)
Overview of the process
In debian based systems (e.g. Ubuntu) you can create a .deb package very easily by using a tool named checkinstall. You then install the .deb package (this will make your debian system realize that the all parts of your package have been indeed installed) and finally uninstall it to let your package manager properly cleanup your system.
Step by step
sudo apt-get -y install checkinstall
cd $SOURCE_DIR
sudo checkinstall
At this point checkinstall will prompt for a package name. Enter something a bit descriptive and note it because you'll use it in a minute. It will also prompt for a few more data that you can ignore. If it complains about the version not been acceptable just enter something reasonable like 1.0. When it completes you can install and finally uninstall:
sudo dpkg -i $PACKAGE_NAME_YOU_ENTERED
sudo dpkg -r $PACKAGE_NAME_YOU_ENTERED
Method #3 (install_manifest.txt)
If a file install_manifest.txt exists in your source dir it should contain the filenames of every single file that the installation created.
So first check the list of files and their mod-time:
cd $SOURCE_DIR
sudo xargs -I{} stat -c "%z %n" "{}" < install_manifest.txt
You should get zero errors and the mod-times of the listed files should be on or after the installation time. If all is OK you can delete them in one go:
cd $SOURCE_DIR
mkdir deleted-by-uninstall
sudo xargs -I{} mv -t deleted-by-uninstall "{}" < install_manifest.txt
User Merlyn Morgan-Graham however has a serious notice regarding this method that you should keep in mind (copied here verbatim): "Watch out for files that might also have been installed by other packages. Simply deleting these files [...] could break the other packages.". That's the reason that we've created the deleted-by-uninstall dir and moved files there instead of deleting them.
99% of this post existed in other answers. I just collected everything useful in a (hopefully) easy to follow how-to and tried to give extra attention to important details (like quoting xarg arguments and keeping backups of deleted files).
Depending on how well the makefile/configure script/autofoo magic of the program in question is the following might solve your problem:
make uninstall
The problem is that you should execute this on the source tree of the version you've got installed and with exactly the same configuration that you used for installing.
make clean generally only cleans built files in the directory containing the source code itself, and rarely touches any installed software.
Makefiles generally don't contain a target for uninstallation -- you usually have to do that yourself, by removing the files from the directory into which they were installed. For example, if you built a program and installed it (using make install) into /usr/local, you'd want to look through /usr/local/bin, /usr/local/libexec, /usr/local/share/man, etc., and remove the unwanted files. Sometimes a Makefile includes an uninstall target, but not always.
Of course, typically on a Linux system you install software using a package manager, which is capable of uninstalling software "automagically".
The "stow" utility was designed to solve this problem: http://www.gnu.org/software/stow/
There is no standard unfortunately, this is one of the perils of installing from source. Some Makefiles will include an "uninstall", so
make uninstall
from the source directory may work. Otherwise, it may be a matter of manually undoing whatever the make install did.
make clean usually just cleans up the source directory - removing generated/compiled files and the like, probably not what you're after.
Make
Make is the program that’s used to install the program that’s compiled from the source code. It’s not the Linux package manager so it doesn’t keep track of the files it installs. This makes it difficult to uninstall the files afterward.
The Make Install command copies the built program and packages into the library directory and specified locations from the makefile. These locations
can vary based on the examination that’s performed by the configure script.
CheckInstall
CheckInstall is the program that’s used to install or uninstall programs that are compiled from the source code. It monitors and copies the files that are installed using the make program. It also installs the files using the Linux package manager which allows it to be uninstalled like any regular package.
The CheckInstall command is used to call the Make Install command. It monitors the files that are installed and creates a binary package from them. It also installs the binary package with the Linux package manager.
Replace "source_location.deb" and "name" with your information from the Screenshot.
Execute the following commands in the source package directory:
Install CheckInstall sudo apt-get install checkinstall
Run the Configure script sudo ./configure
Run the Make command sudo make
Run CheckInstall sudo checkinstall
Reinstall the package sudo dpkg --install --force-overwrite source_location.deb
Remove the package sudo apt remove name
Here's an article article I wrote that covers the whole process with explanations.
Method 1
From the source folder:
#make uninstall
Method 2
If there is no uninstall procedure:
open install_manifest.txt (created by #make install)
remove all the directories/files listed
remove any remaining files you missed:
#xargs rm < install_manifest.txt
remove any hidden directories/files:
$rm -rf ~/.packagename
Remove the source folder.
Method 3
If none of the above options work, view the install procedure:
#make -n install
and reverse the install procedure:
#rm -rf all directories/files created
Example
For example, this is how to uninstall nodejs, npm, and nvm from source:
How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
which you can do using any of the above methods.
I know of few packages that support "make uninstall" but many more that support make install DESTDIR=xxx" for staged installs.
You can use this to create a package which you install instead of installing directly from the source. I had no luck with checkinstall but fpm works very well.
This can also help you remove a package previously installed using make install. You simply force install your built package over the make installed one and then uninstall it.
For example, I used this recently to deal with protobuf-3.3.0.
On RHEL7:
make install DESTDIR=dest
cd dest
fpm -f -s dir -t rpm -n protobuf -v 3.3.0 \
--vendor "You Not RedHat" \
--license "Google?" \
--description "protocol buffers" \
--rpm-dist el7 \
-m you#youraddress.com \
--url "http:/somewhere/where/you/get/the/package/oritssource" \
--rpm-autoreqprov \
usr
sudo rpm -i -f protobuf-3.3.0-1.el7.x86_64.rpm
sudo rpm -e protobuf-3.3.0
Prefer yum to rpm if you can.
On Debian9:
make install DESTDIR=dest
cd dest
fpm -f -s dir -t deb -n protobuf -v 3.3.0 \
-C `pwd` \
--prefix / \
--vendor "You Not Debian" \
--license "$(grep Copyright ../../LICENSE)" \
--description "$(cat README.adoc)" \
--deb-upstream-changelog ../../CHANGES.txt \
--url "http:/somewhere/where/you/get/the/package/oritssource" \
usr/local/bin \
usr/local/lib \
usr/local/include
sudo apt install -f *.deb
sudo apt-get remove protobuf
Prefer apt to dpkg where you can.
I've also posted answer this here
Make can tell you what it knows and what it will do.
Suppose you have an "install" target, which executes commands like:
cp <filelist> <destdir>/
In your generic rules, add:
uninstall :; MAKEFLAGS= ${MAKE} -j1 -spinf $(word 1,${MAKEFILE_LIST}) install \
| awk '/^cp /{dest=$NF; for (i=NF; --i>0;) {print dest"/"$i}}' \
| xargs rm -f
A similar trick can do a generic make clean.
Preamble
below may work or may not, this is all given as-is, you and only you are responsible person in case of some damage, data loss and so on. But I hope things go smooth!
To undo make install I would do (and I did) this:
Idea: check whatever script installs and undo this with simple bash script.
Reconfigure your build dir to install to some custom dir. I usually do this: --prefix=$PWD/install. For CMake, you can go to your build dir, open CMakeCache.txt, and fix CMAKE_INSTALL_PREFIX value.
Install project to custom directory (just run make install again).
Now we push from assumption, that make install script installs into custom dir just same contents you want to remove from somewhere else (usually /usr/local). So, we need a script.
3.1. Script should compare custom dir, with dir you want clean. I use this:
anti-install.sh
RM_DIR=$1
PRESENT_DIR=$2
echo "Remove files from $RM_DIR, which are present in $PRESENT_DIR"
pushd $RM_DIR
for fn in `find . -iname '*'`; do
# echo "Checking $PRESENT_DIR/$fn..."
if test -f "$PRESENT_DIR/$fn"; then
# First try this, and check whether things go plain
echo "rm $RM_DIR/$fn"
# Then uncomment this, (but, check twice it works good to you).
# rm $RM_DIR/$fn
fi
done
popd
3.2. Now just run this script (it will go dry-run)
bash anti-install.sh <dir you want to clean> <custom installation dir>
E.g. You wan't to clean /usr/local, and your custom installation dir is /user/me/llvm.build/install, then it would be
bash anti-install.sh /usr/local /user/me/llvm.build/install
3.3. Check log carefully, if commands are good to you, uncomment rm $RM_DIR/$fn and run it again. But stop! Did you really check carefully? May be check again?
Source to instructions:
https://dyatkovskiy.com/2019/11/26/anti-make-install/
Good luck!
I try download lighttpd 1.4.23 source, and compile it on MacOSX 10.5.5.
This is the error I am getting:
$ ./autogen.sh
./autogen.sh: running `libtoolize --copy --force'
./autogen.sh: line 19: libtoolize: command not found
I tried ask the same question on lighttpd forum, but I can't get any help there.
Thanks in advance.
libtoolize is part of GNU libtool, a package for building libraries portably. On the Mac, one option for getting it is to use MacPorts, a package manager which works in a similar fashion as Gentoo and FreeBSD, in that it compiles packages on your machine. See http://www.macports.org/install.php.
Beware, though, that it will be installed as glibtoolize, i.e. with a 'g' prefixed. That is a standard way to make GNU tools live in parallel with UNIX tools of the same name, that might be present (even though there isn't one in this particular case).
The command for installing libtool from MacPorts is: sudo port install libtool
Add a '-d' flag after the 'port' command to see the build output.
Here's what I use to install lighttpd 1.4.25 on Mac OS X 10.6.2. If I remember correctly, the same thing worked for me in a recent version of Mac OS X 10.5.
Install Xcode Developer Tools
Either install them from the DVD that came with your Mac (under Optional Installs) or download them from Apple's developer page.
Install PCRE
curl -O http://softlayer.dl.sourceforge.net/project/pcre/pcre/7.9/pcre-7.9.tar.gz
tar xzf pcre-7.9.tar.gz
cd pcre-7.9
./configure
make && sudo make install
cd ../
Install lighttpd
curl -O http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.25.tar.gz
tar xzf lighttpd-*.tar.gz
cd lighttpd-*
./configure
make && sudo make install
Note that the URLs above will quickly go out of date; you may need to download the latest versions of the .tar.gz packages from a different location.