I mean to create symbolic links in Msys2 from PortableApps, under Win 10
(I need portable applications to be able to carry the apps directory across systems), as I do in Linux.
For comparison, I will quote what I see with: 1) Msys2; and also other two options: 2) portable MobaXTerm (which is Cygwin based), 3) a (DOS) command prompt.
Msys2:
I get the error ln: failed to create symbolic link 'myfile': Operation not permitted
EDIT (I am not sure if there was any update in-between): now in Msys2 ln -s myfile does not report an error, but it copies the TARGET instead of creating a symbolic link. I do not know why the change in behavior, but this is also useless to me.
MobaXTerm:
I can do ln -s myfile with no problem.
But it is not a suitable workaround.
Command prompt:
mklink creates a symbolic link.
This might be a workaround, if I could launch it from msys2.
But it requires admin rights, or at least Developer mode, and I would need something without this requirement.
(I wonder what is MobaXTerm doing to overcome this requirement).
See this
(TBC: Windows explorer: did not test it).
Why the difference?
Is there a way to create symlinks in Msys2 (with no admin)? Perhaps by launching from msys2 a Cygwin process, which would of course require having some Cygwin application in the system (could the Cygwin dll alone be enouhg?)
Related:
https://github.com/msys2/MSYS2-packages/issues/249
https://sourceforge.net/p/msys2/tickets/41/
http://mingw.5.n7.nabble.com/symbolic-links-ln-s-command-td7159.html
https://www.joshkel.com/2018/01/18/symlinks-in-windows/
Related
Well the idea goes as followed,
I have a bash file for linux, there I obviously run it by making ./my_run.
The problem is I'm in windows so I downloaded and installed cygwin.
I added cygwin bin to the Enviromental Variables and check that at least "ls" works so I guessed I did it well.
When I try to run it with the cmd it displays:
'.' is not recognized as an internal or external command,
operable program or batch file.
As if the cygwin variables were not correctly installed (as I said I tried ls and works).
Then I tried it directly with cygwin and when doing the ./my_run I got it to work right.
So how is that I can use some commands like ls but when doing ./ it doesn't work on the cmd? How can I fix this?
Well, cygwin is only a shared library and a lot of stuff (the programs) using it (read Cygwin doc). cygwin.dll changes internally path resolution / chars to allow you to say ./my_script and converts it to .\my_script before doing the actual windows call, it also adds the proper extension to executables to allow it to execute windows binaries. This magic persists as long as you use it. cmd.exe is a Microsoft Windows command shell that is completely unaware of Cygwin's shared library and by that reason it doesn't use it, so it will not call it for path translation, even if you populate the environment of zetabytes of stuff. When you run in Cygwin terminal, you are running bash shell, which is a Cygwin executable, linked to cygwin.dll. It manages to use Cygwin library for all the unix system call emulations, so when you pass it e.g. to exec("./my_script", ...);, it internally converts that to try for ./my_script, then .\my_script, ./my_script.exe, ... and the same for .com and .bat extensions.
This fact often makes some people to say that Cygwin is not a good, efficient, environment. But the purpose was not to be efficient (and it is, as it caches entries and makes things best to be efficient) but to be compatible.
In your example ls is a Cygwin executable that mimics the /bin/ls executable from unix systems. It uses the Cygwin library, so all path resolution will be properly made (well, under some constraints, as you'll see after some testing) and everything will work fine. But you cannot pretend all your Windows applications to suddenly transform themselves and begin working as if they where in a different environment. This requires some try and error approach that you have to try yourself. And read Cygwin documentation, it is very good and covers everything I've said here.
If you open up Cygwin and run the command there you should be fine.
I want to disable cygwin temporarily without uninstalling it (e.g. for the duration of a batch script).
I was hoping there is a simple way, e.g. an environment variable like
$> SET cygwin=OFF
or an internal cygwin command like
$> cygset off
Right now I am using a quick and dirty solution that simply invalidates the cygwin directory in the Windows path with
SET PATH=%PATH:Cygwin=%
Of course this will also corrupt other pathes that have Cygwin in it.
I remember that when I first installed cygwin I could open files form my home directory using Windows applications. For example, I had Emacs installed in Windows and I could just do runemacs ~/some_file.txt. I had run out of space and had to move my cygwin installation to a different drive. Ever since then, I seem to have mucked up my installation and I can't use Windows applications like this anymore.
I have removed cygwin completely and re-installed it in C:\cygwin as before, but the problem remains.
I see that for some reason ~ gets expanded to C:\home\Tudor instead of C:\cygwin\home\Tudor.
Does anyone know how I could get this to work again?
Non-Cygwin Windows applications are not aware of your Cygwin root or home directory.
Emacs is a special case. It was originally developed on UNIX, and it uses UNIX-like syntax for some things.
According to your latest comment, Emacs expands ~ to C:\Users\Tudor. That's your Windows home directory, not your Cygwin home directory.
You can also install a Cygwin version of Emacs, which, like any Cygwin application, will expand ~ to your Cygwin home directory.
If you invoke a Windows application from a Cygwin shell, then the shell, not the Windows application, will expand ~ to your Cygwin home directory, expressed in Cgywin syntax. For example, assuming runemacs is a non-Cygwin application, if I run:
bash$ runemacs ~
then the shell expands the ~, so it's equivalent to (assuming my user name is Tudor):
bash$ runemacs /home/Tudor
runemacs will probably treat /home/Tudor as equivalent to \home\Tudor, which would be equivalent to C:\home\Tudor if the current drive is C:.
If you type Ctrl-X Ctrl-F from within Emacs to open a file, then Emacs will interpret ~ according to whatever rules it follows internally; those rules aren't likely to recognize Cygwin unless you're running a Cygwin version of Emacs or Emacs itself has some special-case code to handle Cygwin paths.
I am new to using make files. I have cygwin and MinGW. I'm still looking into their differences.
Anyway, I have a makefile that is used to create a project for an FPGA, which I have never done before. I have included C:\cygwin\bin and C:\MinGW\msys\1.0\bin in my PATH, but I always get this error.
make: pwd: Command not found
I typed pwd into the cmd prompt and get a correct response. Any pointers? Am I missing something? Not sure what else I can try. Most forums I have found pertaining to this error never have a resolution.
Let me know what information you'd like.
pwd is commonly both a shell built-in command and a standalone executable, provided by GNU coreutils (which Cygwin installs by default).
If you're invoking make from the Cygwin environment (say, typing make at a bash shell prompt), then C:\cygwin\bin is the wrong way to specify the directory. That's the path as seen from Windows. From within Cygwin, it's /bin -- and it should be in your default $PATH. The Cygwin equivalent of C:\MinGW\msys\1.0\bin would be /cygdrive/c/mingw/msys/1.0/bin
If you're doing this directly from Windows rather than in the Cygwin subsystem, then C:\cygwin\bin is the path to the Cygwin bin directory -- but running C:\cygwin\bin\pwd is going to give you a Cygwin-specific directory name that's not going to be meaningful to Windows.
I have encountered the same issue in my mingw environment. It turned out in my case to be a missing 'pwd'executable in the msys/bin directory. Once the copying was done properly, everything fell into place. Hope this helps
Whenever I try to run my .exe cobol file, i get this error..
fileName.exe Entry Point Not Found
The procedure entry point_impure_ptr could not be located in the dynamic link library cygwin1.dll
I am using OpenCObol and cygwin ver1.7.15.thanks
You'll need to specify the proper path for the command below, but Cygwin seems pretty persnickety with entry point addresses and updates, The system includes a rebaseall command to help fix this problem. Most times I've witnessed it is after a setup.exe pass, while the Cygwin system was still active (and perhaps only in the background and not visible).
C:\Users\btiffin\cygwin\bin\dash -c '/usr/bin/rebaseall'
Run that from a Windows CMD shell (while Cygwin isn't active, say after a clean boot and before running the Cygwin shell. Basically cygwin1.dll can't be open). You'll need to use the proper Windows path to dash for your particular install. Google Cygwin rebase for detailed articles.
I had a similar error message after upgrading from cygwin version 1.5 to 1.7. I solved it by completely removing and reinstalling 1.7 from scratch. I was told there might have been a problem with multiple versions of dlls.