I have Git for Windows 2.10.2 and the latest version of MSYS2 installed on my Windows 7 machine. I had been using an older version of MinGW to compile c++ code. I would use notepad++ to write/edit the files and compile and run them through Git Bash using gcc console commands. I love being able to go to my file directory, right click, and select the "Git Bash Here" option to open the console and do whatever I needed.
After uninstalling MinGW, I installed MSYS2 and downloaded some of their packages using the package manager, Pacman, that comes with MSYS2. I also updated my PATH variable. I went to test everything out with Git Bash by typing the command:
gcc --version
and I've been getting this error
OWNER#Seth MINGW64 /c
$ gcc --version
2 [main] gcc (5284) C:\msys64\usr\bin\gcc.exe: *** fatal error - cygheap base mismatch detected - 0x1802FF408/0x1802FE408.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version. The most recent version *should*
reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution. Rebooting is also suggested if you
are unable to find another cygwin DLL.
Segmentation fault
OWNER#Seth MINGW64 /c
$
I've never used Cygwin and therefore have never installed it on this computer. I've spent the last three days searching online for solutions to this. I've uninstalled and reinstalled Git and MSYS2. I put the git-bash.exe in my c:\msys64\ directory and ran the same command from there and got:
OWNER#Seth MINGW64 ~
$ gcc --version
gcc.exe (Rev2, Built by MSYS2 project) 6.2.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
OWNER#Seth MINGW64 ~
$
but that doesn't seem to me to be a very elegant solution. It does work though, I can cd to the folder containing my code and compile and run them.
Another thing I tried was to go into the registry and change where the "Git Bash Here" option looks for git-bash.exe. I changed it from:
"C:\program files\Git\git-bash.exe" "--cd=%v."
to
"C:\msys64\git-bash.exe" "--cd=%v."
and now right clicking and selecting "Git Bash Here" and running the command:
gcc --version
results in:
OWNER#Seth MINGW64 ~
$ gcc --version
gcc.exe (Rev2, Built by MSYS2 project) 6.2.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
OWNER#Seth MINGW64 ~
$
and once again I can cd to the folder with my code and compile and run them.
The problem now is that before when Git Bash would open, it would be looking in the directory where I had right clicked. But now I have to cd to where ever I'm needing to go.
Is there a better way to get MSYS2 and Git working together? Am I making this way more difficult than it should be? Or is there a better way and I'm just stumbling around in the dark?
Related
System info:
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
Using x86_64-w64-mingw32-gcc:
x86_64-w64-mingw32-gcc --version
x86_64-w64-mingw32-gcc (GCC) 9.3-win32 20200320
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
For a project we are using mingw to cross-compile Windows PE files on Ubuntu. During the cross-compilation we are making modifications to the files. During cross-compilation, the following code is used in the Python script:
x86_64-w64-mingw32-gcc {path} -o {outfile} -static
When the process starts we have a file, somefile (no extension is used), but after going through the cross-compilation the newly compiled file is called somefile.exe.
On an older Ubuntu system, I believe it was 17.##, my apologies but the box is offline and I don't remember the exact versioning, we could run the script and the filename would be preserved, no .exe appended to the filename.
The addition of .exe to the filename is causing some issues with my workflow, and I'm hoping there's a way around this outside of cloning the old Ubuntu system to newer hardware. This may work, but logistically it's not ideal.
We're able to make some modifications by bash during the process, but this is creating unwanted artifacts. And we'd like to keep our system processes streamlined.
An older post, gcc - how to force to not add .exe suffix, suggests adding a . to the end of -o {outfile}, removing the suffix leaving a .. While a great idea, this still has issues with our workflow in that the filename, a SHA256 hash, is used and no extension is looked for (the . still causes issues).
If anyone has any insight on how this may be remedied, perhaps modifying the main.c file that is referenced during compilation, it's greatly appreciated. I can provide more information if necessary.
Also, my apologies if the post is missing any mission-critical information, I'm new to posting here.
I tried using this tutorial to download the newest version of g++, and I changed the version number from 4.7 to the newest (which is believe is) 8.1. But I get the following errors
Error: No available formula with the name "gcc81"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
==> Searching local taps...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
Does anyone know how to update my g++ version? This is what I get when I try to find out my current version.
g++ --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Sorry Im such a noob, I really trying to learn here.
I know this post is a little old but I can shine some light regarding how to accomplish this.
Firstly, to install gcc/g++ using Homebrew, you should use the following command as mentioned in the comments above: brew install gcc
After doing this, Homebrew should place the installed binaries/symlinks in the correct folders.
To correctly setup the gcc/g++ command on mac to use the version you just downloaded, I do this by not changing the symlinks gcc/g++ but instead creating aliases for both gcc and g++ within my shell environment.
alias gcc='gcc-10'
alias g++='g++-10'
gcc-10 and g++-10 were downloaded using Homebrew. When doing this, Homebrew places gcc-10 and g++-10 in /usr/local/bin (which is on the path) and it allows you to create an alias for the regular gcc/g++ commands which point to the versions installed by Homebrew.
After doing this, running the command g++ --version should give you the following:
g++-10 (Homebrew GCC 10.2.0) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
You may need to restart your terminal or run source ~/.bashrc depending on the type of shell you're using.
I am trying to downgrade gcc/g++ to 4.8.1. I tried two options, both with problems.
use sudo apt install gcc-4.8 g++-4.8. This option will install 4.8.5 etc. I wonder if there is any way to specify 4.8.1. sudo apt install gcc-4.8.1 g++-4.8.1 does not work as it will complain that "unable to locate package gcc-4.8.1".
Download "gcc-4.8.1" and follow the official steps ("configure, make, make install") but it fails at the make step with errors "CXXABI_1.3.8" not found.
I found another solution but I am not sure whether it is desirable (" install gcc-4.8.1 from source code on Ubuntu-16.04").
How do I downgrade gcc/g++ to 4.8.1 in Ubuntu?
Many thanks.
How do I downgrade gcc/g++ to 4.8.1 in Ubuntu?
I think you want look into the command "update-alternatives" (instead of 'downgrade').
To learn some more browse "https://askubuntu.com/questions/529687/how-to-use-update-alternatives-to-manage-multiple-installed-version-of-the-sam"
The update-alternatives works by changing what the command g++ points at. Currently on my system, g++ points to g++-6.
I have sometimes experienced an install that simply does not work. My recent g++ v6.2 install is broken, I don't know why.
But because my ubuntu is out of date, I plan to upgrade to the latest ubuntu. I might as well wait to install the latest compiler.
In the mean time I have 6.2.0, which does not 'work' (cause unknown). g++ points to this:
~$ g++ --version
g++ (GCC) 6.2.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Since I seldom remove (un-install) the previous version in use, it turns out that with a simple search to identify what is available, I can access an older compiler using a suffix. For example
~$ g++-5 --version
g++-5 (Ubuntu 5.2.1-23ubuntu1~15.10) 5.2.1 20151028
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
So, I continue more or less the same as before the failed 6.2.0 install.
For you, I think this means that you can use your package manager to install your desired earlier compiler, but remember to search for it in case it already exists on your system. Then use update-alternatives to make it the default, or just learn the new command name to invoke, i.e. g++-5, and continue developing with both commands easily available.
I am using an ubuntu 10.04, with the gcc toolset version 4.4.3
My boost installation is at
/usr/local/boost_1_50_0
I am looking to build the python libraries. For this, in my installation folder i instructed
sudo ./bootstrap.sh --with-libraries=python
To which I received the following reply
Building Boost.Build engine with toolset gcc... tools/build/v2/engine/bin.linuxx86/b2
Detecting Python version... 2.6
Detecting Python root... /usr
Unicode/ICU support for Boost.Regex?... not found.
Backing up existing Boost.Build configuration in project-config.jam.6
Generating Boost.Build configuration in project-config.jam...
Bootstrapping is done. To build, run:
./b2
To adjust configuration, edit 'project-config.jam'.
Further information:
- Command line help:
./b2 --help
- Getting started guide:
http://www.boost.org/more/getting_started/unix-variants.html
- Boost.Build documentation:
http://www.boost.org/boost-build2/doc/html/index.html
aditya#aditya:/usr/local/boost_1_50_0$ g++ --version
g++ (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I then perform
sudo ./b2
I then receive a host of build errors - basically nothing builds.
I suspect this is to do with the unavailability of some of the python dev libraries.
This machine is not connected to the internet, so I'll need to build these myself (as opposed to sudo apt-get install them).
I have installed all packages in cygwin. I have also added C:\cygwin\bin to my PATH variable. But when I try to compile a c++ file in command line I get the error 'Access is denied'. The same commands work in the cygwin batch window. Does anyone know what's wrong?
Edit: I changed the permissions for gcc and g++. I no longer get the 'Access Denied' error, but get a new one: "This version of C:\cygwin\bin\g++.exe is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.".
Because c:\cygwin\bin\gcc.exe isn't an executable file, it's a cygwin symbolic link.
$ file /bin/gcc
/bin/gcc: symbolic link to `/etc/alternatives/gcc'
$ file /etc/alternatives/gcc
/etc/alternatives/gcc: symbolic link to `/usr/bin/gcc-4.exe'
The underlying file runs just fine.
C:\cygwin\home\Ben>gcc-4 --version
gcc-4 (GCC) 4.5.0
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I just deleted gcc and g++ and renamed the g++/cc-4.
Unless you're a masochist, always use a Cygwin batch window with Cygwin executables. Also if you're using the Cygwin compiled gcc, you'll need the Cygwin DLL to run the results. The Cygwin website explains why. If you need executables without the Cygwin dll, I'd explore MinGW.
I got the same issue and was because I had pending the reboot after Cygwin installation. After the reboot works for me.