Embedded Python 2.1 and AIX

Galen Swint hcsgss at texlife.com
Wed Jul 18 15:41:39 EDT 2001


>Must you use gcc?  I suggest you try the simplest test program
>that illustrates this problem, and build it with the compiler
>tools that come with the platform, with the options as specified
>in /usr/local/lib/python2.1/config/Makefile.
>
>	Donn Cave, donn at u.washington.edu


Thanks for replying....
Yes, we have to use gcc, we have no xlC for this platform.
The very simplest case (or nearly):

**test.c
#include <stdio.h>
#include <stdlib.h>

#include "Python.h"

int main( void )
{
  printf("Hello.\n");
  fflush(stdout);
  Py_Initialize();
  PyImport_ImportModule("string");
  return 0;
}

**Makefile
CC=gcc
PYTHONLIB=/opt/local/lib/python2.1/config
PYTHONINC=/opt/local/include/python2.1

test.o:
	gcc -c -g -DAIX -I$(PYTHONINC) test.c



test: test.o libtest.o
	rm -f test
	$(CC) -o test test.o -L$(PYTHONLIB) -Wl -lpython2.1 -lpthread -lm
****
I also tried it adding -Wl,-bE:python.exp -Wl,-brtl -ldl flags to the link
step. (which are the flags used for compiling Python itself in the Makefile.
Galen




More information about the Python-list mailing list