universal-ctags/homebrew-universal-ctags

Missing manpage(s) by installation with homebrew

kiryph opened this issue · 16 comments

When I install universal-ctags with

❯ brew install universal-ctags --HEAD

I get only following files

❯ brew list universal-ctags
/usr/local/Cellar/universal-ctags/HEAD-3edfba8/bin/ctags
/usr/local/Cellar/universal-ctags/HEAD-3edfba8/bin/readtags

However, I would like to have the manpages available.

Hi @kiryph ,

You can check it.

> brew info universal-ctags

Hi @KazuakiM,
thanks for the quick response. However, I think I don't understand what you mean. I was referring to the files in https://github.com/universal-ctags/ctags/tree/master/man which apparently are not installed by default. There is also no compile option for installing the manpages as well which usually are listed by brew info universal-ctags. Did I miss something?

Just to make sure: the comment shown by brew info universal-ctags says something about a manpage of emacs:

Under some circumstances, emacs and ctags can conflict. By default,
emacs provides an executable ctags that would conflict with the
executable of the same name that ctags provides. To prevent this,
Homebrew removes the emacs ctags and its manpage before linking.

However, that does not mean a manpage of universal-ctags is installed. See also the output of the tree command (no symlinking issue, the files are simply not there)

❯ tree /usr/local/Cellar/universal-ctags/HEAD-3edfba8
/usr/local/Cellar/universal-ctags/HEAD-3edfba8
├── COPYING
├── INSTALL_RECEIPT.json
├── README.md
└── bin
    ├── ctags
    └── readtags

1 directory, 5 files

Hi @kiryph

sorry, I was misunderstanding.
I think that it is especially unnecessary. In my case I can see without any problems.

$ which ctags
/usr/local/bin/ctags
$ ctags --help
Universal Ctags 0.0.0(1c8b98dd), Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Aug 27 2017, 10:57:58
  URL: https://ctags.io/
  Optional compiled features: +wildcards, +regex, +multibyte, +option-directory, +xpath, +case-insensitive-filenames

Usage: ctags [options] [file(s)]

  -a   Append the tags to an existing tag file.
...

I would like to know the ORIGINAL result of

$ which ctags
$ ctags --help

The results are

❯ which -a ctags
/usr/local/bin/ctags
/usr/bin/ctags

and

❯ ctags --help
Universal Ctags 0.0.0(3edfba8d), Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Sep 29 2017, 14:28:02
  URL: https://ctags.io/
  Optional compiled features: +wildcards, +regex, +multibyte, +option-directory, +xpath, +case-insensitive-filenames

Usage: ctags [options] [file(s)]

  -a   Append the tags to an existing tag file.
  ...

BTW:

❯ man ctags

works. However, it shows me the manpage of the BSD version of ctags which is preinstalled under macOS.

I see too.
I'll need a little more time to think about this.

Hi @kiryph

You should install rst2man and I would like to know the result of

> brew install --HEAD --env=std universal-ctags/universal-ctags/universal-ctags
> man ctags

link

https://github.com/universal-ctags/ctags#manual

Yes, installing rst2man.py which is part of the package docutils helped. However, brew uses an adjusted $PATH environment variable during installation. Most importantly it does not contain /usr/local/bin where rst2man.py is linked. You can check this by adding --interactive and echo $PATH:

~
❯ brew reinstall --HEAD --interactive universal-ctags/universal-ctags/universal-ctags
/private/tmp/universal-ctags-20171001-93976-xn39cf master*
❯ rst2man.py
zsh: command not found: rst2man.py
❯ echo $PATH
/usr/local/sbin
/usr/local/Homebrew/Library/Homebrew/shims/super
/usr/local/opt/autoconf/bin
/usr/local/opt/automake/bin
/usr/local/opt/pkg-config/bin
/usr/local/opt/git/bin
/usr/bin
/bin
/usr/sbin
/sbin

Also trying to run rst2man.py in this special shell returns command not found. This can be fixed by adding docutils to the build dependencies of universal-ctags

❯ git diff
diff --git a/universal-ctags.rb b/universal-ctags.rb
index 59573a9..349cf02 100644
--- a/universal-ctags.rb
+++ b/universal-ctags.rb
@@ -5,6 +5,7 @@ class UniversalCtags < Formula
   depends_on "autoconf" => :build
   depends_on "automake" => :build
   depends_on "pkg-config" => :build
+  depends_on "docutils" => :recommended
   conflicts_with "ctags", :because => "this formula installs the same executable as the ctags formula"

   def install

By adding depends_on "docutils" => :recommended the temporary $PATH variable contains following additional path:

/usr/local/opt/docutils/bin

A minor thing would be to adjust the brew info output to explain better what the optional build dependency docutils is for. Right now, the auto-generated text looks like

❯ brew info universal-ctags
universal-ctags/universal-ctags/universal-ctags: HEAD
Maintained ctags implementation
https://github.com/universal-ctags/ctags
Conflicts with:
  ctags (because this formula installs the same executable as the ctags formula)
/usr/local/Cellar/universal-ctags/HEAD-d9d7aa7 (9 files, 779.6KB) *
  Built from source on 2017-10-01 at 09:19:57
From: https://github.com/universal-ctags/homebrew-universal-ctags/blob/master/universal-ctags.rb
==> Dependencies
Build: autoconf ✔, automake ✔, pkg-config ✔
Recommended: docutils ✔
==> Requirements
Build: git ✔
==> Options
--without-docutils
	Build without docutils support
--HEAD
	Install HEAD version
==> Caveats
...

Something like

--without-manpage
    Install without manpages which means docutils is not required for installation.

According to https://docs.brew.sh/Formula-Cookbook.html this can be achieved with

option "with-foo", "Compile with foo bindings" # This overrides the generated description if you want to
depends_on "foo" => :optional # Generated description is "Build with foo support"

Thanks for your help!

Hi @kiryph

Yes. This issue is $PATH was losted during installation.
So I suggest you add --env=std options.
I solved this issue. Would you try it again.

brew install --HEAD --env=std universal-ctags/universal-ctags/universal-ctags

And I think docutils is should installed by pip.

First of all, my above mentioned modification to the universal-ctags homebrew formula resolved the issue for me. docutils have been installed via brew by declaring docutils as a recommended dependency for universal-ctags. The manpages are now available and are not missing anymore:

❯ tree /usr/local/Cellar/universal-ctags/HEAD-d9d7aa7
/usr/local/Cellar/universal-ctags/HEAD-d9d7aa7
├── COPYING
├── INSTALL_RECEIPT.json
├── README.md
├── bin
│   ├── ctags
│   └── readtags
└── share
    └── man
        ├── man1
        │   └── ctags.1
        └── man7
            ├── ctags-incompatibilities.7
            └── ctags-optlib.7
❯ man ctags<Tab>
 -- manual page, section 1 --
ctags
 -- manual page, section 7 --
ctags-incompatibilities  ctags-optlib

However, I would be happy to help to figure out a good solution following common practices to improve the out-of-box experience. IMHO this means either manpages are always installed by default or user gets feedback that docutils are not found and therefore no manpages will be installed.

Personally, I like the soft dependency within homebrew. However, maybe declaring docutils as a :build dependency would be more suitable. I am not sure about how homebrew handles the combination of both [:build, :recommended].

And I think docutils is should installed by pip.

Another possibility is as you suggested installing docutils via pip. I think in this case adding a note to the brew info message of universal-ctags would be helpful. However, it would be even greater if the installation could also return a message if docutils is not available and would not silently omitting to install the manpages. This requires a change in the installation files of universal-ctags which would print this message.

I am not sure what is recommended: whether docutils should be installed via homebrew or pip.

There is a dedicated webpage of the homebrew documentation for python formulas https://docs.brew.sh/Python-for-Formula-Authors.html. Following paragraph might be relevant:

Homebrew is happy to accept applications that are built in Python, whether the apps are available from PyPI or not. Homebrew generally won’t accept libraries that can be installed correctly with pip install foo. Bindings may be installed for packages that provide them, especially if equivalent functionality isn’t available through pip.

As far as I understand this, docutils is a valid homebrew package and is not required to be installed via pip in contrast to python libs/modules. So I think it is safe to rely on the homebrew formula for docutils.


And finally regarding your request:

So I suggest you add --env=std options.
I solved this issue. Would you try it again.

Unfortunately, installing with --env=std does not work on my machine

❯ brew reinstall universal-ctags --HEAD --env=std
==> Reinstalling universal-ctags/universal-ctags/universal-ctags
==> Cloning https://github.com/universal-ctags/ctags.git
Updating /Users/kiryph/Library/Caches/Homebrew/universal-ctags--git
==> Checking out branch master
==> ./autogen.sh
==> ./configure --prefix=/usr/local/Cellar/universal-ctags/HEAD-d9d7aa7
==> make
Last 15 lines from /Users/kiryph/Library/Logs/Homebrew/universal-ctags/03.make:
make[1]: *** [parsers/ctags-svg.o] Error 1
make[1]: *** [parsers/ctags-glade.o] Error 1
make[1]: *** [parsers/ctags-xslt.o] Error 1
make[1]: *** [parsers/ctags-relaxng.o] Error 1
make[1]: *** [parsers/ctags-dbusintrospect.o] Error 1
make[1]: *** [parsers/ctags-maven2.o] Error 1
In file included from main/debug.c:22:
In file included from ./main/options.h:28:
In file included from ./main/parse.h:22:
./main/lxpath.h:17:10: fatal error: 'libxml/xpath.h' file not found
#include <libxml/xpath.h>
         ^~~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [main/ctags-debug.o] Error 1
make: *** [all] Error 2

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/universal-ctags/homebrew-universal-ctags/issues

Hi @kiryph

Thank you for your feedback and links!
I think it's OK to support docutils as well too.

But I think [:build, :optional] is better than [:build, :recommended].
If there were docutils, manpages could be supported at universal-ctags.
Please make a pull request if you don't mind.

https://github.com/universal-ctags/ctags/blob/master/configure.ac#L291

And libxml2 is installed at my environment, sorry.

Unfortunately, installing with --env=std does not work on my machine

(If the build-system of u-ctags itself should be fixed, tell me.
The error about libxml2 looks strange for me.)

I tried to understand the libxml2 error better.

Update please do not forget that it works without using the option --env=std.

Homebrew about libxml2:

❯ brew info libxml2
libxml2: stable 2.9.5 (bottled), HEAD [keg-only]
GNOME XML library
http://xmlsoft.org
/usr/local/Cellar/libxml2/2.9.5 (281 files, 10.4MB)
  Poured from bottle on 2017-10-02 at 17:48:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/libxml2.rb
==> Dependencies
Build: autoconf ✔, automake ✔, libtool ✔, pkg-config ✔
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/libxml2/bin:$PATH"' >> ~/.zshrc

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/libxml2/lib
    CPPFLAGS: -I/usr/local/opt/libxml2/include
For pkg-config to find this software you may need to set:
    PKG_CONFIG_PATH: /usr/local/opt/libxml2/lib/pkgconfig


If you need Python to find bindings for this keg-only formula, run:
  echo /usr/local/opt/libxml2/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/libxml2.pth
  mkdir -p /Users/holger/Library/Python/2.7/lib/python/site-packages
  echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/holger/Library/Python/2.7/lib/python/site-packages/homebrew.pth

I hope I got following things right:

libxml2 is part of the underlying Darwin source code of macOS:
https://opensource.apple.com/source/libxml2/libxml2-30.17/

However, by default only the shared compiled library and not the header files are available:

/usr/lib/libxml2.dylib

No libxml files in

/usr/include
/usr/local/include

If a user installs Xcode, the header files will be available within the Xcode.app:

❯ tree 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2
└── libxml
    ├── DOCBparser.h
    ├── HTMLparser.h
    ├── HTMLtree.h
    ├── SAX.h
    ├── SAX2.h
    ├── c14n.h
    ├── catalog.h
    ├── chvalid.h
    ├── debugXML.h
    ├── dict.h
    ├── encoding.h
    ├── entities.h
    ├── globals.h
    ├── hash.h
    ├── list.h
    ├── nanoftp.h
    ├── nanohttp.h
    ├── parser.h
    ├── parserInternals.h
    ├── pattern.h
    ├── relaxng.h
    ├── schemasInternals.h
    ├── schematron.h
    ├── threads.h
    ├── tree.h
    ├── uri.h
    ├── valid.h
    ├── xinclude.h
    ├── xlink.h
    ├── xmlIO.h
    ├── xmlautomata.h
    ├── xmlerror.h
    ├── xmlexports.h
    ├── xmlmemory.h
    ├── xmlmodule.h
    ├── xmlreader.h
    ├── xmlregexp.h
    ├── xmlsave.h
    ├── xmlschemas.h
    ├── xmlschemastypes.h
    ├── xmlstring.h
    ├── xmlunicode.h
    ├── xmlversion.h
    ├── xmlwriter.h
    ├── xpath.h
    ├── xpathInternals.h
    └── xpointer.h

So I guess, the current build system of universal-ctags does not find them correctly. It relies on pkg-config installed by homebrew and this does not detect the correct library path

pkg-config --libs --cflags libxml-2.0
-I/usr/include/libxml2 -lxml2
❯ cat /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.12/libxml-2.0.pc
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
modules=1

Name: libXML
Version: 2.9.4
Description: libXML library version2.
Requires:
Libs: -L${libdir} -lxml2
Libs.private: -lpthread -lz  -lm
Cflags: -I${includedir}/libxml2

This has been reported in Homebrew/homebrew-core#6186.

CMake

The cmake tool works here better. Consider following minimal example which compiles correctly:
/Users/kiryph/CMakeLists.txt:

cmake_minimum_required (VERSION 3.9.3)
project (hello)

find_package(LibXml2 REQUIRED)
include_directories(${LIBXML2_INCLUDE_DIR})
set(LIBS ${LIBS} ${LIBXML2_LIBRARIES})
add_executable (helloDemo main.c)
target_link_libraries(helloDemo ${LIBXML2_LIBRARIES})

get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
foreach(dir ${dirs})
  message(STATUS "dir='${dir}'")
endforeach()

/Users/kiryph/main.c:

#include <stdlib.h>
#include <libxml/xpath.h>

int main() {
  printf("Hello, world!");
  return 0;
}

Compiling:

❯ cmake .
-- The C compiler identification is AppleClang 9.0.0.9000037
-- The CXX compiler identification is AppleClang 9.0.0.9000037
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found LibXml2: /usr/lib/libxml2.dylib (found version "2.9.2")
-- dir='/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2'
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/kiryph
❯ make
Scanning dependencies of target helloDemo
[ 50%] Building C object CMakeFiles/helloDemo.dir/main.c.o
[100%] Linking C executable helloDemo
[100%] Built target helloDemo

❯ env

A comparison of environment variables shown with command env at the interactive prompts of

❯ brew reinstall universal-ctags --HEAD  --interactive

and

❯ brew reinstall universal-ctags --HEAD  --interactive --env=std

The diff (without the PATH variable)

