FAQ
I get an error reporting an unfound symbol using a statically linked release
build of python2.5 on a OSX-Tiger. This works fine on leopard, where the
system default python is version 2.5.1 - the same version that I'm using to
link to.

Sorry, I'm currently screwing with my configs and don't have a build to run
(my bad :) anymore, but the error is basically this:

Undefined symbol: _PY_DebugFlag
Referenced From: <my exe>
Expected in: <core audio framework lib image location>

I moved the system python frameworks out of the frameworks path for the
build and run just to make sure that they weren't somehow getting in the
way. I found that that symbol is defined in pydebug.h for both release and
debug builds. Also, I discovered that I can fix the problem with some of my
targets (I have both standalone exe and plugin lib versions of my app code)
by referencing the variable directly like this: int mine = Py_DebugFlag,
which fixes that symbol but then the next symbol in pydebug (PY_VerboseFlag)
is reported as undefined. After some playing with it, I found that the
following code will fix the problem in a basic standalone app:

int _________mine;
void *__________p = NULL;
_________mine = Py_DebugFlag;
_________mine = Py_VerboseFlag;
_________mine = Py_InteractiveFlag;
_________mine = Py_OptimizeFlag;
_________mine = Py_NoSiteFlag;
_________mine = Py_UseClassExceptionsFlag;
_________mine = Py_FrozenFlag;
_________mine = Py_TabcheckFlag;
_________mine = Py_UnicodeFlag;
_________mine = Py_IgnoreEnvironmentFlag;
_________mine = Py_DivisionWarningFlag;
_________mine = _Py_QnewFlag;
__________p = (void *) _PyOS_ReadlineTState;
__________p = (void *) PyOS_ReadlineFunctionPointer;


Woah, don't I feel like the lib is jerking me around a little? Anyway, this
works if I put it in main() for a standalone target, in a semi-random class
constructor for the AudioUnit target, and I still can't find the right place
to put it for the RTAS (
http://www.digidesign.com/index.cfm?query=developers%20plugin_info%20rtas.cfm&langid=1)
target. It's a little weird that I'm getting this at runtime and not at
link-time since I'm linking statically.

This is the standalone main() that works, but fails if I remove the above
code:

#include <Python.h>

int main(int, char **)
{
int mine = -1;
void *p = NULL;

mine = Py_DebugFlag;
mine = Py_VerboseFlag;
mine = Py_InteractiveFlag;
mine = Py_OptimizeFlag;
mine = Py_NoSiteFlag;
mine = Py_UseClassExceptionsFlag;
mine = Py_FrozenFlag;
mine = Py_TabcheckFlag;
mine = Py_UnicodeFlag;
mine = Py_IgnoreEnvironmentFlag;
mine = Py_DivisionWarningFlag;
mine = _Py_QnewFlag;
p = (void *) _PyOS_ReadlineTState;
p = (void *) PyOS_ReadlineFunctionPointer;

Py_Initialize();

Py_Finalize();
}


It seems to me like this might have something to do with setting up a symbol
lookup table correctly or something, I don't know. I'm not having any
problems with debug builds. This is the relevant part of my config.status.

ac_cs_version="\

python config.status
2.5

configured by ./configure, generated by GNU Autoconf
2.59,

with options \"'--enable-universalsdk' '--disable-shared'\"


Help? *whimper*.. Cheers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080522/3efdd325/attachment-0001.htm>

Search Discussions

  • Patrick Stinson at May 23, 2008 at 12:09 am
    Here is the error:
    code 4, error number 0 (Symbol not found: _Py_DebugFlag
    Referenced from: /Library/Application
    Support/Digidesign/Plug-Ins/Play.dpm/Contents/MacOS/Play
    Expected in:
    /System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit
    )
    On Thu, May 22, 2008 at 10:13 AM, Patrick Stinson wrote:

    I get an error reporting an unfound symbol using a statically linked
    release build of python2.5 on a OSX-Tiger. This works fine on leopard, where
    the system default python is version 2.5.1 - the same version that I'm using
    to link to.

    Sorry, I'm currently screwing with my configs and don't have a build to run
    (my bad :) anymore, but the error is basically this:

    Undefined symbol: _PY_DebugFlag
    Referenced From: <my exe>
    Expected in: <core audio framework lib image location>

    I moved the system python frameworks out of the frameworks path for the
    build and run just to make sure that they weren't somehow getting in the
    way. I found that that symbol is defined in pydebug.h for both release and
    debug builds. Also, I discovered that I can fix the problem with some of my
    targets (I have both standalone exe and plugin lib versions of my app code)
    by referencing the variable directly like this: int mine = Py_DebugFlag,
    which fixes that symbol but then the next symbol in pydebug (PY_VerboseFlag)
    is reported as undefined. After some playing with it, I found that the
    following code will fix the problem in a basic standalone app:

    int _________mine;
    void *__________p = NULL;
    _________mine = Py_DebugFlag;
    _________mine = Py_VerboseFlag;
    _________mine = Py_InteractiveFlag;
    _________mine = Py_OptimizeFlag;
    _________mine = Py_NoSiteFlag;
    _________mine = Py_UseClassExceptionsFlag;
    _________mine = Py_FrozenFlag;
    _________mine = Py_TabcheckFlag;
    _________mine = Py_UnicodeFlag;
    _________mine = Py_IgnoreEnvironmentFlag;
    _________mine = Py_DivisionWarningFlag;
    _________mine = _Py_QnewFlag;
    __________p = (void *) _PyOS_ReadlineTState;
    __________p = (void *) PyOS_ReadlineFunctionPointer;


    Woah, don't I feel like the lib is jerking me around a little? Anyway, this
    works if I put it in main() for a standalone target, in a semi-random class
    constructor for the AudioUnit target, and I still can't find the right place
    to put it for the RTAS (
    http://www.digidesign.com/index.cfm?query=developers%20plugin_info%20rtas.cfm&langid=1)
    target. It's a little weird that I'm getting this at runtime and not at
    link-time since I'm linking statically.

    This is the standalone main() that works, but fails if I remove the above
    code:

    #include <Python.h>

    int main(int, char **)
    {
    int mine = -1;
    void *p = NULL;

    mine = Py_DebugFlag;
    mine = Py_VerboseFlag;
    mine = Py_InteractiveFlag;
    mine = Py_OptimizeFlag;
    mine = Py_NoSiteFlag;
    mine = Py_UseClassExceptionsFlag;
    mine = Py_FrozenFlag;
    mine = Py_TabcheckFlag;
    mine = Py_UnicodeFlag;
    mine = Py_IgnoreEnvironmentFlag;
    mine = Py_DivisionWarningFlag;
    mine = _Py_QnewFlag;
    p = (void *) _PyOS_ReadlineTState;
    p = (void *) PyOS_ReadlineFunctionPointer;

    Py_Initialize();

    Py_Finalize();
    }


    It seems to me like this might have something to do with setting up a
    symbol lookup table correctly or something, I don't know. I'm not having any
    problems with debug builds. This is the relevant part of my config.status.

    ac_cs_version="\

    python config.status
    2.5

    configured by ./configure, generated by GNU Autoconf
    2.59,

    with options \"'--enable-universalsdk' '--disable-shared'\"


    Help? *whimper*.. Cheers.
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/python-list/attachments/20080522/96c56cf3/attachment.htm>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedMay 22, '08 at 6:13p
activeMay 23, '08 at 12:09a
posts2
users1
websitepython.org

1 user in discussion

Patrick Stinson: 2 posts

People

Translate

site design / logo © 2022 Grokbase