puppet-python icon indicating copy to clipboard operation
puppet-python copied to clipboard

Build failures for 2.7.8 on OS X 10.9/10.10

Open kholloway opened this issue 11 years ago • 4 comments

Try to install Python 2.7.8 via this module in boxen on OS X 10.10:

node default {
  python::version { '2.7.8': }
}

Results in build failure, using the exec below resolves the issue but is not great for anything besides a single version. Any chance you would support passing CFLAGS to the build or adjusting them based on OS X version?

node default {
  case $::macosx_productversion {
    /^10.{9|10}$/: {
      exec { "python 2.7.8":
        command => "env -i bash -c 'source /opt/boxen/env.sh && CFLAGS=\"-I$(xcrun --show-sdk-path)/usr/include\" pyenv install 2.7.8'",
        creates => "/opt/boxen/pyenv/versions/2.7.8/bin/python",
      }
    }
    default: {}
  }

  python::version { '2.7.8': }
}

kholloway avatar Nov 05 '14 17:11 kholloway

@kholloway I've been looking at adding support for hiera data. That way, based on the OS and OS version, it can use different flags. It may be a while out as I've never used hiera in a Puppet module before.

ivorisoutdoors avatar Nov 24 '14 21:11 ivorisoutdoors

I have lots of experience with Hiera and modules so I can bang out some code for this if you like.

I'm also doing the xcrun, /usr/include bits below on 10.9/10.10 to resolve lots of other software that gets mad about /usr/include not being populated. It helps but still doesn't fix the Python build error via your module.

I did figure out that this still breaks if you are on 10.10 with an old Xcode version because you then end up linking to 10.9 include files anyway.

  # Get the Xcode path to include files
  $include_path = inline_template('<%= %x{xcrun --show-sdk-path}.strip %>')

  # Link the Xcode include path to /usr/include to fix a lot of errors from happening
  # during ruby and python modules build time
  file { '/usr/include':
    ensure => link,
    target => "${include_path}/usr/include",
  }

kholloway avatar Nov 24 '14 21:11 kholloway

@kholloway So I finally got around to getting this module on my 10.9 machine and I didn't have any issues with using the default options that are set. I'll test it on my Air as well, which is running 10.10 and see if I also run into this issue.

ivorisoutdoors avatar Nov 27 '14 05:11 ivorisoutdoors

You likely have something in your environment that is making it work properly. Some people report the same as you that they don't get the error and some folks like me receive it all the time. I can simply delete my current python install (pyenv uninstall 2.7.8) and re-run pyenv install or boxen to get the error message again, it's 100% reproducible for me on both my machines and the only reliable solution I have found is to pass the xcrun sdk path via CFLAGS. Soft linking /usr/include doesn't resolve the issue but it does make other things build properly on 10.10 that previously had failed.

kholloway avatar Nov 27 '14 06:11 kholloway