How to configure makefile for different build platforms
Hi I have a C++ application that uses Boost.Python. We build it on Centos 5.3, with Python 2.4 and Boost 1.34. Our makefile uses explicit paths to find Python and Boost. For the headers we use: PYTHON = /usr/include/python2.4 BOOST_INC = /usr/include/boost INCPATH=$(PYTHON) INCPATH+=$(BOOST_INC) CXXFLAGS += $(patsubst %,-I%,$(INCPATH)) $(CXX) -c $(CXXFLAGS) sourcefile etc Now I need to support building on Ubuntu 10.04 which has Python 2.6, not 2.4, installed. Please can someone suggest how I can modify the makefile to conveniently handle the different Python paths according to the build platform. Should I simply require the user to define PYTHON as an environment variable, or is there a better way without resorting to something complex like autoconf? Best regards David
On 2011-10-5 18:12, David Aldrich wrote:
Hi
I have a C++ application that uses Boost.Python. We build it on Centos 5.3, with Python 2.4 and Boost 1.34.
Our makefile uses explicit paths to find Python and Boost. For the headers we use:
PYTHON = /usr/include/python2.4
BOOST_INC = /usr/include/boost
INCPATH=$(PYTHON)
INCPATH+=$(BOOST_INC)
CXXFLAGS += $(patsubst %,-I%,$(INCPATH))
$(CXX) -c $(CXXFLAGS) sourcefile etc
Now I need to support building on Ubuntu 10.04 which has Python 2.6, not 2.4, installed.
Please can someone suggest how I can modify the makefile to conveniently handle the different Python paths according to the build platform.
On Ubuntu you can call pkg-config to figure out the right compiler and linker options for both Boost and Python. I would expect CentOS to support that as well. Wichert. -- Wichert Akkerman <wichert@wiggy.net> It is simple to make things. http://www.wiggy.net/ It is hard to make things simple.
On Ubuntu you can call pkg-config to figure out the right compiler and linker options for both Boost and Python. I would expect CentOS to support that as well.
Hi Wichert Thanks for your suggestion. However, on my Ubuntu system: pkg-config --list-all lists neither python-dev not libboost-all-dev which are what my makefile needs to reference. David
On 10/06/2011 02:55 PM, David Aldrich wrote:
On Ubuntu you can call pkg-config to figure out the right compiler and linker options for both Boost and Python. I would expect CentOS to support that as well.
Hi Wichert
Thanks for your suggestion. However, on my Ubuntu system:
pkg-config --list-all
lists neither python-dev not libboost-all-dev
which are what my makefile needs to reference.
pkg-config does not use Debian packages names. Try using "python" for the current standard python 2 version, or pythonX.Y for specific versions. Boost appears to be installed in a standard location, so doesn't need any special compiler or linker options. Wichert.
pkg-config does not use Debian packages names. Try using "python" for the current standard python 2 version, or pythonX.Y for specific versions. Boost appears to be installed in a standard location, so doesn't need any special compiler or linker options.
Thanks but --list-all only lists notify-python and dbus-python. David
On 10/06/2011 03:09 PM, David Aldrich wrote:
pkg-config does not use Debian packages names. Try using "python" for the current standard python 2 version, or pythonX.Y for specific versions. Boost appears to be installed in a standard location, so doesn't need any special compiler or linker options. Thanks but --list-all only lists notify-python and dbus-python.
Odd. Try python2.6-config.
-----Original Message----- From: cplusplus-sig-bounces+david.aldrich=emea.nec.com@python.org [mailto:cplusplus-sig-bounces+david.aldrich=emea.nec.com@python.org] On Behalf Of Wichert Akkerman Sent: 06 October 2011 14:51 To: cplusplus-sig@python.org Subject: Re: [C++-sig] How to configure makefile for different build platforms
On 10/06/2011 03:09 PM, David Aldrich wrote:
pkg-config does not use Debian packages names. Try using "python" for the current standard python 2 version, or pythonX.Y for specific versions. Boost appears to be installed in a standard location, so doesn't need any special compiler or linker options. Thanks but --list-all only lists notify-python and dbus-python.
Odd. Try python2.6-config.
No, that's not there either. http://bugs.python.org/issue3585 suggests that pkg-config support in Python was not added until at least 2.6. Perhaps it did not make it in the version I have. Besides, I also wanted it to detect Python 2.4. So this method won't work unfortunately.
On 10/06/2011 10:02 AM, David Aldrich wrote:
-----Original Message----- From: cplusplus-sig-bounces+david.aldrich=emea.nec.com@python.org [mailto:cplusplus-sig-bounces+david.aldrich=emea.nec.com@python.org] On Behalf Of Wichert Akkerman Sent: 06 October 2011 14:51 To: cplusplus-sig@python.org Subject: Re: [C++-sig] How to configure makefile for different build platforms
On 10/06/2011 03:09 PM, David Aldrich wrote:
pkg-config does not use Debian packages names. Try using "python" for the current standard python 2 version, or pythonX.Y for specific versions. Boost appears to be installed in a standard location, so doesn't need any special compiler or linker options. Thanks but --list-all only lists notify-python and dbus-python.
Odd. Try python2.6-config.
No, that's not there either.
http://bugs.python.org/issue3585 suggests that pkg-config support in Python was not added until at least 2.6. Perhaps it did not make it in the version I have. Besides, I also wanted it to detect Python 2.4. So this method won't work unfortunately.
You can also extract this information from various methods in the distutils package. Even if you aren't using distutils to control the build, you could ask Python itself to print out the configuration variables. For instance: python -c "import distutils.sysconfig; print distutils.sysconfig.get_python_inc()" That should give you the Python include directory. There are other methods to get library names, compiler flags, and other things. Jim
participants (3)
-
David Aldrich -
Jim Bosch -
Wichert Akkerman