Last active
December 8, 2021 02:03
-
-
Save briancline/364d539e0e230b92adae to your computer and use it in GitHub Desktop.
Install Swift/PyECLib dependencies on OSX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## swift-ecdeps-osx.sh | |
## https://gist.github.com/briancline/364d539e0e230b92adae | |
## | |
## This script is meant to be used on OSX as a quick and easy way to download, | |
## build, and install gf-complete, Jerasure, and liberasurecode to any prefix | |
## path you specify. These are typically what you may want if you're working | |
## with OpenStack Swift for a quick and dirty EC-friendly test run. | |
## | |
## The Xcode command line tools are required in order for this to work. | |
## | |
## The prefix defaults to $HOME/eclocal, and underneath it, you'll find: | |
## ECPREFIX | |
## |-ECPREFIX/{bin,include,lib,share} -- as needed by the various libraries | |
## `-ECPREFIX/src -- where all the code gets cloned and compiled | |
## | |
## Once it's finished, it'll spew out an export line you can use if you need to | |
## to have OSX look in some non-OSX location for the dynamically-linked modules | |
## installed by this script. | |
## | |
## Note that you don't necessarily need to install to /usr/local or some other | |
## system path; this is what the -p option and the export line at the very | |
## bottom are for. | |
## | |
## If you encounter issues, feel free to post them in a comment on the gist. | |
## | |
## If you're a corporate drone, here's a friendly MIT header: | |
## - The MIT License (MIT), (c) 2015 Brian Cline | |
## - https://opensource.org/licenses/MIT | |
set -o errexit | |
export ECPREFIX=${ECPREFIX:-$HOME/eclocal} | |
export ECBREW=${ECBREW:-no} | |
export ECMAKEJOBS=${ECMAKEJOBS:-4} | |
show_usage () { | |
echo "Usage: ${0} [-h] [-b] [-p PREFIX] [-j JOBS]" >&2 | |
echo " -h Spews help and exits" >&2 | |
echo " -b Uses Homebrew to install autoconf/automake/libtool" >&2 | |
echo " -p PREFIX Installs to the path specified by PREFIX" >&2 | |
echo " [default: ${HOME}/eclocal]" >&2 | |
echo " -j JOBS Number of make jobs to run simultaneously" >&2 | |
} | |
while getopts ":p:j:bh" opt; do | |
case ${opt} in | |
p) export ECPREFIX=${OPTARG} | |
;; | |
j) export ECMAKEJOBS=${OPTARG} | |
;; | |
b) export ECBREW=yes | |
;; | |
h) show_usage | |
exit 0 | |
;; | |
\?) echo "ERROR: Invalid option -${OPTARG}" >&2 | |
exit 1 | |
;; | |
:) echo "ERROR: Option -${OPTARG} requires an argument" >&2 | |
exit 1 | |
;; | |
esac | |
done | |
if ! [[ "${OSTYPE}" =~ "darwin" ]]; then | |
echo "You don't need this! Don't do it!" >&2 | |
exit 1 | |
fi | |
echo "Running with:" >&2 | |
echo " - prefix: ${ECPREFIX}" >&2 | |
echo " - brew deps: ${ECBREW}" >&2 | |
echo " - make jobs: ${ECMAKEJOBS}" >&2 | |
echo "---" >&2 | |
set -o xtrace | |
mkdir -p ${ECPREFIX}/src | |
pushd ${ECPREFIX}/src | |
if [[ "${ECBREW}" = "yes" ]]; then | |
brew install autoconf automake libtool | |
fi | |
git clone http://lab.jerasure.org/jerasure/gf-complete.git | |
pushd gf-complete | |
./autogen.sh | |
./configure --prefix=${ECPREFIX} | |
make -j${ECMAKEJOBS} | |
make install | |
popd # gf-complete | |
git clone http://lab.jerasure.org/jerasure/jerasure.git | |
pushd jerasure | |
autoreconf --force --install | |
./configure --prefix=${ECPREFIX} LDFLAGS=-L${ECPREFIX}/lib CPPFLAGS=-I${ECPREFIX}/include | |
make -j${ECMAKEJOBS} | |
make install | |
popd # jerasure | |
## ISA-L *really* didn't like the gf-complete libs on OSX...but if it did, this is what you might do | |
# brew install yasm | |
# curl -LO https://01.org/sites/default/files/downloads/intelr-storage-acceleration-library-open-source-version/isa-l-2.14.0.tar.gz | |
# tar -zxf isa-l-2.14.0.tar.gz | |
# pushd isa-l-2.14.0 | |
# ./configure --prefix=${ECPREFIX} | |
# make -j${ECMAKEJOBS} | |
# make install | |
# popd | |
## You'll want this before you `make test` liberasurecode below | |
export DYLD_LIBRARY_PATH=${ECPREFIX}/lib/ | |
git clone https://bitbucket.org/tsg-/liberasurecode.git | |
pushd liberasurecode | |
./autogen.sh | |
./configure --prefix=${ECPREFIX} | |
make -j${ECMAKEJOBS} | |
make test | |
make install | |
popd # liberasurecode | |
popd # $ECPREFIX/src | |
set +o xtrace | |
echo "---" >&2 | |
echo "All done. If you need to set your dyld lib path, you may use this:" >&2 | |
echo " export DYLD_LIBRARY_PATH=${ECPREFIX}" >&2 |
If someone came here: brew install liberasurecode
works well
Huh, TIL I don't/didn't get notifications for my gists. Anyways, yes, definitely use the brew formula that now exists. This script was meant primarily to get bleeding-edge liberasurecode builds and not so much for stable releases.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Master did not work and produced the same error seen here.
Checking out v1.1.0 worked. (line 123)