0

I have used cygwin and emacs for a long time and there have always been problems integrating. xemacs under cygwin worked perfectly but require xwindows running which was unpleasant. Then I added git bash to the mix.

Now if you count, I have 4 separate unix implementations under windows:

cygwin
Qt (which runs mingw somewhere in there)
git bash
MSYS64

with emacs running native on windows.

I want to know if I can consolidate and delete some of these tools. It seems ludicrous that cygwin and MSYS2 have git. Then why have a separate git bash? From what I read, git is running in MSYS2 anyway.

But I am highly suspicious. In the past, cygwin was NOT the same as mingw. There were two big bugs I found -- one is the runtime libraries, which on mingw used the native libraries. So even though the compiler was the same, compiling a program with long double yielded a program that did not work.

I tried that now, and it works in MSYS2. That could be because they are using all gnu libraries, or because microsoft has updated.

Threading also did not work in mingw but did in cygwin. I just tested with the following C++ code in MSYS2-64:

#include <thread>
#include <iostream>
#include <unistd.h>
using namespace std;

void f() {
    for (;;) {
        cout << "yo!\n";
        //      sleep(1);
    }
}

void g() {
    for (;;) {
        cout << "ho!\n";
        //      sleep(2);
    }
}

int main() {
    thread t1(f);
    thread t2(g);
    t1.join();
    t2.join();
    cout << "Done!\n";
    return 0;
}

Running under emacs, as installed in MSYS2, the job does not stop (I have to kill the shell). It does work on the command line. If I uncomment the sleep calls, it hangs both in MSYS2 bash and an emacs command shell.

then there is the issue with git.

git bash is using /c/Users/myuser as the directory to store .ssh. It works

When I echo $HOME under cygwin, it shows /c/Users/myuser but it still tries to use /home/myuser, which does not exist, which means that .ssh directory does not exist, so it fails. So I can build in cygwin, but have to push in git bash which is annoying. I cannot buidl in git bash because it does not have a full dev environment.

MSYS2 claims that HOME is /c/Users/myuser but when trying a git push it says the same error:

Could not create directory '/home/myuser/.ssh'. So somewhere inside there, it still has hardcoded the notion that .ssh should be in /home/myuser as opposed to c:/Users/myuser.

What's worse, in cygwin there is a /home directory and I seem to recall it by default created /home/myuser though it is not there now. in MSYS2, there is NO DIRECTORY /home, and I wonder if I should create one.

I could create one symbolically linked to c:/Users/myuser, if that works under windows? I just tried this:

mkdir /home/
ln -s /c/Users/myuser /home/myuser

The shell hung. That's not good! I killed the shell and ran again. Somehow there was a directory there /home/myuser (but not my symbolic link). How it was generated, I do not know. But I create a symbolic link .ssh inside, and now it works. But it makes me nervous, because I don't understand what is happening.

MSYS64 has huge advantages over cygwin. There is a package manager, it installs much faster, it is vastly smaller than cygwin. The compiler is newer.

There are still some problems with emacs and MSYS64 which I will ask in a separate question, but since it seems to work really well, the question is, can I afford to get rid of the other ones? I am looking into this to see whether I can ask students to install this for C++ and data structures classes, so I definitely want threading and compilation to work. The errors I can't resolve thus far include:

Is there a workaround for threading

  1. What is happening with /home/user? I made it work, but that could bite later on, it has to be understood.

  2. Are there any other compataibility issues lurking?

  3. The thread problem still appears to be there.

In summary, is there any way to use git in MSYS2, can I safely get rid of git and cygwin? Or will there be reasons to keep cygwin around? Do I have to keep git bash around separately?

Dov
  • 8,000
  • 8
  • 46
  • 75
  • I'd suggest drastically rewriting this question. Really you just want to know how to overcome a specific technical difficulty with git in MSYS2, but you waste a lot of time asking things that are broad and opinion-based, which are likely to get your question closed. – David Grayson Jan 25 '17 at 08:08
  • On second reading it sounds like you want to know if git works well in MSYS2. Yes, it does, and I rely on it every day. Git in MSYS2 won't be as fast as Git bash though. I'm sure you can figure out what is going on an alleviate your stress if you ask a few questions on the MSYS2 IRC channel. – David Grayson Jan 25 '17 at 08:18
  • In the past, I have mingw and cygwin. There were significant and weird problems due to the fact that mingw used native libraries from windows. long double would compile, but did not run. Threads did not work. I want to know, before deleting cygwin, whether further problems are in store, and whether there is a reason why cygwin is fundamentally better for unix compatability, or msys2 is an improvement. I am suspicious with good reason. – Dov Jan 25 '17 at 11:39

0 Answers0