Trouble including Python.h

John Machin sjmachin at lexicon.net
Sat Jun 24 04:14:16 CEST 2006


On 24/06/2006 7:51 AM, Marcelo Gosling wrote:
> Hi, everyone.
> 
> This is on WinXP SP2, with Python 2.4.3 and DJGPP gcc 4.1.0.
> 
> I'm having trouble including Python.h in a C file. The following C
> code:
> 
> #include "Python.h"
> 
> int main()
> {
>     return 0;
> }
> 
> when compiled with "gcc -I..\Python2.4\include\", gives more than 1000
> lines of errors, beginning with:
> 
> c:/documents and settings/marcelo.gosling/my
> documents/djgpp/bin/as.exe: BFD 2.16.1 assertion fail
> ../../bfd/coff-i386.c:576

Hmmmm.... the *assembler* appears to be grumbling about its input. I'd 
suspect that you have a mangled DJGPP installation. You may be better 
asking on the DJGPP mailing list.

Aside: Wouldn't it have been better to install DJGPP in c:\djgpp????

> c:/documents and settings/marcelo.gosling/my
> documents/djgpp/tmp/ccACtxBR.s: Assembler messages:
> c:/documents and settings/marcelo.gosling/my
> documents/djgpp/tmp/ccACtxBR.s:28: Error: cannot represent relocation
> type BFD_RELOC_386_PLT32
> In file included from ../../Python2.4/include/Python.h:74,
>                  from example_wrap.c:112:

1. You allegedly have a 6-line test program. What is this example_wrap.c 
that has 112 lines (or more) in it?
2. What was the full compiler command line?
3. What are you doing with DJGPP? Are you attempting to make an MS-DOS 
port of Python?
4. Have you successfully compiled linked and executed anything with this 
installation of DJGPP? Does the standard "Hello, world!" program work? 
5. Have you tried compiling (not linking) this:

#include "Python.h"
void dummy() {}

HTH,
John





More information about the Python-list mailing list