Skip to content

Instantly share code, notes, and snippets.

@cmd-ntrf
Last active September 15, 2016 15:46
Show Gist options
  • Save cmd-ntrf/bdd4b6195b3085063b62a7a5c6e60417 to your computer and use it in GitHub Desktop.
Save cmd-ntrf/bdd4b6195b3085063b62a7a5c6e60417 to your computer and use it in GitHub Desktop.
module purge -f
module load apps/git compilers/gcc/4.8.5 apps/buildtools

git clone https://github.com/google/protobuf.git

cd protobuf
export CXXFLAGS='-fPIC'
export CFLAGS='-fPIC'
./autogen.sh
./configure
make -j8

cd python

OLD_PATH=$PATH
OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH

export PATH=$PWD/../src/.libs:$PATH
export LD_LIBRARY_PATH=$PWD/../src/.libs:$LD_LIBRARY_PATH

# Build Python 3.5 wheel
module load apps/python/3.5
pyvenv buildenv3 
source buildenv3/bin/activate
pip install wheel
python setup.py bdist_wheel --cpp_implementation --compile_static_extension
deactivate

# Build Python 2.7 wheel
module swap apps/python/3.5 apps/python/2.7
virtualenv buildenv
source buildenv/bin/activate
pip install wheel
python setup.py bdist_wheel --cpp_implementation --compile_static_extension
deactivate

# Install wheels
cp dist/*.whl /software6/apps/python/wheelhouse/gcc

# Restore environment
export PATH=$OLD_PATH
export LD_LIBRARY_PATH=$OLD_LD_LIBRARY_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment