[Pythonmac-SIG] newbie process question about building MachoPython

Daniel Brotsky dev@brotsky.com
Tue, 2 Jul 2002 15:04:31 -0700


--Apple-Mail-1-95631898
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed

Jack,

Thanks for the (correct) analysis and suggestion.  But I think there's 
still a config bug in the python stuff (at the bottom).

On Saturday, June 29, 2002, at 03:54 PM, Jack Jansen wrote:
> My suggestion would be to not use /sw/include and /sw/lib 
> unconditionally but in stead refer to it with the various --with-foobar 
> options of configure (for all foobars you have in /sw).

In fact there aren't any things Python uses that need to come from /sw, 
so just compiling with no external CFLAGS, CPPFLAGS, and LDFLAGS (and no 
special --with-foobar options) works fine.

> My guess (because of the references to "dl") is that you're picking up 
> stuff from /sw that you don't want to pick up. Or, at least, you're 
> picking up stuff that the build process hasn't been tested for. 
> Specifically, if you have dl installed in /sw (dl is the "linux-way" of 
> doing dynamic loading)

Oh, thanks, that's interesting and I didn't know that.

>  it could be that Python partially configures itself to use dl-based 
> dynamic linking in stead of dynload-based dynamic linking. But: 
> apparently it only partially works (otherwise it would have "just 
> worked"). The last sentence because I know some people have used dl on 
> OSX and gotten it to work (IIRC).

It's this "partially works" thing that's the problem, and I think it's 
actually a python config bug (rather than, say, a dl bug).  The problem 
is that the configure program fully uses the fooFLAGS environment 
variables, so it correctly notices that the dl stuff is available (and 
also that the dylib stuff is available because it's Darwin).  But 
Makefile.pre.in doesn't take full advantage of configure, because while 
it sets LDFLAGS to include the value of @LDFLAGS@ (from config), it 
doesn't do the same with either CFLAGS or CPPFLAGS.  Thus there's a 
mismatch between the settings at compile and link time, and this 
mismatch breaks the build process.

In an attempt to make this clear, I've attached a context diff of the 
existing Makefile.pre.in and one that I've hacked to fix this mismatch 
problem (and a separate problem involving the parser library not being 
linked using the LDFLAGS).  The Python which builds as a result of these 
changes seems to work just fine, passes the test suite, loads dynamic 
modules OK, and hasn't displayed any of the dynamic loading issues that 
were discussed on this list a few months ago.

As I mentioned above, it's clear that Python can be built fine *without* 
fixing this problem.  But it seems to me that it makes the build process 
unnecessarily brittle for people with non-standard (but working) build 
environments.

     dan


--Apple-Mail-1-95631898
Content-Disposition: attachment;
	filename=Makefile.pre.in.patch
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="Makefile.pre.in.patch"

Index: Makefile.pre.in
===================================================================
RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v
retrieving revision 1.86
diff -c -r1.86 Makefile.pre.in
*** Makefile.pre.in	21 Jun 2002 14:48:36 -0000	1.86
--- Makefile.pre.in	29 Jun 2002 09:24:19 -0000
***************
*** 55,62 ****
  # Compiler options
  OPT=		@OPT@
  DEFS=		@DEFS@
! CFLAGS=		$(OPT)
! CPPFLAGS=	-I. -I$(srcdir)/Include $(DEFS)
  LDFLAGS=	@LDFLAGS@
  LDLAST=		@LDLAST@
  SGI_ABI=	@SGI_ABI@
--- 55,62 ----
  # Compiler options
  OPT=		@OPT@
  DEFS=		@DEFS@
! CFLAGS=		$(OPT) @CFLAGS@
! CPPFLAGS=	-I. -I$(srcdir)/Include $(DEFS) @CPPFLAGS@
  LDFLAGS=	@LDFLAGS@
  LDLAST=		@LDLAST@
  SGI_ABI=	@SGI_ABI@
***************
*** 409,415 ****
  		-$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
  
  $(PGEN):	$(PGENOBJS)
! 		$(CC) $(OPT) $(PGENOBJS) $(LIBS) -o $(PGEN)
  
  Parser/grammar.o:	$(srcdir)/Parser/grammar.c \
  				$(srcdir)/Include/token.h \
--- 409,415 ----
  		-$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
  
  $(PGEN):	$(PGENOBJS)
! 		$(CC) $(OPT) $(PGENOBJS) $(LDFLAGS) $(LIBS) -o $(PGEN)
  
  Parser/grammar.o:	$(srcdir)/Parser/grammar.c \
  				$(srcdir)/Include/token.h \

--Apple-Mail-1-95631898--