mistydemeo / tigerbrew

Experimental fork of homebrew for PPC Macs on Tiger
Other
538 stars 129 forks source link

building ghc 7.10.2 (dependency for git-annex) fails on Mountain Lion #658

Open karawitan opened 4 years ago

karawitan commented 4 years ago

Hello,

when trying to compile ghc on Mountain Lion, here is what I get .. I tried to look at the ghc "Formula" ( /usr/local/Homebrew/Library/Formula/ghc.rb ), but I don't understand (yet) how to strip off the offending llvm-gcc flags "-Wno-invalid-pp-token" and "-Wno-unicode" .

any hints would be greatly appreciated;


iMac:~ admin$ brew install -v git-annex
==> Installing dependencies for git-annex: ghc, cabal-install, gsasl, libidn, gnutls, lua, libquvi, quvi
==> Installing git-annex dependency: ghc
==> Downloading https://ia902307.us.archive.org/31/items/tigerbrew/ghc-7.10.2.mountain_lion.bottle.1.tar.gz

(...)

curl: (22) The requested URL returned error: 404 Not Found

(...)

Warning: Bottle installation failed: building from source.

(...)

llvm-gcc -E  -m64 -undef -traditional -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs -P -DINSTALLING -DLIB_DIR='"/private/tmp/ghc20200126-6639-1dzgxca/ghc-7.10.2/binary/lib/ghc-7.10.2"' -DINCLUDE_DIR='"/private/tmp/ghc20200126-6639-1dzgxca/ghc-7.10.2/binary/lib/ghc-7.10.2/include"' -DPAPI_INCLUDE_DIR="" -DPAPI_LIB_DIR="" -DFFI_INCLUDE_DIR= -DFFI_LIB_DIR= '-DFFI_LIB="Cffi"' -x c -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header rts/package.conf.in -o rts/dist/package.conf.install.raw
cc1: error: unrecognized command line option "-Wno-invalid-pp-token"
cc1: error: unrecognized command line option "-Wno-unicode"
make[1]: *** [rts/dist/package.conf.install] Error 1
make: *** [install] Error 2
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Tigerbrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
==> Formula
Path: /usr/local/Homebrew/Library/Formula/ghc.rb
==> Configuration
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/mistydemeo/tigerbrew.git
HEAD: 4cce1912cc68a15a0d47f5744b489ae68dfe94fa
Last commit: 4 months ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://ia902307.us.archive.org/31/items/tigerbrew
CPU: dual-core 64-bit penryn
OS X: 10.8.4-x86_64
Curl: /usr/local/Homebrew/Library/Homebrew/vendor/portable-curl/current/bin/curl
Xcode: 5.1.1
CLT: 1.0.0.9000000000.1.1249367152
LLVM-GCC: build 2336
Clang: 3.0 build 211
MacPorts/Fink: /sw/bin/fink
X11: 2.7.4 => /opt/X11
System Ruby: 2.3.3-222 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/ruby
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Java: 1.6.0_51-b11-457
==> ENV
HOMEBREW_CC: llvm-gcc
HOMEBREW_CXX: llvm-g++
CMAKE_PREFIX_PATH: /usr/local
CMAKE_INCLUDE_PATH: /usr/include/libxml2:/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: /System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
PKG_CONFIG_PATH: /usr/local/opt/xz/lib/pkgconfig
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/usr/local/Homebrew/Library/ENV/pkgconfig/10.8
ACLOCAL_PATH: /usr/local/share/aclocal
PATH: /usr/local/Homebrew/Library/ENV/4.3:/usr/local/opt/xz/bin:/usr/bin:/bin:/usr/sbin:/sbin

Error: ghc 7.10.2 did not build
Logs:
     /Users/admin/Library/Logs/Homebrew/ghc/01.configure
     /Users/admin/Library/Logs/Homebrew/ghc/01.configure.cc
     /Users/admin/Library/Logs/Homebrew/ghc/02.make
     /Users/admin/Library/Logs/Homebrew/ghc/02.make.cc
     /Users/admin/Library/Logs/Homebrew/ghc/03.make
     /Users/admin/Library/Logs/Homebrew/ghc/03.make.cc
     /Users/admin/Library/Logs/Homebrew/ghc/04.make
     /Users/admin/Library/Logs/Homebrew/ghc/05.configure
     /Users/admin/Library/Logs/Homebrew/ghc/05.configure.cc
     /Users/admin/Library/Logs/Homebrew/ghc/06.make
     /Users/admin/Library/Logs/Homebrew/ghc/06.make.cc

iMac:~ admin$ 

karawitan commented 4 years ago

Ok finally solved it thanks to "brew install --debug" When install step failed, Brew offered me a few choices, among which I choose to run a shell.

Then, I just add to remove the offending flags,

bash-3.2$ pwd /private/tmp/ghc--binary20200126-81029-sp839b/ghc-7.10.2

bash-3.2$ find . -name *mk | xargs grep token grep: ./mk: Is a directory ./mk/config.mk:RAWCPP_FLAGS += -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs

And, 'make install'

mistydemeo commented 4 years ago

Thank you! I'll try to fix this in the formula.

karawitan commented 4 years ago

Tried the following patch to ghc.rb Formula:

iMac:Formula admin$ gd --patch ghc.rb
diff --git a/Library/Formula/ghc.rb b/Library/Formula/ghc.rb
index b1be66ff94..a1c37116b5 100644
--- a/Library/Formula/ghc.rb
+++ b/Library/Formula/ghc.rb
@@ -12,6 +12,11 @@ class Ghc < Formula
     sha256 "b94cb5912e23a86a475a10114bf14da05fcbbb6b5b85584998f566fc64c01461" => :mountain_lion
   end

+  patch :p0 do
+    url "https://raw.githubusercontent.com/berryamin/tigerbrew/master/Patches/ghc-7.0.2-mlion.diff"
+    sha256 "a1251e065866322f5524cad4dd1d4fce521c27e2cb6b2f53f1093f18c402eed2"
+  end
+
   option "with-tests", "Verify the build using the testsuite."
   deprecated_option "tests" => "with-tests"
 

But still fails later on with:

Warning: Bottle installation failed: building from source.
==> Downloading https://downloads.haskell.org/~ghc/7.10.2/ghc-7.10.2-src.tar.xz
Already downloaded: /Users/admin/Library/Caches/Homebrew/ghc-7.10.2.tar.xz
==> Downloading https://raw.githubusercontent.com/berryamin/tigerbrew/master/Patches/ghc-7.0.2-mlion.diff
################################################################################################################################################################################# 100.0%
==> Patching
==> Applying ghc-7.0.2-mlion.diff
patching file mk/config.mk.in
Hunk #1 succeeded at 633 with fuzz 1.
==> Downloading http://ftpmirror.gnu.org/gmp/gmp-6.0.0a.tar.bz2
Already downloaded: /Users/admin/Library/Caches/Homebrew/ghc--gmp-6.0.0a.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/ghc/7.10.2/libexec/integer-gmp --with-pic --disable-shared
==> make
==> make check
==> make install
==> Downloading https://downloads.haskell.org/~ghc/7.10.2/ghc-7.10.2-x86_64-apple-darwin.tar.xz
Already downloaded: /Users/admin/Library/Caches/Homebrew/ghc--binary-7.10.2.tar.xz
==> ./configure --prefix=/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary --with-gmp-includes=/usr/local/Cellar/ghc/7.10.2/libexec/integer-gmp/include --with-gmp-libraries=/usr/
==> make install
Last 15 lines from /Users/admin/Library/Logs/Homebrew/ghc/06.make:
chmod +x                                         "/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/bin/ghc-7.10.2"
"rm" -f "/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/bin/ghc"  
ln -s ghc-7.10.2 "/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/bin/ghc"
/usr/bin/install -c -m 755 -d "/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/share/man"
/usr/bin/install -c -m 755 -d "/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/share/man/man1"
/usr/bin/install -c -m 644  docs/man/ghc.1 "/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/share/man/man1"
#  driver/ghc-usage.txt driver/ghci-usage.txt includes/dist-derivedconstants/header/platformConstants settings = libraries to install
#  "/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/lib/ghc-7.10.2" = directory to install to
/usr/bin/install -c -m 755 -d  "/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/lib/ghc-7.10.2"
for i in  driver/ghc-usage.txt driver/ghci-usage.txt includes/dist-derivedconstants/header/platformConstants settings; do case $i in *.a) /usr/bin/install -c -m 644  $i  "/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/lib/ghc-7.10.2"; ranlib  "/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/lib/ghc-7.10.2"/`basename $i` ;; *.dll) /usr/bin/install -c -m 755  $i  "/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/lib/ghc-7.10.2" ; strip  "/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/lib/ghc-7.10.2"/`basename $i` ;; *.so) /usr/bin/install -c -m 755  $i  "/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/lib/ghc-7.10.2" ;; *.dylib) /usr/bin/install -c -m 755  $i  "/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/lib/ghc-7.10.2";; *) /usr/bin/install -c -m 644  $i  "/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/lib/ghc-7.10.2"; esac; done
llvm-gcc -E  -m64 -undef -traditional -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs -P -DINSTALLING -DLIB_DIR='"/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/lib/ghc-7.10.2"' -DINCLUDE_DIR='"/private/tmp/ghc20200212-43502-qi6om8/ghc-7.10.2/binary/lib/ghc-7.10.2/include"' -DPAPI_INCLUDE_DIR="" -DPAPI_LIB_DIR="" -DFFI_INCLUDE_DIR= -DFFI_LIB_DIR= '-DFFI_LIB="Cffi"' -x c -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header rts/package.conf.in -o rts/dist/package.conf.install.raw
cc1: error: unrecognized command line option "-Wno-invalid-pp-token"
cc1: error: unrecognized command line option "-Wno-unicode"
make[1]: *** [rts/dist/package.conf.install] Error 1
make: *** [install] Error 2

I will try again later :)

karawitan commented 4 years ago

Might be related to https://gitlab.haskell.org/ghc/ghc/issues/9257

kencu commented 3 years ago

I have a bunch of ghc versions for 64bit Intel 10.6 and up, and stack/cabal here https://github.com/kencu/ghc-for-older-darwin-systems/releases .

I have not tried 10.4 or 10.5, however. Last I looked both the PPC and i386 code generation has bitrotted, but I haven't tried recently.