Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: sippsnapp on September 29, 2012, 09:17:18 AM



Title: Midstate - Python3.2 from source
Post by: sippsnapp on September 29, 2012, 09:17:18 AM
Python 3.2 is installed like this:
Code:
./configure --prefix=/opt/python3
make
make install

How do i have to edit the makefile to work with the python installation?

Problem:
Midstate "make" does print an error:
Code:
root@j064:/opt/midstate# make
gcc -march=native -Wall -funroll-all-loops -O3 -fstrict-aliasing -Wall -std=c99 -I/opt/python3/  midstatemodule.c -o test -Wl,-O1 -Wl,--as-needed -lpython3
midstatemodule.c:5:20: error: Python.h: Datei oder Verzeichnis nicht gefunden
midstatemodule.c:96: error: expected ‚=‚, ‚,‚, ‚;‚, ‚asm‚ or ‚__attribute__‚ before ‚*‚ token
midstatemodule.c:138: error: array type has incomplete element type
midstatemodule.c:139: error: ‚midstate_helper‚ undeclared here (not in a function)
midstatemodule.c:139: error: ‚METH_O‚ undeclared here (not in a function)
midstatemodule.c:144: error: variable ‚midstatemodule‚ has initializer but incomplete type
midstatemodule.c:145: error: ‚PyModuleDef_HEAD_INIT‚ undeclared here (not in a function)
midstatemodule.c:145: warning: excess elements in struct initializer
midstatemodule.c:145: warning: (near initialization for ‚midstatemodule‚)
midstatemodule.c:146: warning: excess elements in struct initializer
midstatemodule.c:146: warning: (near initialization for ‚midstatemodule‚)
midstatemodule.c:147: warning: excess elements in struct initializer
midstatemodule.c:147: warning: (near initialization for ‚midstatemodule‚)
midstatemodule.c:148: warning: excess elements in struct initializer
midstatemodule.c:148: warning: (near initialization for ‚midstatemodule‚)
midstatemodule.c:149: warning: excess elements in struct initializer
midstatemodule.c:149: warning: (near initialization for ‚midstatemodule‚)
midstatemodule.c:150: warning: excess elements in struct initializer
midstatemodule.c:150: warning: (near initialization for ‚midstatemodule‚)
midstatemodule.c:151: warning: excess elements in struct initializer
midstatemodule.c:151: warning: (near initialization for ‚midstatemodule‚)
midstatemodule.c:152: warning: excess elements in struct initializer
midstatemodule.c:152: warning: (near initialization for ‚midstatemodule‚)
midstatemodule.c:154: warning: excess elements in struct initializer
midstatemodule.c:154: warning: (near initialization for ‚midstatemodule‚)
midstatemodule.c:157: error: expected ‚=‚, ‚,‚, ‚;‚, ‚asm‚ or ‚__attribute__‚ before ‚PyInit_midstate‚
make: *** [test] Fehler 1

https://gitorious.org/midstate/midstate/blobs/master/Makefile

Code:
CC = gcc

CFLAGS = -march=native -Wall -funroll-all-loops -O3 -fstrict-aliasing -Wall -std=c99 -I/usr/include/python3.2

LDFLAGS = -Wl,-O1 -Wl,--as-needed -lpython3.2

all: test midstate.so

test: midstatemodule.c

$(CC) $(CFLAGS)  midstatemodule.c -o test $(LDFLAGS)

midstate.so: midstatemodule.c

$(CC) $(CFLAGS) -fPIC -shared midstatemodule.c -o midstate.so $(LDFLAGS)

.PHONY: clean

clean:

rm -f midstate.so test


Title: Re: Midstate - Python3.2 from source
Post by: kokjo on September 29, 2012, 09:40:41 AM
midstatemodule.c:5:20: error: Python.h: Datei oder Verzeichnis nicht gefunden

^ means you fucked up, try installing the python headers.

(please, another time post in english)


Title: Re: Midstate - Python3.2 from source
Post by: sippsnapp on September 29, 2012, 06:30:32 PM
I have no idea how to fix this


Title: Re: Midstate - Python3.2 from source
Post by: Inaba on September 29, 2012, 07:56:22 PM
As I recall, you need this file: /usr/include/python3.2mu/Python.h

I forget what package has that, though.


Title: Re: Midstate - Python3.2 from source
Post by: sippsnapp on September 29, 2012, 08:00:11 PM
I pressed the killswitch minutes ago - actually installing ubuntu 12.


Title: Re: Midstate - Python3.2 from source
Post by: kokjo on September 30, 2012, 09:00:15 AM
on ubuntu in the terminal try:
Code:
sudo apt-get install python3.2-dev


Title: Re: Midstate - Python3.2 from source
Post by: sippsnapp on September 30, 2012, 06:12:27 PM
on ubuntu in the terminal try:
Code:
sudo apt-get install python3.2-dev
I found this: http://stackoverflow.com/questions/11740218/python-3-2-installation-on-ubuntu-12-04

Which one is correct and why?


Title: Re: Midstate - Python3.2 from source
Post by: kokjo on September 30, 2012, 06:52:04 PM
on ubuntu in the terminal try:
Code:
sudo apt-get install python3.2-dev
I found this: http://stackoverflow.com/questions/11740218/python-3-2-installation-on-ubuntu-12-04

Which one is correct and why?
dunno! try one, if you fail, try the other one.


Title: Re: Midstate - Python3.2 from source
Post by: sippsnapp on September 30, 2012, 11:36:26 PM
In this case
Code:
sudo apt-get install python3.2-dev
was what installed python 3.2 successfully.

The command sudo
Code:
apt-get install python3
installs python 3.2 in the
Code:
usr/include/Python3.2mu
directory, the above package installs correctly to
Code:
usr/include/Python3.2
.

For me it made a difference, may it helps others...