universal-ctags / homebrew-universal-ctags

Homebrew Tap for Universal Ctags on OSX
https://ctags.io
GNU General Public License v2.0
326 stars 19 forks source link

Make fails #37

Closed fakiyer closed 6 years ago

fakiyer commented 6 years ago

Attempting to run brew install --HEAD universal-ctags/universal-ctags/universal-ctags on OS X 10.13.6 results in an error 2 from Make.

~ » brew install --HEAD universal-ctags/universal-ctags/universal-ctags                                                                                                               fakiyer@MacBook-Pro
==> Installing universal-ctags from universal-ctags/universal-ctags
==> Cloning https://github.com/universal-ctags/ctags.git
Updating /Users/fakiyer/Library/Caches/Homebrew/universal-ctags--git
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
HEAD is now at e65e91a Merge pull request #1808 from p-vitt/fortran-protected
==> Downloading https://files.pythonhosted.org/packages/84/f4/5771e41fdf52aabebbadecc9381d11dea0fa34e4759b4071244fa094804c/docutils-0.14.tar.gz
Already downloaded: /Users/fakiyer/Library/Caches/Homebrew/universal-ctags--docutils-0.14.tar.gz
==> python -c import setuptools... --no-user-cfg install --prefix=/usr/local/Cellar/universal-ctags/HEAD-e65e91a/libexec/vendor --single-version-externally-managed --record=installed.txt
==> ./autogen.sh
==> ./configure --prefix=/usr/local/Cellar/universal-ctags/HEAD-e65e91a
==> make
Last 15 lines from /Users/fakiyer/Library/Logs/Homebrew/universal-ctags/04.make:
extern void error (const errorSelection selection, const char *const format, ...) CTAGS_ATTR_PRINTF (2, 3);
            ^
main/entry.c:359:32: error: use of undeclared identifier 'ENOENT'
        if (mio == NULL  &&  errno == ENOENT)
                                      ^
main/entry.c:584:61: error: use of undeclared identifier 'errno'; did you mean 'error'?
                fprintf (stderr, "Cannot shorten tag file: errno = %d\n", errno);
                                                                          ^~~~~
                                                                          error
./main/routines.h:97:13: note: 'error' declared here
extern void error (const errorSelection selection, const char *const format, ...) CTAGS_ATTR_PRINTF (2, 3);
            ^
