[dtrace-discuss] Unable to build a dtrace-enabled python

Ted Leung
Tue, 14 Apr 2009 18:50:24 -0000

Hi Robert,

You can find a history of the 2.4, 2.5 and 2.6 versions of the Python
DTrace patches in this bug: <http://bugs.python.org/issue4111>

Ted

Robert Diamond wrote:
> I''ve followed all the threads I could find, and many Google Red
Herrings, so if it''s an RTFM, please let me know which FM I should read
:-)
>
> I''m running open solaris 5.11 in 32-bit mode using VMWare Fusion
on a macbook pro.  Gcc is version 4.0.3.
>
> I downloaded the source for Python v2.4.4, since this is the version for
which the patches appear to be written.  First problem I encountered was that
dtrace''s compiler didn''t seem to know about varargs.  I added
the following two lines to Python/phelper.d:
> #define __builtin_va_list long
> #define __attribute__(x)
> This allowed compilation to complete.  I am stuck now on the link phase:
> robertdiamond$ svn commit -m ''hopefully fix more bugs than I addar
cr libpython2.4.a Python/bltinmodule.o Python/exceptions.o Python/ceval.o
Python/compile.o Python/codecs.o Python/errors.o Python/frozen.o
Python/frozenmain.o Python/future.o Python/getargs.o Python/getcompiler.o
Python/getcopyright.o Python/getmtime.o Python/getplatform.o Python/getversion.o
Python/graminit.o Python/import.o Python/importdl.o Python/marshal.o
Python/modsupport.o Python/mystrtoul.o Python/mysnprintf.o Python/pyfpe.o
Python/pystate.o Python/pythonrun.o Python/structmember.o Python/symtable.o
Python/sysmodule.o Python/traceback.o Python/getopt.o Python/pystrtod.o
Python/dynload_shlib.o Python/dtrace.o Python/phelper.o  Python/thread.o
> ar cr libpython2.4.a Modules/config.o Modules/getpath.o Modules/main.o
Modules/gcmodule.oar cr libpython2.4.a Modules/threadmodule.o
Modules/signalmodule.o  Modules/posixmodule.o  Modules/errnomodule.o
Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o
Modules/zipimport.o  Modules/symtablemodule.o  Modules/xxsubtype.oranlib
libpython2.4.a                              c++  -Xlinker --export-dynamic -o
python \         Modules/python.o \
> libpython2.4.a -lsocket -lnsl -ldl    -lm
> libpython2.4.a: could not read symbols: Bad value
> collect2: ld returned 1 exit status
> make: *** [python] Error 1
>
>
> My guess is this is because dtrace modifies ceval.o, and changes four
undefined symbols to Absolute relocation:
> # nm Python/ceval.o
> ...
> 00000000 A __dtrace_python___function-entry
> 00000000 A __dtrace_python___function-return
> 00000000 A __dtraceenabled_python___function-entry
> 00000000 A __dtraceenabled_python___function-return
> ...
>
>
> thanks in advance,
>      Robert D
>
> Message was edited by: rdiamond
>