Talk:Extending Python with C++: Difference between revisions

From OLPC
Jump to navigation Jump to search
(when you're missing stdlib.h)
No edit summary
 
Line 11: Line 11:


-- Kevin S [[User:68.146.220.249|68.146.220.249]] 18:11, 24 March 2008 (EDT)
-- Kevin S [[User:68.146.220.249|68.146.220.249]] 18:11, 24 March 2008 (EDT)

* Yeah, you can add any additional source files to the list of files in setup.py. And when you make your SWIG .i file, just %include the header file. [[User:Wade|wade]] 09:15, 25 March 2008 (EDT)


Okay, it looks like the line should instead be
Okay, it looks like the line should instead be
Line 21: Line 23:
yum install glibc-headers
yum install glibc-headers
with all non-essential activities off. It looks like I am down to my own syntax errors now. -- Kevin S [[User:68.146.220.249|68.146.220.249]] 19:06, 24 March 2008 (EDT)
with all non-essential activities off. It looks like I am down to my own syntax errors now. -- Kevin S [[User:68.146.220.249|68.146.220.249]] 19:06, 24 March 2008 (EDT)

* Thanks for these fixes! I'll update the main page. [[User:Wade|wade]] 09:15, 25 March 2008 (EDT)

Latest revision as of 13:15, 25 March 2008

Hi. When I try to execute the line:

python setup.py build_ext --inplace

I get the error message

Traceback (most recent call last):
   File "setup.py", line 2, in <module>
      from distutils import setup, Extension
ImportError: cannot import name setup

Any ideas?

Also, is it possible to have separate header and implementation files for the C++ code?

-- Kevin S 68.146.220.249 18:11, 24 March 2008 (EDT)

  • Yeah, you can add any additional source files to the list of files in setup.py. And when you make your SWIG .i file, just %include the header file. wade 09:15, 25 March 2008 (EDT)

Okay, it looks like the line should instead be

from distutils.core import setup, Extension

Now I just need to figure out why gcc can't find stdlib.h...

-- Kevin S 68.146.220.249 18:33, 24 March 2008 (EDT)

Aha, when there is not enough memory available on the OLPC, such as when you are running Browse, yum tries to fork some process which will not be created. It still claims success at the end, but it has not actually succeeded. If this happens to you you will need to shut down most of your activities and try again. In my case, I needed to

yum install glibc-headers

with all non-essential activities off. It looks like I am down to my own syntax errors now. -- Kevin S 68.146.220.249 19:06, 24 March 2008 (EDT)

  • Thanks for these fixes! I'll update the main page. wade 09:15, 25 March 2008 (EDT)