0

I have built a library with this command:

$ ../configure '--host=x86_64-w64-mingw32' --prefix=/usr/x86_64-w64-mingw32/sys-root/mingw && make && make install

Installation fails because apparently there is no permission to create files in mingw sysroot:

$ mkdir /usr/x86_64-w64-mingw32/sys-root/mingw/share/whatever
mkdir: cannot create directory
‘/usr/x86_64-w64-mingw32/sys-root/mingw/share/whatever’: Permission
denied

What's the problem and how can I solve it in most straightforward way?

  • I don't have access to my Cygwin or MinGW environment at the moment, so this is just a comment: To install something in a system path where no ordinary user has write permissions, you will have to be root. If sudo is available, you may perform the installation step with sudo make install. – Kusalananda Feb 5 '18 at 9:27
  • @Kusalananda there is no sudo in cygwin, every user is root I guess. This does not make it more clear I guess. – Pyotr B. Feb 5 '18 at 9:28
  • 1
    @Kusalananda trying priveleged cygwin run right now though, totally forgot about that. – Pyotr B. Feb 5 '18 at 9:32
  • Question related to sudo on Cygwin over at StackOverflow: stackoverflow.com/questions/4090301/… – Kusalananda Feb 5 '18 at 9:32
  • @Kusalananda that was helpful but not in my case, make install was acting erratically plus it was running in separate window of CMD instead of mintty. The most universal solution is to start cygwin shell with escalated priveleges itself. – Pyotr B. Feb 5 '18 at 9:46
1

There is no sudo in Cygwin. Other sources sugest using

cygstart --action=runas command args

that was helpful but not in my case, make install was acting erratically because directory is not passed to the started process (it's a problem with cygstart) plus it was running in separate window of CMD instead of mintty. The most universal solution is to start Cygwin shell with escalated priveleges itself (you can redirect the output of the escalated command this way only):

cygstart --action=runas mintty -

but you stil need to navigate back to the directory where you wanted to execute command from.

I also found -d switch for cygstart which makes the command even worse:

#su analog
    cygstart --action=runas -d "$(pwd)" mintty -
#sudo analog
    cygstart --action=runas -d "$(pwd)" mintty command args

It could be the best solution but mintty does not pass directory EITHER without separate switch and it does not pass working directory to shell (mintty -).

So the final version of sudo is:

#new mintty window
    cygstart --action=runas mintty -dir "$(pwd)" command args
#new CMD window
    cygstart --action=runas -d "$(pwd)" command args

and I could not find a good way of starting shell in arbitrary working directory.

0

Don't just run as root: su, sudo, runas, it will work but leave problem for the future (there is a reason that these files/directories are protected).

There is a place set aside for you to install your own programs.

/usr/local

Putting it there makes it easier to upgrade your system, without loosing your program.

Even better, also use stow. It will keep your program separate form everything else, and use syslinks to patch it in. It will keep track of thinks so that it is easy to remove or upgrade.

  • This is not completey related but informative. There is no sudo in Cygwin though. – Pyotr B. Feb 5 '18 at 9:59
  • There is also no /usr in Cygwin's MinGW sysroot as I learned now. – Pyotr B. Feb 5 '18 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.