Title: Compile fails on Darwin8 with --with-cxx=g++
Type: compile error Stage: test needed
Components: Build Versions: Python 2.6
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, ajaksu2, loewis, rzigweid
Priority: normal Keywords:

Created on 2005-05-20 11:05 by rzigweid, last changed 2010-08-21 14:38 by BreamoreBoy. This issue is now closed.

Messages (6)
msg60737 - (view) Author: Robert M. Zigweid (rzigweid) Date: 2005-05-20 11:05
As has been previously reported and fixed in some portions of the build 
process, building on Darwin 8 with gcc-4.0 requires some extra libraries to 
be passed. 

When --with-cxx=g++ is specified to configure, and possibly for other flags 
that make the build process be conscious of C++.  

Tail of error:
gcc  -u _PyMac_Error -o python.exe \
                Modules/ccpython.o \
                libpython2.4.a -ldl      
/usr/bin/ld: Undefined symbols:
collect2: ld returned 1 exit status
make: *** [python.exe] Error 1

Add -lSystem and -lSystemStubs for Darwin 8 to the linker where 
appropriate.  I haven't identified all these spots though.
msg60738 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-05-20 21:13
Logged In: YES 

Can you check whether just linking with g++ (instead of
linking with gcc, and still not adding -lSystem) also solves
the problem?

configure is supposed to detect that g++ is needed for
linking; if linking with g++ solves the problem, then must be enhanced to properly auto-detect this case.
msg60739 - (view) Author: Robert M. Zigweid (rzigweid) Date: 2005-06-03 11:56
Logged In: YES 

Firstly, exposing this bug, I discovred, also requires passing --with-
pydebug=true.  It's fine if you don't compile with pydebug.  I'm sorry I did not 
mention/realize that initially.

Secondly in response to loewis comment.  It looks like linking with g++ instead 
of gcc as you eluded to takes care of the problem.

Ilyria% gcc  -u _PyMac_Error -o python.exe \
>                 Modules/ccpython.o \
>                 libpython2.4.a -ldl    
/usr/bin/ld: Undefined symbols:
collect2: ld returned 1 exit status
Ilyria ~/src/Python-2.4.1                                      05-06-03  7:53AM
[gcc  -u _PyMac_Error -o python.exe \\n                Modules/ccpython.o \\n                
libpython2.4.a -ldl    ]
Ilyria% g++  -u _PyMac_Error -o python.exe \
                Modules/ccpython.o \
                libpython2.4.a -ldl
Ilyria ~/src/Python-2.4.1                        
msg60740 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-06-03 18:18
Logged In: YES 

Ok. configure should have detected that you need g++ to
link. To do so, it compiles the program

void foo();int main(){foo();}void foo(){}

with g++ (g++ -c), then links the object file with gcc. If
that fails, it concludes that g++ is needed.

Can you please
a) confirm that this specific procedure indeed links
correctly, and
b) experiment to find out what changes to the program need
to be made so that it fails to link because of

To analyse b), a number of issues have to be considered: it
may be that more include files are needed in the test
program, it may be that other compiler flags need to be
passed, and it may be that more code needs to be added. If
you cannot easily make the test case fail, please try to
reduce Modules/ccpython so that moves towards the test code.
msg82204 - (view) Author: Daniel Diniz (ajaksu2) (Python triager) Date: 2009-02-16 02:25
Is this failure to build --with-pydebug a symptom of a real configure
msg114497 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-21 14:38
No reply to msg60740.
Date User Action Args
2010-08-21 14:38:02BreamoreBoysetstatus: open -> closed

nosy: + BreamoreBoy
messages: + msg114497

resolution: out of date
2009-02-16 02:25:18ajaksu2setnosy: + ajaksu2
stage: test needed
type: compile error
messages: + msg82204
versions: + Python 2.6, - Python 2.4
2005-05-20 11:05:21rzigweidcreate