3 errors generated.
make[1]: *** [main/ctags-entry.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
~ » brew config                                                                                                                                                                       fakiyer@MacBook-Pro
HOMEBREW_VERSION: 1.7.1
ORIGIN: https://github.com/Homebrew/brew
HEAD: d6a245c05110c240e680da594c2cc6038998b82e
Last commit: 10 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 814e305fd48451179adce70b5683e9d9f67ed911
Core tap last commit: 3 hours ago
HOMEBREW_PREFIX: /usr/local
CPU: octa-core 64-bit kabylake
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 9.1 build 902
Git: 2.18.0 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 1.8.0_60
macOS: 10.13.6-x86_64
CLT: 10.0.0.0.1.1532783626
Xcode: 9.4.1
XQuartz: N/A
KazuakiM commented 6 years ago

Hi, @fakiyer Can you put the results to the gist?

brew install --verbose  --HEAD universal-ctags/universal-ctags/universal-ctags
fakiyer commented 6 years ago

Hi, @KazuakiM OK. Here are results:

https://gist.github.com/fakiyer/3a32c1c69a2c1f6226658adb1eacc8d9

KazuakiM commented 6 years ago

@masatake Do you have any solutions?

masatake commented 6 years ago

Looks very strange. Maybe a broken errno.h file is installed to @fakiyer's environment and oru build-sys includes it.

What we expect as errno.h may be https://github.com/st3fan/osx-10.9/blob/master/xnu-2422.1.72/bsd/sys/errno.h.

As far as reading https://github.com/Homebrew/homebrew-core/blob/master/Formula/lsof.rb, I guess errno.h may be at "#{MacOS.sdk_path}/usr/include". I wonder following patch for universal-ctags.rb can avoid including the unwanted header file:

--- /tmp/universal-ctags.rb.orig    2018-08-06 02:07:53.063954036 +0900
+++ /tmp/universal-ctags.rb 2018-08-06 02:04:31.608744264 +0900
@@ -31,7 +31,7 @@

     system "./autogen.sh"
     system "./configure", "--prefix=#{prefix}", *opts
-    system "make"
+    system "make", "AM_CPPFLAGS=-I #{MacOS.sdk_path}/usr/include"
     system "make", "install"
   end
fakiyer commented 6 years ago

I tried it but still getting error...

~ » xcrun --sdk macosx --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
~ » brew install --HEAD universal-ctags/universal-ctags/universal-ctags
==> Installing universal-ctags from universal-ctags/universal-ctags
==> Cloning https://github.com/universal-ctags/ctags.git
Updating /Users/fakiyer/Library/Caches/Homebrew/universal-ctags--git
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
HEAD is now at 0d560136 Merge pull request #1807 from b4n/utf8-pattern-truncation
==> Downloading https://files.pythonhosted.org/packages/84/f4/5771e41fdf52aabebbadecc9381d11dea0fa34e4759b4071244fa094804c/docutils-0.14.tar.gz
Already downloaded: /Users/fakiyer/Library/Caches/Homebrew/universal-ctags--docutils-0.14.tar.gz
==> python -c import setuptools... --no-user-cfg install --prefix=/usr/local/Cellar/universal-ctags/HEAD-0d56013/libexec/vendor --single-version-externally-managed --record=installed.txt
==> ./autogen.sh
==> ./configure --prefix=/usr/local/Cellar/universal-ctags/HEAD-0d56013
==> make AM_CPPFLAGS=-I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include
Last 15 lines from /Users/fakiyer/Library/Logs/Homebrew/universal-ctags/04.make:
extern void error (const errorSelection selection, const char *const format, ...) CTAGS_ATTR_PRINTF (2, 3);
            ^
main/entry.c:359:32: error: use of undeclared identifier 'ENOENT'
        if (mio == NULL  &&  errno == ENOENT)
                                      ^
main/entry.c:584:61: error: use of undeclared identifier 'errno'; did you mean 'error'?
                fprintf (stderr, "Cannot shorten tag file: errno = %d\n", errno);
                                                                          ^~~~~
                                                                          error
./main/routines.h:97:13: note: 'error' declared here
extern void error (const errorSelection selection, const char *const format, ...) CTAGS_ATTR_PRINTF (2, 3);
            ^
3 errors generated.
make[1]: *** [main/ctags-entry.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
masatake commented 6 years ago

@fakiyer, could you try to install lsof via brew? lsof also uses errno.

fakiyer commented 6 years ago

@masatake Yes, I could.

~ » brew install lsof
==> Downloading https://homebrew.bintray.com/bottles/lsof-4.91.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring lsof-4.91.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/lsof/4.91: 6 files, 288KB
masatake commented 6 years ago

(I don't know brew well.)

@fakiyer, thank you. But it seems that you tried the binary package of lsof. I would like to know whether you can introduce source package(?) of lsof. Could you try though I don't know how to do it?

Like u-ctags, lsof uses errno and ENOENT in its source code. If you can build lsof binary without trouble, the brew build-script(?) of u-ctags does something wrong. If you cannot build lsof binary because the compiler cannot find the declaration of errno and the definition of ENOENT, I guess your environment may be broken.

fakiyer commented 6 years ago

Is this alright?

~ » brew install --build-from-source lsof                                                                                                                                             fakiyer@MacBook-Pro
==> Downloading https://www.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_4.91.tar.bz2
Already downloaded: /Users/fakiyer/Library/Caches/Homebrew/lsof-4.91.tar.bz2
==> tar xf lsof_4.91_src.tar
==> ./Configure -n darwin
==> make
🍺  /usr/local/Cellar/lsof/4.91: 6 files, 288KB, built in 6 seconds

But, when trying to install zsh from source, I got an error...

~ » brew reinstall --build-from-source zsh
==> Reinstalling zsh 
==> Downloading https://downloads.sourceforge.net/project/zsh/zsh/5.5.1/zsh-5.5.
Already downloaded: /Users/fakiyer/Library/Caches/Homebrew/zsh-5.5.1.tar.xz
==> ./configure --prefix=/usr/local/Cellar/zsh/5.5.1 --enable-fndir=/usr/local/C
Last 15 lines from /Users/fakiyer/Library/Logs/Homebrew/zsh/01.configure:
checking for dlsym... yes
checking for dlclose... yes
checking for load... no
checking for loadquery... no
checking for loadbind... no
checking for unload... no
checking for shl_load... no
checking for shl_unload... no
checking for shl_findsym... no
checking if getxattr etc. are Linux-like... no
checking if getxattr etc. are MAC-like... yes
checking if getxattr etc. are usable... yes
checking what style of signals to use... POSIX_SIGNALS
checking where signal.h is located...  /usr/include/sys/signal.h
checking where error names are located... configure: error: ERROR MACROS NOT FOUND:  please report to developers

READ THIS: https://docs.brew.sh/Troubleshooting
fakiyer commented 6 years ago

@masatake @KazuakiM It worked after clean install. Thanks a lot for your help.

madtrick commented 4 years ago

@fakiyer do you still remember what did you mean by "clean install"? I'm running into the same problem

fakiyer commented 4 years ago

@madtrick It's to return to factory settings.

madtrick commented 4 years ago

@fakiyer reset the computer? 😱

fakiyer commented 4 years ago

@madtrick Unfortunately, yes... I reset MacOS and reinstalled universal-ctags.

madtrick commented 4 years ago

ok, thx for the info 😄

wadkar commented 4 years ago

@madtrick : First of all, a gist with verbose log of the build process would certainly help to know more about your specific problem.

If you don't want to go to an extent of reinstalling macOS and try few things, I would suggest following options:

  1. Uninstall your xcode-tools and installing it again. Try installing ctags.
  2. brew update, then do a brew doctor and fixing any issues it reports. Try installing ctags.
  3. Create a Brewfile brew bundle dump and remove brew completely. Then do a restart (just in case), and install brew again. Try installing ctags. If you succeed, you have the Brewfile that you generated inn brew bundle dump that you can use to recover your old brew installs.