newbie python - cmake build problem I can't seem to fix...

Ryan Schmidt ryandesign at macports.org
Fri Sep 9 09:15:29 PDT 2016


On Sep 9, 2016, at 10:32, Ken Cunningham <ken.cunningham.webuse at gmail.com> wrote:
> 
> Hi all, thanks in advance for the ongoing education, and I apologize for the newbie questions.
> 
> 
> I'm working on updating a port (hatari) that only builds with python2.7 (or more accurately, doesn't build with python35 selected , but does build with python27 selected). it uses cmake, and FindPythonInterp to find python. <https://cmake.org/cmake/help/v3.0/module/FindPythonInterp.html>
> 
> If I ensure "sudo port select python python27" and then build, all goes well. if I have python35 selected, the build fails, on SL and on El Cap.
> 
> I've pulled my hair out trying to find a portfile command that will force it to build with python27 even if the user has previously selected python35.
> 
> Here's what I've tried so far, none of which have worked to override the user's set python. I know I'm missing something simple.... thanks.
> 
> Ken
> 
> 
> 
> 
> # port builds with python27 but not 3.5
> 
> #configure.python           ${prefix}/bin/python2.7
> 
> #build.env-append          PYTHON=${prefix}/bin/python2.7
> #build.env-append          PYTHONEXECUTABLE=${prefix}/bin/python2.7
> #build.env-append          PYTHON_EXECUTABLE=${prefix}/bin/python2.7
> #build.env-append          PYTHON_VERSION_MAJOR=2
> #build.env-append          PYTHON_VERSION_MINOR=7
> 
> 
> #configure.env-append  PYTHON=${prefix}/bin/python2.7
> #configure.env-append  PYTHON_EXECUTABLE=${prefix}/bin/python2.7
> #configure.env-append  PYTHON_VERSION_MAJOR=2
> #configure.env-append  PYTHON_VERSION_MINOR=7
> 
> 
> #configure.args-append  PYTHON_VERSION_MAJOR=2
> #configure.args-append  PYTHON_VERSION_MINOR=7
> 
> 
> but no matter, I get 
> 
> :info:configure -- Found PythonInterp: /opt/local/bin/python (found version "3.5.2") 
> 
> and the build fails, unless I "sudo port select python python27" first.

You may not be missing anything. I've found cmake to be pretty awful. Maybe try:

configure.args-append -DPYTHON_EXECUTABLE=${prefix}/bin/python2.7





More information about the macports-dev mailing list