[C++-sig] Re: Problem building boost.python for Cygwin

Marc Paterno paterno at fnal.gov
Fri Feb 21 02:32:42 CET 2003


Hello,

Yes, I have read the documentation at
http://www.boost.org/libs/python/doc/building.html#configuration;
that's home I got as far as I did. I have built boost.python with no
problems on Linux. But building for Cygwin has turned out to be much harder.

Previously I was trying to use the Cygwin version of bjam to do the
build; I have now switched to using the Windows version of bjam.

I still do not understand the environment in which I am expected to
work. Should I be running the build from a (Cygwin) bash shell, or
from a Windows command prompt?

The second (working in a Windows command prompt) seems impossible,
because the GCC compiler version I have requires the Cygwin dll to
run; it must be used from a Cygwin command prompt.

If I try the first method, do I need to define the paths in the
environment variables in the Windows manner (because the Windows bjam
will be using them to find files and directories), or should they be
defined in the Cygwin path style, because g++ will be using them to
find files and directories? Or is there a mixture? Below detail my
best guesses, which are clearly still not right.

Finally, although I have read the instructions at the web page listed
above, I still have questions about where the environment variables
should point. This is distinct from, and in addition to, my questions
about *how* they should point there, via Cygwin-style or Windows-style
paths.

1) PYTHON_ROOT : "The root directory of your Python installation"

Is this the directory in which the Python interpreter executable is to
be found? The Windows filename for Cygwin's executable image for the
Python interpreter is c:\cygwin\bin\python2.2.exe. The Cygwin filename
for this file is /bin/python2.2.exe; it is also /usr/bin/python2.2.exe
(my understanding is that Cygwin's internal manipulations make /bin
and /usr/bin identical. When viewed from Windows, the directory
c:\cygwin\usr\bin exists, but is empty). Finally, under Cygwin,
/usr/bin/python is a symbolic link to /usr/bin/python2.2.exe.

I have tried both
  export PYTHON_ROOT=/bin
and
  export PYTHON_ROOT=c:/cygwin/bin
(forward slashes, not backward slashes).


2) PYTHON_VERSION -- even I understand this one. I used
  export PYTHON_VERSION=2.2

3) PYTHON_INCLUDES : "Path to Python #include directories". This
seemed clear, but again I'm not sure if we want a Cygwin or Windows
style path. I guessed Cygwin, because GCC will be passed the
translated value, and GCC needs the Cygwin style pathnames.

  export PYTHON_INCLUDES=/usr/include/python2.2

This is the directory that contains Python.h, as well as many other
headers.

4) PYTHON_LIB_PATH : "Path to Python library object".

I'm guessing that the "Python library object" for Cygwin's Python is
the file /usr/lib/python2.2/config/libpython2.2.dll.a. When I use
SWIG, under Cygwin, this is the file to which I link. My guess is that
GCC will be driving the linker, and that I need to use the Cygwin path
here, so that the linker can find the file. So:

  export PYTHON_LIB_PATH=/usr/lib/python2.2/config

5) PYTHON_STDLIB_PATH : "Path to Python standard library modules".

I'm guessing that this means the directory in which the many .py,
.pyc, and .pyo files for Python's standard library live; it also
contains subdirectories for other standard library modules. I guessed
that again I should use the Cygwin path, but this time is really a
guess, with not much of a reason -- only that so far all the others
have been Cygwin paths as well.

  export PYTHON_STDLIB_PATH=/usr/lib/python2.2

6) CYGWIN_ROOT : "Path to user's Cygwin installation"

Since the Cygwin path would always be trivially "/", it would seem
this must mean the Windows path to the Cygwin root directory.

  export CYGWIN_ROOT=c:/cygwin

I used the forward slash, rather than backward slash, following the
style in the default for PYTHON_ROOT under Windows.

7) GCC_PYTHON_ROOT : "Path to the user's Cygwin Python installation"

Guessing Cygwin or Windows style here was also a bit hard, but since
PYTHON_ROOT was already set to the Cygwin style path, I guessed the
reason for this environment variable was to have a Windows-path
equivalent. So:

  export GCC_PYTHON_ROOT=c:/cygwin/bin

This is the Windows path to the directory in which the Cygwin python
interpreter executable can be found.

8) GCC_DEBUG_PYTHON_ROOT : "Path to the users Cygwin pydebug build"

I have no debug build of Python; I did not build the Python executable
I'm using. I installed the pre-built package supplied by the good folk
at Cygnus.

I left this environment variable undefined, in the hopes that
specifying -sBUILD=release" at the bjam command line would not
actually require the use of this environment variable.

So, with this setup, from a Cygwin bash shell, using the Windows
version of bjam, I try:

  bjam -sTOOLS=gcc -sBUILD=release


As I noted above, I tried both PYTHON_ROOT=c:/cygwin/bin and
PYTHON_ROOT=/bin. Both attempts fail.

With PYTHON_ROOT=c:/cygwin/bin, I get:

build$ bjam -sTOOLS=gcc -sBUILD=release
---------------------------------------------------------------------
skipping Boost.Python library build due to missing or incorrect
configuration
You can configure the location of your python installation by setting:
PYTHON_ROOT    - currently "c:/cygwin/bin"
PYTHON_VERSION - The 2-part python Major.Minor version number (e.g.
                 "2.2", NOT "2.2.1")  - currently "2.2"

The following are automatically configured from PYTHON_ROOT if not
otherwise set:
    GCC_PYTHON_ROOT    - path to Cygwin Python installation; currently
                          "c:/cygwin/bin"
    GCC_PYTHON_DEBUG_ROOT - path to Cygwin debug-python installation
                            (configured --with-pydebug); currently
                          "c:/cygwin/usr/local/pydebug"
    PYTHON_LIB_PATH    - path to Python library; currently
                          "/usr/lib/python2.2/config"
    PYTHON_STDLIB_PATH - path to Python standard library modules; currently
                          "/usr/lib/python2.2"
---------------------------------------------------------------------
...found 8 targets...


and with PYTHON_ROOT=/bin I get the similar (not quite identical)

build$ bjam -sTOOLS=gcc -sBUILD=release
---------------------------------------------------------------------
skipping Boost.Python library build due to missing or incorrect
configuration
You can configure the location of your python installation by setting:
PYTHON_ROOT    - currently "/bin"
PYTHON_VERSION - The 2-part python Major.Minor version number (e.g.
                 "2.2", NOT "2.2.1")  - currently "2.2"

The following are automatically configured from PYTHON_ROOT if not
otherwise set:
    GCC_PYTHON_ROOT    - path to Cygwin Python installation; currently
                          "c:/cygwin/bin"
    GCC_PYTHON_DEBUG_ROOT - path to Cygwin debug-python installation
                            (configured --with-pydebug); currently
                          "c:/cygwin/usr/local/pydebug"
    PYTHON_LIB_PATH    - path to Python library; currently
                          "/usr/lib/python2.2/config"
    PYTHON_STDLIB_PATH - path to Python standard library modules; currently
                          "/usr/lib/python2.2"
---------------------------------------------------------------------
...found 8 targets...

So, clearly I am still doing something wrong. Can someone point out
the incorrect part(s) of my setup?


best regards,
Marc











More information about the Cplusplus-sig mailing list