nixprime / cpsm

A CtrlP matcher, specialized for paths.
Apache License 2.0
202 stars 19 forks source link

Build fails on mac #48

Closed ptzz closed 6 years ago

ptzz commented 6 years ago
master~/.vim/plugged/cpsm$ ./install.sh
PY3 not specified; inferring Python version from /usr/local/bin/vim
Python 3 selected
-- The C compiler identification is AppleClang 9.1.0.9020039
-- The CXX compiler identification is AppleClang 9.1.0.9020039
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Boost version: 1.67.0
-- Found the following Boost libraries:
--   program_options
-- Found PythonInterp: /usr/local/bin/python3 (found suitable version "3.7", minimum required is "3")
-- Found PythonInterp: /usr/local/bin/python3 (found version "3.7")
-- Found PythonConfig: -I/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m; -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -ldl -framework CoreFoundation
-- Optional package ICU was not found
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/xxx/.vim/plugged/cpsm/build
Scanning dependencies of target cpsm_core
[ 11%] Building CXX object CMakeFiles/cpsm_core.dir/src/str_util.cc.o
[ 22%] Linking CXX static library libcpsm_core.a
[ 22%] Built target cpsm_core
Scanning dependencies of target cpsm_cli
[ 33%] Building CXX object CMakeFiles/cpsm_cli.dir/src/cpsm_cli_main.cc.o
[ 44%] Linking CXX executable cpsm_cli
[ 44%] Built target cpsm_cli
Scanning dependencies of target cpsm_py
[ 55%] Building CXX object CMakeFiles/cpsm_py.dir/src/ctrlp_util.cc.o
[ 66%] Building CXX object CMakeFiles/cpsm_py.dir/src/python_extension.cc.o
/Users/xxx/.vim/plugged/cpsm/src/python_extension.cc:48:11: error: assigning to 'char *' from incompatible type 'const char *'
  *data = PyUnicode_AsUTF8AndSize(obj, size);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/cpsm_py.dir/src/python_extension.cc.o] Error 1
make[1]: *** [CMakeFiles/cpsm_py.dir/all] Error 2
markwu commented 6 years ago

I encounter this error today.

timfeirg commented 6 years ago

I have the exact same issue, but I was using python 3.6.5 from pyenv.

Using env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.6.5 and then PY3=ON ./install.sh works for me.

See https://github.com/nixprime/cpsm#requirements

hydeik commented 6 years ago

I also encountered the same issue, using python 3.7.0 installed using pyenv with the --enable-framework option.

I tentatively fixed the corresponding line (line 48 in src/python_extension.cc):

*data = PyUnicode_AsUTF8AndSize(obj, size);

to

*data = const_cast<char*>(PyUnicode_AsUTF8AndSize(obj, size));

and succeeded to build.