Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS X building? #3

Closed
mrak opened this issue Jun 5, 2015 · 20 comments
Closed

OS X building? #3

mrak opened this issue Jun 5, 2015 · 20 comments

Comments

@mrak
Copy link

mrak commented Jun 5, 2015

I've installed boost and cmake through homebrew and ./install.sh seems to go through without a hitch.

$ ./install.sh
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   program_options
-- Configuring done
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   cpsm_py

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /Users/mrak/.local/share/vim/bundle/cpsm/build
[ 42%] Built target cpsm_core
[ 57%] Built target cpsm_cli
[ 85%] Built target cpsm_py
[100%] Built target matcher_test
Install the project...
-- Install configuration: "Release"
-- Installing: /Users/mrak/.local/share/vim/bundle/cpsm/autoload/cpsm_py.so
-- Installing: /Users/mrak/.local/share/vim/bundle/cpsm/test/cpsm_py.so
-- Up-to-date: /Users/mrak/.local/share/vim/bundle/cpsm/test/cpsm_cli.bin
-- Up-to-date: /Users/mrak/.local/share/vim/bundle/cpsm/test/matcher_test.bin

When I load up vim and try to use CtrlP, vim crashes with the following:

Vim: Caught deadly signal ABRT
Vim: Finished.
@ZzCalvinzZ
Copy link

I get the same problem:

(fr5.1)~/.vim/bundle/cpsm (master) :) Fatal Python error: PyThreadState_Get: no current thread
Vim: Caught deadly signal ABRT
Vim: Finished.

@gonzaloserrano
Copy link

Same here!

@nixprime
Copy link
Owner

nixprime commented Jun 6, 2015

Do you all have Python (2 or 3) installed through Homebrew? Some Googling around seems to indicate that there is an upstream CMake problem where CMake incorrectly selects Mac OS X's Python libraries over other Python libraries (Homebrew is the usual culprit); http://www.itk.org/Bug/view.php?id=14809 is the CMake tracking bug, and Homebrew/legacy-homebrew#25118 is a Homebrew bug with some discussion.

I've committed 01e2392 to master to fix this. However, even without that commit I haven't been able to reproduce a crash, even after brew install python and brew install python3. Can you please try and let me know?

@gonzaloserrano
Copy link

Hi,

Still crashes, i removed the build directory and compiled again after pulling last version. The build process output is here: https://gist.github.com/gonzaloserrano/11b4f25ac5057748526d

As you can see i'm using python 2.7.9 from homebrew.

@svenstaro
Copy link
Contributor

I'm not sure this big external Find.cmake module is required. After all, YouCompleteMe also only uses the systemlibs. The commit broke systems that use Python 3 as a default system lib.

@svenstaro
Copy link
Contributor

Looking at FindPythonLibrary.cmake now, I don't think you're really fixing any problems by using it because it uses FindPythonInterp which is supplied by CMake and will still find the wrong versions of Python on a badly configured OSX.

@nixprime
Copy link
Owner

nixprime commented Jun 6, 2015

gonzaloserrano, can you provide the output of otool -L $(which vim) and otool -L ~/.vim/bundle/cpsm/autoload/cpsm_py.so?

svenstaro, according to the CMake bug report, FindPythonInterp may find a different Python than FindPythonLibs since it honors PATH.

@gonzaloserrano
Copy link

Yep looks like cpsm uses the system python and homebrewed vim the corresponding homebrew python one: https://gist.github.com/gonzaloserrano/f1a70e42069c8815b875

@nixprime
Copy link
Owner

nixprime commented Jun 7, 2015

Can you run which python and brew doctor? Probably /usr/bin is before /usr/local/bin in your path, causing the system Python interpreter to be selected over the Homebrew Python interpreter, which is now what's used to select the Python libraries used to build cpsm.

@gonzaloserrano
Copy link

AFAIK in my env /usr/local/bin has precedence over /usr/bin in $PATH:

╰─○ type -a python
python is /usr/local/bin/python
python is /usr/bin/python

brew doctordoesn't show anything related to python.

I'll try to dig further tomorrow. Thanks four your help!

@glortho
Copy link

glortho commented Jun 10, 2015

Did you come upon a solution here @gonzaloserrano? I'm having the same issue.

@gonzaloserrano
Copy link

Not yet, this week has been so busy. Sorry! :-(

@glortho
Copy link

glortho commented Jun 10, 2015

This appears to be a solution to the same/related problem: ycm-core/YouCompleteMe#8

@gonzaloserrano
Copy link

I tried this: $ EXTRA_CMAKE_ARGS='-DPYTHON_EXECUTABLE=/usr/local/bin/python' bash install.sh without luck. What did you end up doing to make it work?

@glortho
Copy link

glortho commented Jun 10, 2015

Well, I actually haven't solved it entirely, though it of course works by flattening namespace:

DYLD_FORCE_FLAT_NAMESPACE=1 vim

@nixprime
Copy link
Owner

jedverity, can you provide the output of the following:

  • otool -L $(which vim)
  • otool -L ~/.vim/bundle/cpsm/autoload/cpsm_py.so
  • which python
  • brew doctor

@glortho
Copy link

glortho commented Jun 15, 2015

I do have the problem of cpsm using System python
(/System/Library/Frameworks/Python.framework/Versions/2.7) and vim using
homebrew python
(/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7,
which is also first on PATH).

On Wed, Jun 10, 2015 at 11:01 PM, Jamie Liu notifications@github.com
wrote:

jedverity, can you provide the output of the following:

otool -L $(which vim)

otool -L ~/.vim/bundle/cpsm/autoload/cpsm_py.so

which python

brew doctor


Reply to this email directly or view it on GitHub
#3 (comment).

@mrak
Copy link
Author

mrak commented Sep 2, 2015

Anyone on OSX with home brew python gotten this working?

@zchee
Copy link
Contributor

zchee commented Oct 30, 2015

@nixprime
@mrak @ZzCalvinzZ @gonzaloserrano @svenstaro @jedverity
In OS X, In some cases it will be linked to the system Python (/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython.dylib) with -framework Python flag.

but, If installed Python and vim use Homebrew, .dylib (in Linux .so) path is /usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib.

In the current state,
e.g.

  • PYTHON_EXECUTABLE=/usr/local/bin/python
  • PYTHON_INCLUDE_PATH=/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/include/python2.7
  • PYTHON_LIBRARY=/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython.dylib

Since the {exe | include} and lib is different python, an error will occur.

Simple hack solution is -framework Python to /usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib
https://github.com/nixprime/cpsm/blob/master/cmake/FindPythonLibrary.cmake#L88
but, It's likely to be a little more concise.

I do not know how to write CMakefile, I can not post the PR. Sorry.

- set (PYTHON_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
+ set (PYTHON_LIBRARY "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib" CACHE FILEPATH "Python Framework" FORCE)

@zchee
Copy link
Contributor

zchee commented Oct 30, 2015

@nixprime FYI,

Not fix

> otool -L autoload/cpsm_py.dylib
autoload/cpsm_py.dylib:
        cpsm_py.dylib (compatibility version 0.0.0, current version 0.0.0)
        /System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.10)
        /usr/local/opt/icu4c/lib/libicuuc.55.dylib (compatibility version 55.0.0, current version 55.1.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)

Fixed

> otool -L autoload/cpsm_py.dylib
autoload/cpsm_py.dylib:
        cpsm_py.dylib (compatibility version 0.0.0, current version 0.0.0)
        /usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
        /usr/local/opt/icu4c/lib/libicuuc.55.dylib (compatibility version 55.0.0, current version 55.1.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants