sparklemotion / nokogiri.org

Documentation site for Nokogiri (a ruby library)
https://nokogiri.org/
MIT License
45 stars 24 forks source link

Document libxml2's problems with installing into directories with spaces. #42

Open flavorjones opened 4 years ago

flavorjones commented 4 years ago

This has been a challenge for years, with prior issues around including sparklemotion/nokogiri#1407, sparklemotion/nokogiri#1427, sparklemotion/nokogiri#1289, sparklemotion/nokogiri#1175, and sparklemotion/nokogiri#1891.

Here's what happens when you try to install libxml2 into a directory with spaces.

Running libxml2 `make install` failure with `PREFIX="${HOME}/tmp with spaces"`: ``` make install-recursive make[1]: Entering directory '/home/flavorjones/code/oss/libxml2' Making install in include make[2]: Entering directory '/home/flavorjones/code/oss/libxml2/include' Making install in libxml make[3]: Entering directory '/home/flavorjones/code/oss/libxml2/include/libxml' make[4]: Entering directory '/home/flavorjones/code/oss/libxml2/include/libxml' make[4]: Nothing to be done for 'install-exec-am'. /bin/mkdir -p '/home/flavorjones/tmp with spaces/include/libxml2/libxml' /usr/bin/install -c -m 644 SAX.h entities.h encoding.h parser.h parserInternals.h xmlerror.h HTMLparser.h HTMLtree.h debugXML.h tree.h list.h hash.h xpath.h xpathInternals.h xpointer.h xinclude.h xmlIO.h xmlmemory.h nanohttp.h nanoftp.h uri.h valid.h xlink.h xmlversion.h DOCBparser.h catalog.h threads.h globals.h c14n.h xmlautomata.h xmlregexp.h xmlmodule.h xmlschemas.h schemasInternals.h xmlschemastypes.h xmlstring.h xmlunicode.h xmlreader.h relaxng.h dict.h '/home/flavorjones/tmp with spaces/include/libxml2/libxml' /usr/bin/install -c -m 644 SAX2.h xmlexports.h xmlwriter.h chvalid.h pattern.h xmlsave.h schematron.h '/home/flavorjones/tmp with spaces/include/libxml2/libxml' make[4]: Leaving directory '/home/flavorjones/code/oss/libxml2/include/libxml' make[3]: Leaving directory '/home/flavorjones/code/oss/libxml2/include/libxml' make[3]: Entering directory '/home/flavorjones/code/oss/libxml2/include' make[4]: Entering directory '/home/flavorjones/code/oss/libxml2/include' make[4]: Nothing to be done for 'install-exec-am'. make[4]: Nothing to be done for 'install-data-am'. make[4]: Leaving directory '/home/flavorjones/code/oss/libxml2/include' make[3]: Leaving directory '/home/flavorjones/code/oss/libxml2/include' make[2]: Leaving directory '/home/flavorjones/code/oss/libxml2/include' Making install in . make[2]: Entering directory '/home/flavorjones/code/oss/libxml2' make[3]: Entering directory '/home/flavorjones/code/oss/libxml2' /bin/mkdir -p /home/flavorjones/tmp with spaces/share/doc/libxml2-2.9.10 /bin/mkdir -p '/home/flavorjones/tmp with spaces/bin' /bin/mkdir -p '/home/flavorjones/tmp with spaces/lib' /bin/mkdir -p '/home/flavorjones/tmp with spaces/lib/cmake/libxml2' /bin/mkdir -p '/home/flavorjones/tmp with spaces/share/aclocal' /usr/bin/install -c -m 0644 ./Copyright /home/flavorjones/tmp with spaces/share/doc/libxml2-2.9.10 /bin/mkdir -p '/home/flavorjones/tmp with spaces/lib/pkgconfig' /bin/mkdir -p '/home/flavorjones/tmp with spaces/share/man/man1' /usr/bin/install -c -m 644 xml2Conf.sh '/home/flavorjones/tmp with spaces/lib' /bin/mkdir -p '/home/flavorjones/tmp with spaces/share/man/man3' /usr/bin/install: omitting directory '/home/flavorjones/tmp' /usr/bin/install: omitting directory 'with' /usr/bin/install -c -m 644 libxml.m4 '/home/flavorjones/tmp with spaces/share/aclocal' make[3]: [Makefile:3128: install-data-local] Error 1 (ignored) /bin/mkdir -p /home/flavorjones/tmp with spaces/share/doc/libxml2-2.9.10/examples /usr/bin/install -c xml2-config '/home/flavorjones/tmp with spaces/bin' /usr/bin/install -c -m 644 libxml2-config.cmake '/home/flavorjones/tmp with spaces/lib/cmake/libxml2' /usr/bin/install -c -m 644 libxml-2.0.pc '/home/flavorjones/tmp with spaces/lib/pkgconfig' /bin/mkdir -p '/home/flavorjones/tmp with spaces/lib' /usr/bin/install -c -m 0644 ./xmllint.c /home/flavorjones/tmp with spaces/share/doc/libxml2-2.9.10/examples /bin/bash ./libtool --mode=install /usr/bin/install -c libxml2.la '/home/flavorjones/tmp with spaces/lib' /usr/bin/install -c -m 644 xml2-config.1 '/home/flavorjones/tmp with spaces/share/man/man1' /usr/bin/install: omitting directory '/home/flavorjones/tmp' /usr/bin/install: omitting directory 'with' /usr/bin/install -c -m 644 libxml.3 '/home/flavorjones/tmp with spaces/share/man/man3' make[3]: [Makefile:3130: install-data-local] Error 1 (ignored) /usr/bin/install -c -m 0644 ./testSAX.c /home/flavorjones/tmp with spaces/share/doc/libxml2-2.9.10/examples /usr/bin/install: omitting directory '/home/flavorjones/tmp' /usr/bin/install: omitting directory 'with' make[3]: [Makefile:3131: install-data-local] Error 1 (ignored) /usr/bin/install -c -m 0644 ./testHTML.c /home/flavorjones/tmp with spaces/share/doc/libxml2-2.9.10/examples /usr/bin/install: omitting directory '/home/flavorjones/tmp' /usr/bin/install: omitting directory 'with' make[3]: [Makefile:3132: install-data-local] Error 1 (ignored) /usr/bin/install -c -m 0644 ./testXPath.c /home/flavorjones/tmp with spaces/share/doc/libxml2-2.9.10/examples /usr/bin/install: omitting directory '/home/flavorjones/tmp' /usr/bin/install: omitting directory 'with' make[3]: [Makefile:3133: install-data-local] Error 1 (ignored) libtool: install: /usr/bin/install -c .libs/libxml2.so.2.9.10 /home/flavorjones/tmp with spaces/lib/libxml2.so.2.9.10 /usr/bin/install: target 'spaces/lib/libxml2.so.2.9.10' is not a directory make[3]: *** [Makefile:1017: install-libLTLIBRARIES] Error 1 make[3]: Leaving directory '/home/flavorjones/code/oss/libxml2' make[2]: *** [Makefile:1793: install-am] Error 2 make[2]: Leaving directory '/home/flavorjones/code/oss/libxml2' make[1]: *** [Makefile:1480: install-recursive] Error 1 make[1]: Leaving directory '/home/flavorjones/code/oss/libxml2' make: *** [Makefile:1787: install] Error 2 ```

At various points in time, there were issues with bundler and with mini_portile, but those have long been addressed and this issue remains with upstream libxml2.

This issue is to document the problem in a "known issues" section or something, so that in the future people won't have to open a github issue to learn that there's nothing we can easily do about this.

mycarrysun commented 4 years ago

Thanks for following up on sparklemotion/nokogiri#2062 - are we able to add something to the docs about this?

For my problem, the easiest solution was just to rename the path for XCode to something without spaces and then run

sudo xcode-select --switch /Applications/Xcode.app
flavorjones commented 4 years ago

@mycarrysun Thanks for closing the loop here! I'm glad you were able to solve your problem, and the specific command is super helpful (especially to me, a Linux user) and I'll include it in the docs update.

Normally here I'd try to pitch you on sending a PR to https://github.com/sparklemotion/nokogiri.org but I'm not super happy with the structure of the "Support" section and may just end up rewriting it on my day off.

flavorjones commented 4 years ago

Note to myself: the issue @mycarrysun reported in sparklemotion/nokogiri#2062 is distinct, but similar, to the issue in sparklemotion/nokogiri#1891 and others.

Ultimately, both are caused by the same root issue, which is that libxml2 and/or libxslt aren't thoroughly quoting commands and arguments in their Makefiles. But we should probably call them out separately in the docs.