#See https://adrhc.go.ro/wordpress/common-commands-when-building/ for building environment, x.sh script and other things not defined here.
#Before starting do declare the environment variables specified to the link above.
#Compiling Python-2.7.10
export CFLAGS="-march=armv5te -mfloat-abi=soft -mabi=aapcs-linux -fno-stack-protector -pthread -O2 -Wall -Wno-error"
#export BUILD_FLAGS="$CFLAGS -I/ffp/include -I/ffp/opt/apache-2.2.29-worker/include"
export BUILD_FLAGS="$CFLAGS -I/ffp/include"
export LIBS="-lintl -lreadline -lncurses"
export LDFLAGS="-L/ffp/lib $LIBS"
export CPPFLAGS="$BUILD_FLAGS"
export CXXFLAGS="$BUILD_FLAGS"
export PATH=/ffp/sbin:/ffp/bin
NEW_BUILD_NAME=Python
NEW_BUILD_VER=2.7.10
NEW_BUILD_NAME_AND_VER=$NEW_BUILD_NAME-$NEW_BUILD_VER
ls -l /tmp/$NEW_BUILD_NAME-*
ls -l ~/ffp_0.7_armv5/packages/$NEW_BUILD_NAME-*
NEW_BUILD_NR=0
#ERROR
Failed to build these modules:
_curses_panel readline
#SOLUTION (before configure)
use -lreadline -lncurses for BUILD_FLAGS and LDFLAGS
#ERROR (make)
export PATH=/ffp/sbin:/ffp/bin
/ffp/bin/mkdir -p Include
./Parser/asdl_c.py -h Include ./Parser/Python.asdl
/ffp/bin/env: python: No such file or directory
make: *** [Include/Python-ast.h] Error 127
#SOLUTION (apply before configure)
#somehow python uses the existing version of python (any) to compile itself (current sources)
#force to ignore the existing version of python when building itself:
touch Include/Python-ast.h Python/Python-ast.c
#ERROR (test after installing)
cd ~/temp/$NEW_BUILD_NAME_AND_VER
ffp/bin/python
Python 2.7.9 (default, Jan 11 2015, 18:08:14)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> help('modules')
Please wait a moment while I gather a list of all available modules...
ffp/bin/python: symbol '_PyErr_ReplaceException': can't resolve symbol
#SOLUTION (apply before configure)
#See http://bugs.python.org/issue23781.
wget http://bugs.python.org/file38697/capi_PyErr_ReplaceException.patch
#modify capi_PyErr_ReplaceException.patch (remove a/ and b/ source path prefixes)
#apply capi_PyErr_ReplaceException.patch accepting all defaults
patch -p0 -i capi_PyErr_ReplaceException.patch
cd ~/compile/$NEW_BUILD_NAME_AND_VER
patch -p0 -i capi_PyErr_ReplaceException.patch
touch Include/Python-ast.h Python/Python-ast.c
#./configure --prefix=/ffp --enable-shared --enable-ipv6 --enable-big-digits --enable-unicode --with-signal-module --with-threads=/ffp --with-pth --with-doc-strings --without-pymalloc --with-fpectl --with-ensurepip=upgrade
#configure without pip; better install manually pip-6.0.6 in order to avoid CERTIFICATE_VERIFY_FAILED error when running pip
./configure --prefix=/ffp --enable-shared --enable-ipv6 --enable-big-digits --enable-unicode --with-signal-module --with-threads=/ffp --with-pth --with-doc-strings --without-pymalloc --with-fpectl
#ERROR (before make)
./Parser/asdl_c.py -h Include ./Parser/Python.asdl
/ram_bin/usr/bin/python: /ffp/lib/libpthread.so.0: no version information available (required by /usr/lib/libpython2.6.so.1.0)
make: *** [Include/Python-ast.h] Segmentation fault (core dumped)
#SOLUTION
touch Include/Python-ast.h Python/Python-ast.c
#ERROR (before make)
Failed to build these modules:
_curses_panel
#SOLUTION
slacker -u br2:ncurses-5.9_20140927-arm-1.txz
touch Include/Python-ast.h Python/Python-ast.c
nohup /ffp/bin/make -C . &
tail -f nohup.out
#ERROR (after make)
Python build finished, but the necessary bits to build these modules were not found:
_tkinter bsddb185 nis
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
#SOLUTION
This means won't build the following modules (is ok):
_tkinter (requires X11 libraries), bsddb185 (Berkeley DB 1.85 library), nis (Interface to Sun’s NIS), sunaudiodev (Access to Sun audio hardware)
rm /tmp/$NEW_BUILD_NAME-$NEW_BUILD_VER-arm-$NEW_BUILD_NR.txz
rm -r $HOME/temp/$NEW_BUILD_NAME_AND_VER
make install DESTDIR=$HOME/temp/$NEW_BUILD_NAME_AND_VER
cd $HOME/temp/$NEW_BUILD_NAME_AND_VER
makepkg $NEW_BUILD_NAME $NEW_BUILD_VER $NEW_BUILD_NR
cp -v /tmp/$NEW_BUILD_NAME-$NEW_BUILD_VER-arm-$NEW_BUILD_NR.txz ~/ffp_0.7_armv5/packages/
funpkg -q $NEW_BUILD_NAME
funpkg -i ~/ffp_0.7_armv5/packages/$NEW_BUILD_NAME-$NEW_BUILD_VER-arm-$NEW_BUILD_NR.txz
#From now on RESTORE ENVIRONMENT to that specified at https://adrhc.go.ro/wordpress/common-commands-when-building:
export CFLAGS="-march=armv5te -mfloat-abi=soft -mabi=aapcs-linux -fno-stack-protector -pthread -O2 -Wall -Wno-error"
export BUILD_FLAGS="$CFLAGS -I/ffp/include"
unset LIBS
export LDFLAGS="-L/ffp/lib"
export CPPFLAGS="$BUILD_FLAGS"
export CXXFLAGS="$BUILD_FLAGS"
#In order to avoid CERTIFICATE_VERIFY_FAILED when using easy_install (provided by setuptools module)
#download the Mozilla's CA Bundle certificate:
wget -nv http://curl.haxx.se/ca/cacert.pem -O /ffp/etc/ssl/cert.pem
#You could use easy_install (provided by setuptools module) in order to install modules (or simply use pip).
#When using pip and required to use the "--egg" option than you better compile the module manually.
#see http://forum.nas-central.org/viewtopic.php?f=249&t=16627&p=92309#p92309
#List python modules:
python
#then, from python's shell/prompt:
help('modules')
help('setuptools') -> info about setuptools module
help('jinja2') -> info about jinja2 module (observe lower case usage)
#ERROR (la instalarea multor pachete)
AttributeError: Distribution instance has no attribute 'include_package_data'
#SOLUTION
Nu instala setuptools folosind:
wget https://bitbucket.org/pypa/setuptools/get/default.tar.gz#egg=setuptools-dev
#Install setuptools-17.0
cd ~/compile
wget https://pypi.python.org/packages/source/s/setuptools/setuptools-17.0.tar.gz#md5=fd15d24ed1e4c95e56d8c6e812f3a84f
tar xvzf setuptools-17.0.tar.gz
cd setuptools-17.0
~/x.sh ffpg
python setup.py --help-commands
python setup.py --help
python setup.py --help build
python setup.py build
python setup.py install --record module-files.txt
#Install pip-7.0.3 (requires setuptools-17.0).
#pip-7.0.3 has no CERTIFICATE_VERIFY_FAILED error
cd ~/compile
wget https://pypi.python.org/packages/source/p/pip/pip-7.0.3.tar.gz#md5=54cbf5ae000fb3af3367345f5d299d1c
tar xvzf pip-7.0.3.tar.gz
cd pip-7.0.3
~/x.sh ffpg
python setup.py --help-commands
python setup.py --help
python setup.py --help build
python setup.py build
python setup.py install --record module-files.txt
#Install SCons (better compile manually SCons because its files have non-FFP paths)
#SCons install doesn't work without --egg option.
#see also http://forum.nas-central.org/viewtopic.php?f=249&t=16627&p=92309#p92309
pip install SCons -vvv --egg --log /ffp/var/log/python/SCons.txt
#Modify the paths used by /ffp/bin/scons* files.
sed -i s/"\/usr\/bin"/"\/ffp\/bin"/ /ffp/bin/scons-time-2.3.0
sed -i s/"\/usr\/bin"/"\/ffp\/bin"/ /ffp/bin/scons-time
sed -i s/"\/usr\/bin"/"\/ffp\/bin"/ /ffp/bin/scons-2.3.0
sed -i s/"\/usr\/bin"/"\/ffp\/bin"/ /ffp/bin/sconsign-2.3.0
sed -i s/"\/usr\/bin"/"\/ffp\/bin"/ /ffp/bin/sconsign
sed -i s/"\/usr\/bin"/"\/ffp\/bin"/ /ffp/bin/scons
cd /ffp/lib/scons-2.3.0
~/x.sh ffpg
#Install Jinja2-2.7.3
cd ~/compile
wget https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz
tar xvzf Jinja2-2.7.3.tar.gz
cd Jinja2-2.7.3
~/x.sh ffpg
python setup.py --help-commands
python setup.py --help
python setup.py --help build
python setup.py build
python setup.py install --record module-files.txt
#Uninstall a python module
cd ~/compile/pip-1.2.1 -> has CERTIFICATE_VERIFY_FAILED error at install
cd ~/compile/pip-1.5.6 -> has CERTIFICATE_VERIFY_FAILED error always
cd ~/compile/pip-6.0.6 -> has no CERTIFICATE_VERIFY_FAILED error
cat module-files.txt | xargs rm -rf
find /ffp/lib/python2.7/ -name "*pip*"
rm -r /ffp/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg
#Using pip:
python -m pip help
python -m pip list
#varianta cu freeze e o listare care arata si eventualele probleme ale pachetelor
python -m pip freeze
python -m pip help install
python -m pip search simplejson
python -m pip install simplejson -> nu a functionat
python -m pip install cryptography==0.6.1
python -m pip install pyOpenSSL==0.14 -vvv --log /ffp/var/log/python/pyOpenSSL-0.14.txt
python -m pip list --outdated
python -m pip install -U CherryPy -> updating CherryPy
pip install -U setuptools -v --log /ffp/var/log/python/setuptools -> updating CherryPy and recording in log
python -m pip install rst2html5 -> required by aria2
python -m pip uninstall pycurl
pip install pycurl -v --log /ffp/var/log/python/pycurl.txt
pip install PIL --allow-unverified PIL
# install yenc with allow-all-external and "--allow-unverified yenc"
pip install --allow-all-external --allow-unverified yenc yenc -v --log /ffp/var/log/python/yenc
# install from archive url
pip install -v --log /ffp/var/log/python/yenc http://www.golug.it/pub/yenc/yenc-0.4.0.tar.gz
#List module's files:
pip show -f Jinja2
#show sys.path -> python packages paths
python -m site
python -m site --user-site
#Install pycurl-7.19.5 -> required by pyLoad and easier to install using pip or easy_install (from setuptools)
cd ~/compile
wget http://pycurl.sourceforge.net/download/pycurl-7.19.5.tar.gz
tar xvzf pycurl-7.19.5.tar.gz
cd pycurl-7.19.5
~/x.sh ffpg
python setup.py --help-commands
python setup.py --help
#ERROR0
python: symbol 'CRYPTO_set_locking_callback': can't resolve symbol
python: symbol 'CRYPTO_num_locks': can't resolve symbol
python: symbol 'CRYPTO_set_id_callback': can't resolve symbol
Traceback (most recent call last):
File "", line 1, in
ImportError: unknown dlopen() error
#SOLUTION0
Nu compila cu openssl:
python setup.py build --curl-config=/ffp/bin/curl-config --with-ssl --openssl-dir=/ffp
Modifica setup.py:
# self.libraries = []
self.libraries = ["crypto"]
python setup.py build --curl-config=/ffp/bin/curl-config --with-ssl
python setup.py install --record module-files.txt
#test installation:
python
import pycurl
CTRL+D
#certifi (14.5.14) -> required in order to avoid CERTIFICATE_VERIFY_FAILED when using easy_install (from setuptools)
#pip (6.0.6) -> required version in order to avoid CERTIFICATE_VERIFY_FAILED error when running pip
#Requirements files are used to hold the result from pip freeze for the purpose of achieving repeatable installations.
#In this case, your requirement file contains a pinned version of everything that was installed when pip freeze was run.
pip freeze > /ffp/opt/apache-htdocs/public/python2.7-packages.txt
pip install -r /ffp/opt/apache-htdocs/public/python2.7-packages.txt
#ecdsa module below must be corrected after installation:
cd /ffp/lib/python2.7/site-packages/ecdsa
ffpg
# pip freeze
certifi==2015.4.28
cffi==1.1.2
Cheetah==2.4.4
CherryPy==3.7.0
cryptography==0.9.3
enum34==1.0.4
Flask==0.10.1
idna==2.0
ipaddress==1.0.14
itsdangerous==0.24
Jinja2==2.8
Markdown==2.6.2
MarkupSafe==0.23
peewee==2.6.3
pyasn1==0.1.8
pycparser==2.14
pycurl==7.19.5.1
pyOpenSSL==0.15.1
requests==2.7.0
six==1.9.0
snor==0.0.8
transmissionrpc==0.11
Werkzeug==0.10.4
yenc==0.4.0