Skip to content

Instantly share code, notes, and snippets.

@onlime
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onlime/3f1cade72dfdf2904dec to your computer and use it in GitHub Desktop.
Save onlime/3f1cade72dfdf2904dec to your computer and use it in GitHub Desktop.
Homebrew php56-excel (using libxl)
require 'formula'
class Libxl < Formula
homepage 'http://www.libxl.com/'
url 'ftp://xlware.com/libxl-mac-3.6.0.tar.gz'
sha1 '52da78f73e4a8e727c8c73c99435f4136e3774c2'
def install
lib.install 'lib/libxl.dylib'
include.install Dir["include_c/*.h"]
end
def caveats; <<-EOS
LibXl will write a banner in the first row of each spreadsheet and it will be able to
read only 100 cells (first row is unavailable). Buy a license key to remove banner and reading restriction:
http://libxl.com/purchase.html
EOS
end
end
require File.expand_path("../../Abstract/abstract-php-extension", __FILE__)
class Php56Excel < AbstractPhp56Extension
init
homepage 'https://github.com/iliaal/php_excel'
url 'https://github.com/iliaal/php_excel/archive/1.0.tar.gz'
sha1 '3995b754117952290f0f56a8c2f8653e29a025ea'
head 'https://github.com/iliaal/php_excel.git'
depends_on 'autoconf' => :build
depends_on 'php56' unless build.include?('without-homebrew-php')
depends_on 'libxl'
def install
ENV.universal_binary if build.universal?
safe_phpize
system "./configure", "--prefix=#{prefix}",
"--with-libxl-incdir=#{Formula['libxl'].opt_prefix}/include_c/",
"--with-libxl-libdir=#{Formula['libxl'].opt_prefix}/lib/",
phpconfig
system "make"
prefix.install "modules/excel.so"
write_config_file if build.with? "config-file"
end
end
@onlime
Copy link
Author

onlime commented Aug 25, 2014

I'm still getting this clang error on OSX 10.9 Mavericks:

ld: in '/usr/local/opt/zlib/lib/libz.1.dylib', file was built for x86_64 which is not the architecture being linked (i386): /usr/local/opt/zlib/lib/libz.1.dylib for architecture i386

Full verbose output:

$ brew install -v php56-excel
==> Cloning https://github.com/iliaal/php_excel.git
git clone --depth 1 https://github.com/iliaal/php_excel.git /Library/Caches/Homebrew/php56-excel--git
Cloning into '/Library/Caches/Homebrew/php56-excel--git'...
remote: Counting objects: 104, done.
remote: Compressing objects: 100% (80/80), done.
remote: Total 104 (delta 23), reused 92 (delta 23)
Receiving objects: 100% (104/104), 94.62 KiB | 0 bytes/s, done.
Resolving deltas: 100% (23/23), done.
Checking connectivity... done.
git reset --hard origin/HEAD
HEAD is now at 1f00b8a Compiler warning fixes
git checkout-index -a -f --prefix=/private/tmp/php56-excel-hUN5tt/
==> PHP_AUTOCONF="/usr/local/opt/autoconf/bin/autoconf" PHP_AUTOHEADER="/usr/local/opt/autoconf/bin/autoheader" /usr/local/Cellar/php56/5.6.0-rc.4/bin/phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
==> ./configure --prefix=/usr/local/Cellar/php56-excel/HEAD --with-libxl-incdir=/usr/local/Cellar/libxl/HEAD/include_c/ --with-libxl-libdir=/usr/local/Cellar/libxl/HEAD/lib/ --with-php-config=/usr/local/Cellar/php56/5.6.0-rc.4/bin/php-config
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/local/Library/ENV/4.3/sed
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking how to run the C preprocessor... clang -E
checking for icc... no
checking for suncc... no
checking whether clang and cc understand -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-apple-darwin13.3.0
checking host system type... x86_64-apple-darwin13.3.0
checking target system type... x86_64-apple-darwin13.3.0
checking for PHP prefix... /usr/local/Cellar/php56/5.6.0-rc.4
checking for PHP includes... -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/main -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/TSRM -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/Zend -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/ext -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/Cellar/php56/5.6.0-rc.4/lib/php/extensions/debug-non-zts-20131226
checking for PHP installed headers prefix... /usr/local/Cellar/php56/5.6.0-rc.4/include/php
checking if debug is enabled... yes
checking if zts is enabled... yes
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking whether to enable excel support... yes, shared
checking C include dir for libxl... yes, shared
checking lib dir for libxl... yes, shared
checking for excel includes... found in /usr/local/Cellar/libxl/HEAD/include_c/
checking for excel libraries... found in /usr/local/Cellar/libxl/HEAD/lib/
checking for xlCreateBookCA in -lxl... yes
checking for ld used by clang... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm output from clang object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if clang supports -fno-rtti -fno-exceptions... yes
checking for clang option to produce PIC... -fno-common
checking if clang PIC flag -fno-common works... yes
checking if clang static flag -static works... no
checking if clang supports -c -o file.o... yes
checking whether the clang linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin13.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
checking whether the clang++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... no
checking for clang++ option to produce PIC... 
checking if clang++ static flag  works... yes
checking if clang++ supports -c -o file.o... yes
checking whether the clang++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... no
checking dynamic linker characteristics... darwin13.3.0 dyld
(cached) (cached) checking how to hardcode library paths into programs... immediate
configure: creating ./config.status
config.status: creating config.h
==> make
/bin/sh /private/tmp/php56-excel-hUN5tt/libtool --mode=compile clang  -I. -I/private/tmp/php56-excel-hUN5tt -DPHP_ATOM_INC -I/private/tmp/php56-excel-hUN5tt/include -I/private/tmp/php56-excel-hUN5tt/main -I/private/tmp/php56-excel-hUN5tt -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/main -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/TSRM -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/Zend -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/ext -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/ext/date/lib -I/usr/local/Cellar/libxl/HEAD/include_c/  -DHAVE_CONFIG_H  -g -O0   -c /private/tmp/php56-excel-hUN5tt/excel.c -o excel.lo 
mkdir .libs
 clang -I. -I/private/tmp/php56-excel-hUN5tt -DPHP_ATOM_INC -I/private/tmp/php56-excel-hUN5tt/include -I/private/tmp/php56-excel-hUN5tt/main -I/private/tmp/php56-excel-hUN5tt -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/main -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/TSRM -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/Zend -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/ext -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/ext/date/lib -I/usr/local/Cellar/libxl/HEAD/include_c/ -DHAVE_CONFIG_H -g -O0 -c /private/tmp/php56-excel-hUN5tt/excel.c  -fno-common -DPIC -o .libs/excel.o
/bin/sh /private/tmp/php56-excel-hUN5tt/libtool --mode=link clang -DPHP_ATOM_INC -I/private/tmp/php56-excel-hUN5tt/include -I/private/tmp/php56-excel-hUN5tt/main -I/private/tmp/php56-excel-hUN5tt -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/main -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/TSRM -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/Zend -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/ext -I/usr/local/Cellar/php56/5.6.0-rc.4/include/php/ext/date/lib -I/usr/local/Cellar/libxl/HEAD/include_c/  -DHAVE_CONFIG_H  -g -O0   -o excel.la -export-dynamic -avoid-version -prefer-pic -module -rpath /private/tmp/php56-excel-hUN5tt/modules  excel.lo -Wl,-rpath,/usr/local/Cellar/libxl/HEAD/lib/ -L/usr/local/Cellar/libxl/HEAD/lib/ -lxl
clang ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/excel.so -bundle  .libs/excel.o  -L/usr/local/Cellar/libxl/HEAD/lib/ -lxl  -Wl,-rpath -Wl,/usr/local/Cellar/libxl/HEAD/lib/
ld: in '/usr/local/opt/zlib/lib/libz.1.dylib', file was built for x86_64 which is not the architecture being linked (i386): /usr/local/opt/zlib/lib/libz.1.dylib for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [excel.la] Error 1
==> Configuration
HOMEBREW_VERSION: 0.9.5
HEAD: d09660b073e1c618d18110c759ee3b3e27bafa53
CPU: quad-core 64-bit haswell
OS X: 10.9.4-x86_64
Xcode: 5.1.1
CLT: 5.1.0.0.1.1396320587
X11: N/A
==> ENV
HOMEBREW_CC: clang
HOMEBREW_CXX: clang++
MAKEFLAGS: -j4
CMAKE_PREFIX_PATH: /usr/local/opt/gettext:/usr/local/opt/icu4c:/usr/local/opt/zlib:/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/libpng/lib/pkgconfig:/usr/local/opt/freetype/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.9
ACLOCAL_PATH: /usr/local/opt/gettext/share/aclocal:/usr/local/share/aclocal
PATH: /usr/local/Library/ENV/4.3:/usr/local/opt/autoconf/bin:/usr/local/opt/libpng/bin:/usr/local/opt/freetype/bin:/usr/local/opt/gettext/bin:/usr/local/opt/icu4c/bin:/usr/local/opt/jpeg/bin:/usr/local/opt/unixodbc/bin:/usr/local/opt/php56/bin:/usr/bin:/bin:/usr/sbin:/sbin

Error: php56-excel HEAD did not build
Logs:
     /Users/phi/Library/Logs/Homebrew/php56-excel/01.phpize
     /Users/phi/Library/Logs/Homebrew/php56-excel/02.configure
     /Users/phi/Library/Logs/Homebrew/php56-excel/02.configure.cc
     /Users/phi/Library/Logs/Homebrew/php56-excel/03.make
     /Users/phi/Library/Logs/Homebrew/php56-excel/03.make.cc
     /Users/phi/Library/Logs/Homebrew/php56-excel/config.log

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': Class is not a module (TypeError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:390:in `<class:HTTP>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:384:in `<module:Net>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:25:in `<top (required)>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/https.rb:21:in `<top (required)>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/Library/Homebrew/utils.rb:308:in `open'
    from /usr/local/Library/Homebrew/utils.rb:350:in `issues_matching'
    from /usr/local/Library/Homebrew/utils.rb:378:in `issues_for_formula'
    from /usr/local/Library/Homebrew/exceptions.rb:162:in `fetch_issues'
    from /usr/local/Library/Homebrew/exceptions.rb:158:in `issues'
    from /usr/local/Library/Homebrew/exceptions.rb:198:in `dump'
    from /usr/local/Library/brew.rb:158:in `rescue in <main>'
    from /usr/local/Library/brew.rb:66:in `<main>'

Any help greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment