Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

facepalm: install fails because $(PREFIX)/lib already exists #2727

Closed
sgbeal opened this issue Nov 12, 2018 · 13 comments · Fixed by #2728
Closed

facepalm: install fails because $(PREFIX)/lib already exists #2727

sgbeal opened this issue Nov 12, 2018 · 13 comments · Fixed by #2728

Comments

@sgbeal
Copy link

sgbeal commented Nov 12, 2018

install fails because $(PREFIX)/lib already exists

[stephan@host:~/cvs/libsass]$ m install PREFIX=$HOME
mkdir /home/stephan/lib
mkdir: cannot create directory ‘/home/stephan/lib’: File exists
Makefile:263: recipe for target '/home/stephan/lib' failed
make: *** [/home/stephan/lib] Error 1

The fix is trivial: use mkdir -p instead of mkdir.

This is the same as #1992, but that ticket is inexplicably closed.

PS: when trying to use the autotools-generated build, by running autoconf to convert configure.ac to configure, the resulting ./configure fails because:

[stephan@host:~/cvs/libsass]$ ./configure --prefix=$HOME
configure: error: cannot find install-sh, install.sh, or shtool in script "."/script

Thus i'm using the makefile which is checked in to the tree, rather than the one generated by autotools (a.k.a. GNU "Auto, my ass!" Tools).

@xzyfer
Copy link
Contributor

xzyfer commented Nov 12, 2018 via email

@sgbeal
Copy link
Author

sgbeal commented Nov 12, 2018

Certainly mkdir -p is more portable than simply failing to install on any platform at all?

@sgbeal
Copy link
Author

sgbeal commented Nov 12, 2018

Here's a portable solution, taken from the autotools manual:

From the libsass checkout:

autoreconf --install
...
configure.ac:15: installing 'script/install-sh'
...
[stephan@host:~/cvs/libsass]$ l ./script/install-sh
-rwxr-xr-x 1 stephan stephan 15155 Nov 12 10:07 ./script/install-sh

That install script is as portable as it gets. (Simply throw away all of the autoreconf output aside from that file, then check that file in.)

Funnily enough, it uses mkdir -p (which is apparently specified by POSIX mkdir), but it also works around various portability problems.

@sgbeal
Copy link
Author

sgbeal commented Nov 12, 2018

Apropos portability: the source code uses C++0x, which means it's compiling on a relatively recent platform (less than 10 years old). i'd bet my left testicle that all such platforms support mkdir -p.

@xzyfer
Copy link
Contributor

xzyfer commented Nov 12, 2018 via email

@glebm
Copy link
Contributor

glebm commented Nov 12, 2018

@xzyfer Can you please link to the closed issue? #1992 doesn't discuss it.

I'd like to read the discussion to understand the claims of non-portability, because mkdir -p support is a POSIX requirement: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/mkdir.html

@sgbeal
Copy link
Author

sgbeal commented Nov 12, 2018

What perceived limitation is not addressed by using the install script generated by autoconf (demonstrated 4 comments up from here)? This project uses the autotools, and is thereby limited in portability to platforms that toolset supports. Using autotool's install script is therefore the most natural and portable solution for all platforms the project can be built on using the provided makefiles.

@glebm
Copy link
Contributor

glebm commented Nov 12, 2018

@sgbeal While I still can't find the issue, looking further at the Makefile, it appears to support Windows. On Windows, mkdir is an alias for md, which does not support -p.

Perhaps send a PR that sets MKDIR differently on Windows vs non-Windows?

@xzyfer
Copy link
Contributor

xzyfer commented Nov 12, 2018

Plenty details below. I'm not well versed on the problem but I've seen it come up over and over again.

#795 (comment)
#2486
#2109
#1433
#1365 (comment)

@sgbeal
Copy link
Author

sgbeal commented Nov 12, 2018

@glebm what's a "Windows"?

The build uses the autotools and it "really should" use the install-sh which is distributed with autotools. If that installer is not portable enough then using the autotools is a lost cause.

@glebm
Copy link
Contributor

glebm commented Nov 12, 2018

@sgbeal The checked in Makefile is not generated by autotools. It's an alternative way to build for when autotools may not be available (e.g. when compiling this for a C extension for Ruby or Python).

"Windows" in this case is when you have e.g. gcc and gmake but are running it from CMD (as opposed to e.g. Cygwin Bash or a similar POSIX environment).

Regardless, I think my #2728 PR resolves this issue, as with that PR make should no longer attempt to create directories that already exist.

@glebm
Copy link
Contributor

glebm commented Nov 12, 2018

@xzyfer Thanks! Looks like I guessed right that this is specifically about Windows compatibility. Sent #2728 which should simply prevent make from trying to create directories that already exist.

@sgbeal
Copy link
Author

sgbeal commented Nov 12, 2018

@glebm my sincere apologies: 'what's a "Windows"' was intended facetiously (Windows hasn't been a thing in my household since last millennium), not as as an honest question, and that has no place in this forum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants