FAQ
I have installed Python-2.3.3 in the SUSE Linux 9.1 system and am
trying to rebuild an application rpm that was implemented in Python, I
am getting the following error,

/usr/Python-2.3.3/Include/pymem.h In function '__declspec'
/usr/Python-2.3.3/Include/pymem.h:51: error: parse error before
'__declspec'
/usr/Python-2.3.3/Include/pymem.h:50: error: declaration for parameter
'PyMem_Malloc' but no such parameter
:

I thought '__declspec' is used in the Windows DDLs, but I am compiling
the extension module in the Linux environment. Do I need to run
something else first to setup the correct env?

Search Discussions

  • Jeff Epler at Mar 7, 2005 at 11:57 pm
    What does this command print?
    gcc -c -I/usr/Python-2.3.3/Include -x c -o /dev/null \
    /usr/Python-2.3.3/Include/pymem.h
    If it prints an error like the one you included in this message, then
    the set of header files in /usr/Python-2.3.3/Include is damaged,
    incomplete, or wrong for your compiler environment. If the files in
    /usr/Python-2.3.3 are from SUSE, then contact your vendor.

    If it doesn't give an error, but the build of your "application RPM"
    does, then investigate the compiler defines that are present in the
    application that aren't on the above commandline. For instance, I was
    able to get errors like yours by using inappropriate compiler
    options:
    $ gcc -DPy_ENABLE_SHARED -DHAVE_DECLSPEC_DLL -c -x c -o /dev/null \
    /usr/include/python2.3/Python.h
    In file included from /usr/include/python2.3/Python.h:67:
    /usr/include/python2.3/pymem.h: In function `__declspec':
    /usr/include/python2.3/pymem.h:51: error: syntax error before "__declspec"
    ....

    You're right that __declspec has something to do with Windows DLLs.
    Normally, Python uses the macro 'PyAPI_FUNC' to declare all functions in
    its header files. For certain compilers (msvc, cygwin, mingw) it's
    appropriate to use the __declspec extension to make the Python shared
    library work properly. For other compilers, PyAPI_FUNC doesn't do
    anything special. It's through the presence of absence of defines like
    Py_ENABLE_SHARED and HAVE_DECLSPEC_DLL that Python decides how to define
    PyAPI_FUNC, and this little detail is usually below the radar.

    Jeff
    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: not available
    Type: application/pgp-signature
    Size: 189 bytes
    Desc: not available
    Url : http://mail.python.org/pipermail/python-list/attachments/20050307/93002d35/attachment.pgp
  • Cathy Reddy at Mar 8, 2005 at 10:02 pm
    Thank you very much with your suggestion. I installed the python intepreter from SUSE CD but downloaded the sources of python from the python website. It seems like it created the mismatches here. After I installed the python source rpm from SUSE CD, I was able to pass where I had errors.

    Jeff Epler wrote:What does this command print?
    gcc -c -I/usr/Python-2.3.3/Include -x c -o /dev/null \
    /usr/Python-2.3.3/Include/pymem.h
    If it prints an error like the one you included in this message, then
    the set of header files in /usr/Python-2.3.3/Include is damaged,
    incomplete, or wrong for your compiler environment. If the files in
    /usr/Python-2.3.3 are from SUSE, then contact your vendor.

    If it doesn't give an error, but the build of your "application RPM"
    does, then investigate the compiler defines that are present in the
    application that aren't on the above commandline. For instance, I was
    able to get errors like yours by using inappropriate compiler
    options:
    $ gcc -DPy_ENABLE_SHARED -DHAVE_DECLSPEC_DLL -c -x c -o /dev/null \
    /usr/include/python2.3/Python.h
    In file included from /usr/include/python2.3/Python.h:67:
    /usr/include/python2.3/pymem.h: In function `__declspec':
    /usr/include/python2.3/pymem.h:51: error: syntax error before "__declspec"
    ....

    You're right that __declspec has something to do with Windows DLLs.
    Normally, Python uses the macro 'PyAPI_FUNC' to declare all functions in
    its header files. For certain compilers (msvc, cygwin, mingw) it's
    appropriate to use the __declspec extension to make the Python shared
    library work properly. For other compilers, PyAPI_FUNC doesn't do
    anything special. It's through the presence of absence of defines like
    Py_ENABLE_SHARED and HAVE_DECLSPEC_DLL that Python decides how to define
    PyAPI_FUNC, and this little detail is usually below the radar.

    Jeff



    ---------------------------------
    Celebrate Yahoo!'s 10th Birthday!
    Yahoo! Netrospective: 100 Moments of the Web
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://mail.python.org/pipermail/python-list/attachments/20050308/6704245a/attachment.html

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedMar 7, '05 at 11:27p
activeMar 8, '05 at 10:02p
posts3
users2
websitepython.org

2 users in discussion

Cathy Reddy: 2 posts Jeff Epler: 1 post

People

Translate

site design / logo © 2022 Grokbase