❯ diff env-superenv.txt env-std.txt
46c46
< PWD=/private/tmp/universal-ctags-20171002-89452-vro9k4
---
> PWD=/private/tmp/universal-ctags-20171002-88895-98czct
65c65
< LC_CTYPE=UTF-8
---
> LC_CTYPE=C
76,82c76,77
< HOMEBREW_ERROR_PIPE=/tmp/homebrew20171002-89308-1f38u8d/socket
< OBJC=clang
< CC=clang
< HOMEBREW_CC=clang
< OBJCXX=clang++
< CXX=clang++
< HOMEBREW_CXX=clang++
---
> HOMEBREW_ERROR_PIPE=/tmp/homebrew20171002-88760-1qffp74/socket
> PKG_CONFIG_LIBDIR=/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.12:/usr/lib/pkgconfig
84,101c79,89
< PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.12
< HOMEBREW_CCCFG=sa
< HOMEBREW_OPTIMIZATION_LEVEL=Os
< HOMEBREW_OPT=/usr/local/opt
< HOMEBREW_TEMP=/tmp
< HOMEBREW_OPTFLAGS=-march=native
< HOMEBREW_ARCHFLAGS=
< CMAKE_PREFIX_PATH=/usr/local
< CMAKE_FRAMEWORK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks
< CMAKE_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/apache2:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
< CMAKE_LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
< ACLOCAL_PATH=/usr/local/share/aclocal
< M4=/usr/bin/m4
< HOMEBREW_ISYSTEM_PATHS=/usr/local/include:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/apache2:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
< HOMEBREW_LIBRARY_PATHS=/usr/local/lib:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
< HOMEBREW_DEPENDENCIES=autoconf,automake,pkg-config,docutils,git
< HOMEBREW_FORMULA_PREFIX=/usr/local/Cellar/universal-ctags/HEAD-d9d7aa7
< HOMEBREW_SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
---
> CPPFLAGS=-F/usr/local/Frameworks -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
> LDFLAGS=-L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
> CMAKE_FRAMEWORK_PATH=/usr/local/Frameworks:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks
> CFLAGS=-Os -w -pipe -march=native -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
> CXXFLAGS=-Os -w -pipe -march=native -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
> OBJCFLAGS=-Os -w -pipe -march=native -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
> OBJCXXFLAGS=-Os -w -pipe -march=native -mmacosx-version-min=10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
> OBJC=/usr/bin/clang
> CC=/usr/bin/clang
> OBJCXX=/usr/bin/clang++
> CXX=/usr/bin/clang++
102a91
> CPATH=/usr/local/include:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include
104,108c93
< ac_cv_func_fmemopen=no
< ac_cv_func_futimens=no
< ac_cv_func_open_memstream=no
< ac_cv_func_utimensat=no
< HOMEBREW_PREFER_CLT_PROXIES=1
---
> CMAKE_PREFIX_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr
111a97
> HOMEBREW_FORMULA_PREFIX=/usr/local/Cellar/universal-ctags/HEAD-d9d7aa7
114c100
< OLDPWD=/private/tmp/universal-ctags-20171002-89452-vro9k4
---
> OLDPWD=/private/tmp/universal-ctags-20171002-88895-98czct

A search for libxml2 shows, that the superenv adds the path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2 to CMAKE_INCLUDE_PATH and HOMEBREW_ISYSTEM_PATHS.


❯ clang -x c -v -E /dev/null vs ❯ /usr/bin/clang -x c -v -E /dev/null

Another interesting comparison is running at the same interactive prompt of brew reinstall universal-ctags --HEAD --interactive:

/private/tmp/universal-ctags-20171002-91970-1u0pnut master*
❯ clang  -x c -v -E /dev/null
Apple LLVM version 9.0.0 (clang-900.0.37)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -E -disable-free -disable-llvm-verifier -discard-value-names -main-file-name null -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 302.3 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -isystem /usr/local/include -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2 -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/apache2 -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers -fdebug-compilation-dir /private/tmp/universal-ctags-20171002-91970-1u0pnut -ferror-limit 19 -fmessage-length 133 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o - -x c /dev/null
clang -cc1 version 9.0.0 (clang-900.0.37) default target x86_64-apple-darwin16.7.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/apache2
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks (framework directory)
End of search list.
# 1 "/dev/null"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 331 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "/dev/null" 2

and

/private/tmp/universal-ctags-20171002-91970-1u0pnut master*
❯ /usr/bin/clang  -x c -v -E /dev/null
Apple LLVM version 9.0.0 (clang-900.0.37)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -E -disable-free -disable-llvm-verifier -discard-value-names -main-file-name null -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 302.3 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -fdebug-compilation-dir /private/tmp/universal-ctags-20171002-91970-1u0pnut -ferror-limit 19 -fmessage-length 133 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o - -x c /dev/null
clang -cc1 version 9.0.0 (clang-900.0.37) default target x86_64-apple-darwin16.7.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks (framework directory)
End of search list.
# 1 "/dev/null"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 331 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "/dev/null" 2

Running clang without specifying the absolute path picks up additional paths:

 /usr/local/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/apache2
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers

Install Xcode Commandline Tools to use --env=std

If someone wants to install with --env=std, he should install the xcode commandline tools with xcode-select --install which are called Xcode Commandline Tools (CLT). This places libxml2 header files in /usr/include/!

If pkg-config should be adjusted to find files within the Xcode.app (e.g. /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2) is out of my realm. I consider the libxml2 error resolved for me.

@KazuakiM

But I think [:build, :optional] is better than [:build, :recommended].
If there were docutils, manpages could be supported at universal-ctags.
Please make a pull request if you don't mind.

I leave the pull request/commit up to you: This should be only a one-liner or a two-liner in case you want to adjust the message.

Hi @kiryph
Thank you very much!