I am on Mac OS X using codeblocks 10.05
I downloaded Valgrind, and extracted a folder. I am completely lost from there, and have no idea how to build it.
I do not know ANY terminal/console commands and am generally new to programming, so I have no idea how to "build" or "compile" it. I just have a folder called Valgrind with a bunch of random files in it.
Could someone please tell me how to proceed? I already checked the website/documentation but it didn't really give me installation instructions, just usage instructions.
Thanks
PS: I know I already posted this question, but the previous question was shut down, for being too vague. I reposted this one with more info.
PSS: All that I am basically asking is what do I do to install Valgrind right after I download it from the website and extract the files?
Recommended:
Use brew: brew install valgrind
Manual Install:
Here's what worked on my Mac (10.6). Double-check you have the latest version, then change into the uncompressed directory
cd /users/(insert username here)/downloads/valgrind-3.17.0
I suggest you do as another posted and read the readme.
nano README
Commence the build; /usr/local is the place on the filesystem that the program will be installed to. There are many arguments like prefix that are available to customize the installation to your particular system if it doesn't work by default. Normally just using ./configure works perfectly well though.
./configure --prefix=/usr/local
make
sudo make install
Or you could probably get it from fink or macports or homebrew.
You can install it through brew for Mac:
brew install valgrind
You might have to manually link the entry to /usr/local/bin as brew refused to do it in my case:
$ ln /usr/local/Cellar/valgrind/3.8.1/bin/vgdb /usr/local/bin/vgdb
ln: /usr/local/bin/vgdb: Permission denied
$ sudo ln /usr/local/Cellar/valgrind/3.8.1/bin/vgdb /usr/local/bin/vgdb
On MacOS High Sierra
If you have the following error message:
brew install valgrind
valgrind: This formula either does not compile or function as expected on macOS
versions newer than Sierra due to an upstream incompatibility.
Fix
(1) To correctly install it, first, type the following command at the Terminal (which opens Valgrind’s formulae)
brew edit valgrind
And change the URL in head section
https://sourceware.org/git/valgrind.git
to
git://sourceware.org/git/valgrind.git
(2) Do an update for Homebrew:
brew update
(3) Finally, use the following command to install Valgrind from the HEAD:
brew install --HEAD valgrind
Sources
https://www.gungorbudak.com/blog/2018/04/28/how-to-install-valgrind-on-macos-high-sierra/
https://github.com/Homebrew/homebrew-core/issues/18998
For macOS Big Sur / Monterey:
brew tap LouisBrunner/valgrind
brew install --HEAD LouisBrunner/valgrind/valgrind
The core process is pretty simple:
Make sure you are in the correct directory.
First run:
./configure
when that is finished, run:
make
at this point you will need to su into root (this is relatively tricky to do, see the note at the end). As root, run:
make install
When this is finished you will have a working valgrind installation. Test it by running
valgrind ls -l
To su into root, you will need to have set up a root account. If you have not done this in the past, see the instructions from apple here.
To perform the actual su, you will first have to be running an account with administrator privileges. If you are not already doing so, you can switch users with the following:
su admin
where admin is the name of an user with administrator privileges (you will need to enter the password for this account). From there, you can then run su to go into root:
su
You will need to enter the root password that you set up earlier.
You may find it easier to use something like macports. How to install that is probably beyond the scope of this question, but they have a page dedicated to it on their site.
Once you have macports installed, you need to type:
sudo port install valgrind +universal
As you say you don't have any experience of command lines, let's just briefly go through the different parts of this command:
sudo means the rest of the command will run as root, and will ask for your password. This is needed for the installer to have the correct permissions
port is the command line tool for managing macports
install is a command for port. Try port help to see a list of commands.
valgrind tells macports what it should be installing
+universal is a variant. This tells macports to configure valgrind to support 32 bit and 64 bit support.
Related
Is there a way to install Valgrind on Catalina and have it run properly? If so, I would very much appreciate a step-by-step process.
I tried installing Valgrind with https://github.com/sowson/valgrind
but when I tested out helloWorld.cpp on the terminal, the console returned errors I should not have gotten.
I'm not sure if I committed an error on my part in the installation process of this version of Valgrind or if Valgrind itself is simply incompatible with Catalina OS.
I have also tried installing Valgrind via Homebrew, but I've had issues with that as well (github.com/Homebrew/homebrew-core/issues/36683).
Currently, no. The repo you link has an issue raised about Catalina compatibility. As you also show, the brew package has its own problems as well. Official valgrind only supports 10.12.
You'll just have to wait, or containerize it. Although if you containerize valgrind, you would likely need a compatible build container as well.
Ok. I've found a way to use Valgrind on Catalina. Here's a link to my guide for how https://github.com/john-yohan-park/Valgrind_Catalina
Works amazingly!! see https://github.com/LouisBrunner/valgrind-macos/issues/5.
Not Homebrew, you need to compile it from source, but it's not so difficult.
1. git clone https://github.com/LouisBrunner/valgrind-macos.git
2. cd valgrind
3. sudo ./autogen.sh
4. sudo ./configure --prefix=/where/you/want/it/installed --enable-only64bit
5. copy the [contents][1] to ./coregrind/m_mach/mach_basics.c
6. sudo make
7. sudo make install
enjoy!
This is how I just did it on Catalina 10.15.5:
brew remove valgrind # remove previous attempts at installing it (if any)
brew tap LouisBrunner/valgrind
brew install --HEAD LouisBrunner/valgrind/valgrind
Source: https://github.com/LouisBrunner/valgrind-macos
I am running centos 6 on a cluster. I installed the latest gcc-8.2.0. and made a link "ln -sf /usr/bin/gcc-8.2 gcc".
I did the same for g++ and gfortran.
I wanted to reinstall gcc-8.2.0 and went ahead to
make clean
in the gcc-8.2 directory.
When I try
./configure
I get that C compiler cannot create executables
The links I made are broken.
The system gcc-4.4.7 cannot be found
which gcc
gives no gcc
sudo yum install gcc gcc-c++
gives gcc is already installed.
I tried to install an rpm, which fails because of dependencies.
I have pg compilers installed in /opt/pgi
When I configure with
CC=/path to/pgi/bin/pgcc FC=/path to/pgi/bin/pgfortran ./configure
I still get C compiler cannot create executables
I tried the following c++ programm
#include <iostream>
using namespace std;
int main() {
cout << "Hello world!" << endl;
return 0;
}
With the command
/opt/pgi/linux_86_64/12.08/bin/pgcpp hello.cpp -o hello
It gives compilation error that float.h not found. On another linux PC with working gcc, the program works with the command
g++ hello.cpp -o hello
I will appreciate any assistance to either find the systemgcc or use pg compilers to compile gcc if possible
I admit it is a big mess which will require OS reinstallation and reconfiguration. But then I did
sudo yum install compat-gcc-34
Now I have gcc34 and configure of gcc-8.2 goes through without "c compiler cannot create executables". (Note that the ./configure referred to in earlier post was actually
../gcc_8_2_release/configure
inside "gcc_8_2_release_build, so gcc was not being built in its source directory.
The problem I have now is with make, which needs g++, giving error
uint_t(64) or int_t(64) not found.
Thanks all who have gone through this post, for your patience.
Any assistance will be appreciated.
Here is how I got out of this mess.
With the following two commands
sudo yum install compat-gcc-34-c++
sudo yum install compat-gcc-34-g77
I was able to install the older version of gcc, c++ and g77. Then I was able to build gcc-8.2.
Now I have a functional system with the latest gcc, yes it may need re-installation/re-configuring but it is fully functional.
I have learnt a lot and very much appreciate the comments and guidelines of #Basile. However, at one point he was rather negative and discouraging.
But thanks to my belief and perseverance, and more importantly browsing the knowledge shared by others, I have been able to recover what I was beginning to be convinced was a lost cause.
Thanks all.
This is more a sysadmin question than a programming one.
My recommendations:
don't mess your /usr/bin/. Leave your package manager yum to fill it -and never add anything inside it without yum ; so remove manually any symlinks you made there (by mistake)
reinstall the old system gcc 4.4 and g++ 4.4 (using yum)
rebuild your GCC 8 from scratch from its source code. Configure it with --program-suffix=-8 (but no --prefix, or a --prefix=$HOME/soft/ if you don't have root access). So it will install /usr/local/bin/gcc-8 and /usr/local/bin/g++-8 etc... (or, if you have given --prefix=$HOME/soft/ , a $HOME/soft/bin/gcc-8 etc...)
create a $HOME/bin/ if you don't have already one
be sure to have $HOME/bin/ early in your $PATH (before /usr/bin/)
add a symlink ln -sv /usr/local/bin/gcc-8 $HOME/bin/gcc and likewise for g++ etc..
Then, when you type gcc you are getting that symlink to /usr/local/bin/gcc-8 etc.
If you cannot write to /usr/local/ (e.g. because you don't have root permission...) you could pass --prefix=$HOME/soft/ to GCC 8 .../configure then replace /usr/local/ above with $HOME/soft/
If you are the sysadmin and can write to /usr/local/ and have to set up things for many users: add a symlink ln -s /usr/local/bin/gcc-8 /usr/local/bin/gcc etc and ask your users to put /usr/local/bin/ in their $PATH before /usr/bin/
BTW, notice that it is explicitly documented that GCC 8 (or others) need to be built outside of its source tree: in Installing GCC you can read:
First, we highly recommend that GCC be built into a separate directory from the sources which does not reside within the source tree.
(the "highly recommend" should be considered as a polite way to say "you absolutely should")
So your ./configure was another mistake.
It could happen that you messed up your system more seriously than you thought (and perhaps you need to reinstall, or to call Redhat support).
PS. I don't know Redhat (used it only in the previous century). My favorite distro is Debian/testing or Debian/unstable (and my computers are desktops, not clusters).
This problem was solved by the following commands
sudo yum install compat-gcc-34-c++
sudo yum install compat-gcc-34-g77
Once this older version of gcc is installed, the latest version, gcc-8.2 was built and the system is no longer messed terribly. It is very healthy and fit.
the problem is already known, that gdb doesn't work with OS X Sierra anymore.
This is really annoying, since I researched already about the solution, and there were some solutions, but they apparently don't work anymore. I tried to use the .gdbinit file solution and the disable csrutil solution, both doesn't work.
Sooo my question is: Does anyone know how to fix it in 10.12.3 ?
Thank you very much!
Looks like there still isn't a solution to this. I don't think "use LLDB instead of GDB" is the ultimate solution. So I went ahead and built a fairly basic docker container which contains the very basics (g++ and gdb).
Here is the Docker Hub container, and the the Dockerfile is on this Github repo.
This solution at least allows you to use GDB on your Mac via a couple simple commands. And since the folder you're coding on is mounted, as soon as you hit save, all your changes appear automatically.
Hope this helps someone else out there.
So thanks to Basile Starynkevitch, who just gave me the idea to update gdb
SOLUTION:
You simply have to update gdb for the latest version (which is 7.12.1 currently). Assuming you have installed Homebrew:
That's what I did:
brew update
brew remove gdb
brew install gdb
It has now updated to the latest version.
Now codesign gdb again with the cert that you used before.
sudo killall taskgated
codesign -fs gdb-certi /usr/local/bin/gdb
launchctl load /System/Library/LaunchDaemons/com.apple.taskgated.plist
Last step is still to use the workaround to create the .gdbinit file:
nano ~/.gdbinit
-> set startup-with-shell off
Debugging works for me now :) (OS X Sierra 10.12.3 - gdb 7.12.1).
UPDATE:
Apparently it will fix certain problems, but not the whole problematic itself. It will still cause errors. Honestly, my solution: When you can: Switch to LLDB and another IDE (Netbeans does not support LLDB). Or use Linux. I currently use Ubuntu with a stick on my MacBook Pro.
None GDB 7.11 or 7.12.1 will not work on Sierra 10.12.4 In short it's because of Apple security upgrade. We need to wait for re-enabling when some new version will shows up.
Easy WA is to use LLDB as a debugger for now. Sample instructions here
Another LLDB instruction here
I found that gdb 7.12.1 did not work for me either. I do not think it includes the crucial commit 82b19a4d2f9c9e8d56f to gdb made on the 9th Nov 2016.
I was able to get the gdb 8.0 development branch to work, however.
Download with, e.g.
git clone --depth 1 --branch gdb-8.0-branch git://sourceware.org/git/binutils-gdb.git
Then go into the checked-out directory
cd binutils-gdb
I have macports so (a) wanted to link to macports libraries and (b) wanted to avoid putting stuff in /usr/local so configured with
./configure prefix=$HOME LDFLAGS="-L/opt/local/lib" CPPFLAGS="-I/opt/local/include"
make -j8
make install
=> puts gdb executable into ~/bin; (static) libraries into ~/lib; documentation into ~/share
Then follow André's tip above to do the code signing; though it will now be
codesign -fs gdb-certi ~/bin/gdb
When I installed WSL for my computer I was very excited to have a more natively supported Linux system rather than using VirtualBox. However I get this error when I try to run it. Is there a reason why?
I am happy to give more information as required.
--4364:0:aspacem -1: ANON 0038000000-00383d5fff 4022272 r-x-- SmFixed d=0x000 i=25365 o=0 (0) m=0 /usr/lib/valgrind/memcheck-amd64-linux
--4364:0:aspacem Valgrind: FATAL: aspacem assertion failed:
--4364:0:aspacem segment_is_sane
--4364:0:aspacem at m_aspacemgr/aspacemgr-linux.c:1502 (add_segment)
--4364:0:aspacem Exiting now.
It's definitely possible
I've encountered some problems installing it directly with apt, however it can be installed manually with some very simple steps:
Download the source file: wget http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2 (by the time you read this there could be a newer version)
Extract the archive: tar -xvjf valgrind-3.12.0.tar.bz2
Configure the installation process: cd into the exctracted folder valgrind-3.12.0 and then launch ./configure
Make: simply launch make while in the valgrind-3.12.0 folder
Check the dependencies: launch make check to see whether all the dependencies necessary for the installation are satisfied (e.g: you'll have to install g++, just launch sudo apt install g++)
Install valgrind: type sudo make install to install it
I had the same problem, the solution was to install Windows 10 creators update (version 1703), and reinstall Bash/WSL. Valgrind now works fine :)
I am trying to install Qt 4.6.2 on ubuntu. When I run the configure script I get the following error message "You don't seem to have 'make' or 'gmake' in your PATH. cannot proceed".
On echo of the PATH variable I get
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
on running the command
$which make , I get
/usr/bin/make
How do I proceed with this issue? I seem to have the make in the path env variable but still the config script throws cannot find make or gmake?
It not the problem of make or gmake, nor PATH, Just because you unzip the tarball without -a option. so, to solve this problem, just use 'unzip -a *.zip', it will be fine.
I recently encountered this error in a fedora32 docker container, because the which utility was not installed. I was compiling Qt 5.12.9.
dnf install which fixed the problem.
You should have been installed build-essentials but did not restart try either to restart or type:
export MAKE=/usr/bin/make
and make sure with echo $MAKE
I downloaded the source again. I am able to run configure without any problems. Seems like there was an issue with the earlier source.
you should install build essentials
sudo apt-get install build-essential
and typesudo apt make install