Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

[FEATURE] Exeperimental launch on python3.4 #64

Closed
wants to merge 9 commits into from

Conversation

Ignat99
Copy link

@Ignat99 Ignat99 commented Oct 9, 2014

List of some trouble on address-model=32 and fix for it:

pip install cython git+git://github.com/surfly/gevent.git#egg=gevent
sudo pip3.4 install cython git+git://github.com/abourget/gevent-socketio.git#egg=gevent-socketio

But import of modules not correct on Python 3.4

./counterblockd.py --help
Traceback (most recent call last):
File "./counterblockd.py", line 8, in
from gevent import monkey; monkey.patch_all()
File "/usr/lib/python3.4/site-packages/gevent-1.1-py3.4-linux-i686.egg/gevent/monkey.py", line 186, in patch_all
patch_thread(Event=Event)
File "/usr/lib/python3.4/site-packages/gevent-1.1-py3.4-linux-i686.egg/gevent/monkey.py", line 113, in patch_thread
patch_module('thread')
File "/usr/lib/python3.4/site-packages/gevent-1.1-py3.4-linux-i686.egg/gevent/monkey.py", line 69, in patch_module
gevent_module = getattr(import('gevent.' + name), name)
File "/usr/lib/python3.4/site-packages/gevent-1.1-py3.4-linux-i686.egg/gevent/thread.py", line 29, in
from gevent.lock import Semaphore as LockType
File "/usr/lib/python3.4/site-packages/gevent-1.1-py3.4-linux-i686.egg/gevent/lock.py", line 4, in
from gevent._semaphore import Semaphore
File "_semaphore.pyx", line 1, in init gevent._semaphore (gevent/gevent._semaphore.c:3142)
ValueError: level must be >= 0

Need in file (gevent/gevent._semaphore.c:3142) that generate by cython change -1 to 0 in line 3142. Because the modules are imported incorrectly in Python 3.4

In file included from gevent/gevent.core.c:237:0:
gevent/libev.h: In function ‘gevent_ev_default_loop’:
gevent/libev.h:22:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
cc1: some warnings being treated as errors

SyntaxError: invalid syntax

pip install cython git+git://github.com/surfly/gevent.git#egg=gevent
sudo pip3.4 install cython git+git://github.com/abourget/gevent-socketio.git#egg=gevent-socketio

>>> from urllib.parse import urlparse

http://stackoverflow.com/questions/20139382/mimetools-message-to-python-3-email-message-message

#from mimetools import Message
import email
stream = io.StringIO() 
rxString = data.decode("utf-8").split('\r\n', 1)[1]
stream.write(rxString) 
headers = email.message_from_string(rxString)

/counterblockd.py --help
Traceback (most recent call last):
File "./counterblockd.py", line 7, in
import gevent
File "/usr/lib/python3.4/site-packages/gevent-1.1-py3.4-linux-i686.egg/gevent/init.py",
line 35, in
from gevent.hub import get_hub, iwait, wait, PYPY
File "/usr/lib/python3.4/site-packages/gevent-1.1-py3.4-linux-i686.egg/gevent/hub.py",
line 8, in
import greenlet # http://pypi.python.org/pypi/greenlet/
File "/usr/lib/python3.4/site-packages/greenlet-0.4.4-py3.4-linux-i686.egg/greenlet.py",
line 7, in
bootstrap()
File "/usr/lib/python3.4/site-packages/greenlet-0.4.4-py3.4-linux-i686.egg/greenlet.py",
line 6, in bootstrap
imp.load_dynamic(name,file)
ImportError: /usr/lib/python3.4/site-packages/greenlet-0.4.4-py3.4-linux-i686.egg/greenlet.cpython-34dm.so:
undefined symbol: _Py_RefTotal

boost_1_56_0.tar.bz2 - Standard build system (bjam) is not good:

http://stackoverflow.com/questions/7195959/hello-world-with-boost-python-and-python-3-2
http://stackoverflow.com/questions/25188861/libboost-python3-so-1-56-0-undefined-symbol-pyclass-type
http://w3facility.info/question/hello-world-with-boost-python-and-python-3-2/
http://stackoverflow.com/questions/19865757/importerror-usr-lib-libboost-python-so-1-54-0-undefined-symbol-pyclass-type

http://comments.gmane.org/gmane.linux.arch.general/32474

>      ldd -r /usr/lib/libboost_python.so
>      linux-vdso.so.1 =>   (0x00007fffc81ff000)
>      libutil.so.1 =>  /lib/libutil.so.1 (0x00007fece9112000)
>      libpthread.so.0 =>  /lib/libpthread.so.0 (0x00007fece8ef5000)
>      libdl.so.2 =>  /lib/libdl.so.2 (0x00007fece8cf0000)
>      libstdc++.so.6 =>  /usr/lib/libstdc++.so.6 (0x00007fece89e6000)
>      libm.so.6 =>  /lib/libm.so.6 (0x00007fece8764000)
>      libgcc_s.so.1 =>  /usr/lib/libgcc_s.so.1 (0x00007fece854d000)
>      libc.so.6 =>  /lib/libc.so.6 (0x00007fece81f1000)
>      /lib/ld-linux-x86-64.so.2 (0x00007fece9596000)

==================== How to compile Python and boost ======

./b2 --toolset=gcc cxxflags='-g -O2 -std=gnu++0x -march=core2 -mtune=core2 -msse -msse2 -mssse3 -msse4 -Xlinker -export-dynamic -pthread -Wl,-O1 -Wl,-Bsymbolic-functions, -z,relro -lcfitsio -lhealpix_cxx -lcxxsupport -lpsht -lfftpack -lc_utils -lgomp -lnrnoc -lnrniv -livoc -loc-lneuron_gnu -lscopmath -lsparse13 -lsundials -lnrnmpi -lmemacs -lmeschach -livos -lreadline -lncurses -lm -lc -lgss_s -lstdc++ -lpthread -lutil -lnux-vdso -lpython2.7' --with-python  --buildid=2 


./bootstrap.sh --with-python=/usr/bin/python3.4 --prefix=/usr/local

./b2 --toolset=gcc cxxflags='-g -O2 -std=gnu++0x -march=core2 -mtune=core2 -msse -msse2 -mssse3 -msse4 -Xlinker -export-dynamic -pthread -Wl,-O1 -Wl,-Bsymbolic-functions, -z,relro -lcfitsio -lhealpix_cxx -lcxxsupport -lpsht -lfftpack -lc_utils -lgomp -lnrnoc -lnrniv -livoc -loc-lneuron_gnu -lscopmath -lsparse13 -lsundials -lnrnmpi -lmemacs -lmeschach -livos -lreadline -lncurses -lm -lc -lgss_s -lstdc++ -lpthread -lutil -lnux-vdso -lpython2.7' --with-python  --buildid=2 

./b2 variant=release address-model=32 threading=multi optimization=speed link=shared runtime-link=shared --toolset=gcc cxxflags='-Xlinker -export-dynamic' --with-python --buildid=2

========================================= or ====

cd ../../../.. && ./bootstrap.sh --with-python=/usr/bin/python3.4 --prefix=/usr/local && cd libs/python/example/quickstart

 ../../../../bjam variant=release address-model=32 threading=multi optimization=speed link=shared runtime-link=shared --toolset=gcc cxxflags='-Xlinker -export-dynamic' --with-python --verbose-test --build 

=============================== For package Python 3.4 need extra settings
ln -s /usr/lib/libpython3.4m.so.1.0 /usr/lib/libpython3.4
include <python3.4/config.h>
nano +50,35 ../../../../boost/python/detail/wrap_python.hpp

https://github.com/TooTallNate/node-dlopen/blob/master/src/binding.cc
https://svn.boost.org/trac/boost/query?status=!closed&page=14&desc=1&order=summary&row=description

In setup.py

python-greenlet/greenlet#62

 httpparser = Extension('geventhttpclient._parser',
                sources = ['ext/_parser.c', 'ext/http_parser.c'],
                libraries = ['boost_python-py3.4'],
                libraries_dirs = ['/usr/local/lib'],
                include_dirs = ['ext'])

But most of problem inside:

  • gevent
  • geventhttpclient
  • gevent-socketio
  • gevent-websocket
  • greenlet

In my opinion, these packages are not safe under python 3.4.
Many tests do not pass, within the code is very confused.

@ghost ghost mentioned this pull request Oct 14, 2014
@robby-d
Copy link
Contributor

robby-d commented Dec 27, 2014

closing this, best to have it in a separate branch

@robby-d robby-d closed this Dec 27, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants