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

make ycm_core fails – “LONG_BIT definition appears wrong for platform” #66

Closed
roryokane opened this issue Feb 7, 2013 · 8 comments

Comments

@roryokane
Copy link

I installed the plugin with Vundle, but when I follow the Mac OS X super-quick installation instructions, I eventually get an error at the step make ycm_core.

$ make ycm_core
[  1%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/arg_to_python_base.cpp.o
In file included from /Library/Frameworks/Python.framework/Headers/Python.h:57,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/detail/wrap_python.hpp:142,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/detail/prefix.hpp:13,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/handle.hpp:8,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/converter/arg_to_python_base.hpp:7,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/libs/python/src/converter/arg_to_python_base.cpp:6:
/Library/Frameworks/Python.framework/Headers/pyport.h:734:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
make[3]: *** [BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/arg_to_python_base.cpp.o] Error 1
make[2]: *** [BoostParts/CMakeFiles/BoostParts.dir/all] Error 2
make[1]: *** [ycm/CMakeFiles/ycm_core.dir/rule] Error 2
make: *** [ycm_core] Error 2

I’m on Mac OS X 10.6. I’m using the latest MacVim, Version 7.3 (53). Here’s the top of the output of :version in MacVim:

:version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 15 2010 22:03:01)
MacOS X (unix) version
Compiled by Bjorn Winckler <[email protected]>
Huge version with MacVim GUI.  Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse […]

My gcc version is “i686-apple-darwin10-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)”.

Here is the full trace of my installation (with blank lines added between commands). I installed cmake earlier with brew install cmake. In the middle, when the cp failed, that’s because I hadn’t installed the Vim bundle properly; when it worked the second time I ran it, I had run :BundleInstall in MacVim.

Last login: Wed Feb  6 20:10:03 on ttys000

$ cd ~

$ mkdir ycm_temp

$ cd ycm_temp

$ curl -O http://llvm.org/releases/3.2/clang+llvm-3.2-x86_64-apple-darwin11.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 67.8M  100 67.8M    0     0  14.1M      0  0:00:04  0:00:04 --:--:-- 15.5M

$ tar -zxvf clang+llvm-3.2-x86_64-apple-darwin11.tar.gz
x clang+llvm-3.2-x86_64-apple-darwin11/
x clang+llvm-3.2-x86_64-apple-darwin11/bin/
[snipping huge list of files]
x clang+llvm-3.2-x86_64-apple-darwin11/share/man/man1/
x clang+llvm-3.2-x86_64-apple-darwin11/share/man/man1/clang.1

$ cp clang+llvm-3.2-x86_64-apple-darwin11/lib/libclang.dylib ~/.vim/bundle/YouCompleteMe/python
cp: /Users/roryokane/.vim/bundle/YouCompleteMe/python: No such file or directory

$ lsclang+llvm-3.2-x86_64-apple-darwin11
clang+llvm-3.2-x86_64-apple-darwin11.tar.gz

$ cp clang+llvm-3.2-x86_64-apple-darwin11/lib/libclang.dylib ~/.vim/bundle/YouCompleteMe/python

$ cd ~

$ mkdir ycm_build

$ cd ycm_build

$ cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=~/ycm_temp/clang+llvm-3.2-x86_64-apple-darwin11 . ~/.vim/bundle/YouCompleteMe/cpp
-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is GNU 4.2.1
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
Your C++ compiler does NOT support C++11, compiling in C++03 mode.
-- Found PythonLibs: /usr/lib/libpython2.6.dylib (found suitable version "2.5.1", minimum required is "2.5") 
Using libclang to provide semantic completion for C/C++/ObjC
Using external libclang: /Users/roryokane/ycm_temp/clang+llvm-3.2-x86_64-apple-darwin11/lib/libclang.dylib
-- Found PythonInterp: /usr/local/bin/python (found version "2.7.3") 
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/roryokane/ycm_build

$ make ycm_core
Scanning dependencies of target BoostParts
[  0%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/date_time/src/gregorian/date_generators.cpp.o
[  1%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/date_time/src/gregorian/greg_month.cpp.o
[  2%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/date_time/src/gregorian/greg_weekday.cpp.o
[  2%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/date_time/src/gregorian/gregorian_types.cpp.o
[  3%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/date_time/src/posix_time/posix_time_types.cpp.o
[  4%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/exception/src/clone_current_exception_non_intrusive.cpp.o
[  5%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/codecvt_error_category.cpp.o
[  5%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/operations.cpp.o
[  6%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/path.cpp.o
[  7%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/path_traits.cpp.o
[  8%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/portability.cpp.o
[  8%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/unique_path.cpp.o
[ 10%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/utf8_codecvt_facet.cpp.o
[ 11%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/windows_file_codecvt.cpp.o
[ 12%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/arg_to_python_base.cpp.o
In file included from /Library/Frameworks/Python.framework/Headers/Python.h:57,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/detail/wrap_python.hpp:142,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/detail/prefix.hpp:13,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/handle.hpp:8,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/converter/arg_to_python_base.hpp:7,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/libs/python/src/converter/arg_to_python_base.cpp:6:
/Library/Frameworks/Python.framework/Headers/pyport.h:734:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
make[3]: *** [BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/arg_to_python_base.cpp.o] Error 1
make[2]: *** [BoostParts/CMakeFiles/BoostParts.dir/all] Error 2
make[1]: *** [ycm/CMakeFiles/ycm_core.dir/rule] Error 2
make: *** [ycm_core] Error 2

$ make ycm_core
[  1%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/arg_to_python_base.cpp.o
In file included from /Library/Frameworks/Python.framework/Headers/Python.h:57,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/detail/wrap_python.hpp:142,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/detail/prefix.hpp:13,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/handle.hpp:8,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/converter/arg_to_python_base.hpp:7,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/libs/python/src/converter/arg_to_python_base.cpp:6:
/Library/Frameworks/Python.framework/Headers/pyport.h:734:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
make[3]: *** [BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/arg_to_python_base.cpp.o] Error 1
make[2]: *** [BoostParts/CMakeFiles/BoostParts.dir/all] Error 2
make[1]: *** [ycm/CMakeFiles/ycm_core.dir/rule] Error 2
make: *** [ycm_core] Error 2

If I change the settings from compiling with semantic support for C-family languages to compiling without the support, I still get the error:

$ cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/cpp
Your C++ compiler does NOT support C++11, compiling in C++03 mode.
Using libclang to provide semantic completion for C/C++/ObjC
Using external libclang: /Users/roryokane/ycm_temp/clang+llvm-3.2-x86_64-apple-darwin11/lib/libclang.dylib
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/roryokane/ycm_build

$ make ycm_core
[  1%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/arg_to_python_base.cpp.o
In file included from /Library/Frameworks/Python.framework/Headers/Python.h:57,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/detail/wrap_python.hpp:142,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/detail/prefix.hpp:13,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/handle.hpp:8,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/converter/arg_to_python_base.hpp:7,
                 from /Users/roryokane/.vim/bundle/YouCompleteMe/cpp/BoostParts/libs/python/src/converter/arg_to_python_base.cpp:6:
/Library/Frameworks/Python.framework/Headers/pyport.h:734:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
make[3]: *** [BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/arg_to_python_base.cpp.o] Error 1
make[2]: *** [BoostParts/CMakeFiles/BoostParts.dir/all] Error 2
make[1]: *** [ycm/CMakeFiles/ycm_core.dir/rule] Error 2
make: *** [ycm_core] Error 2
@Valloric
Copy link
Member

Valloric commented Feb 7, 2013

Duplicate issue #6 I think. See that issue for details.

Basically the problem is that cmake is picking up one version of the python dylib and a separate version of python for the headers.

Here's the culprit: -- Found PythonLibs: /usr/lib/libpython2.6.dylib (found suitable version "2.5.1", minimum required is "2.5")

If you want to re-call cmake, don't forget that you need to delete everything in your build directory first, otherwise cmake will re-use the old state.

@Valloric Valloric closed this as completed Feb 7, 2013
@Valloric
Copy link
Member

Valloric commented Feb 7, 2013

Crap I meant issue #18.

@Valloric
Copy link
Member

Valloric commented Feb 7, 2013

You should probably add the following flags to your cmake call:

 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.dylib

This will force the paths to the python include dir and the python library to use.

@whitedwarfsun
Copy link

I'm trying to install YCM in cygwin64 on a x86_64 machine and got stuck.

The first error message was

[ 11%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/arg_to_python_base.cpp.o
In file included from /usr/include/python2.7/Python.h:58:0,
                 from /home/matu_gr/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/detail/wrap_python.hpp:142,
                 from /home/matu_gr/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/detail/prefix.hpp:13,
                 from /home/matu_gr/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/handle.hpp:8,
                 from /home/matu_gr/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/converter/arg_to_python_base.hpp:7,
                 from /home/matu_gr/.vim/bundle/YouCompleteMe/cpp/BoostParts/libs/python/src/converter/arg_to_python_base.cpp:6:
/usr/include/python2.7/pyport.h:886:2: Fehler: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
 #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  ^
BoostParts/CMakeFiles/BoostParts.dir/build.make:402: recipe for target 'BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/arg_to_python_base.cpp.o' failed
make[3]: *** [BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/arg_to_python_base.cpp.o] Error 1
CMakeFiles/Makefile2:78: recipe for target 'BoostParts/CMakeFiles/BoostParts.dir/all' failed
make[2]: *** [BoostParts/CMakeFiles/BoostParts.dir/all] Error 2
CMakeFiles/Makefile2:212: recipe for target 'ycm/CMakeFiles/ycm_support_libs.dir/rule' failed
make[1]: *** [ycm/CMakeFiles/ycm_support_libs.dir/rule] Error 2
Makefile:148: recipe for target 'ycm_support_libs' failed
make: *** [ycm_support_libs] Error 2

and brought me to this thread.

I've tried to work around with

-DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.dylib

but this did not help. (CMake configuration reports the same libs if not provided explicitly anyway.)

Then I've tried to reset the compilers CMake uses: using -DCMAKE_C_COMPILER and -DCMAKE_CXX_COMPILER, I've set the compilers first to /usr/bin/x86_64-pc-cygwin-gcc and /usr/bin/x86_64-pc-cygwin-g++, respectively; then to /usr/bin/i686-pc-cygwin-gcc and /usr/bin/i686-pc-cygwin-g++. But now I get:

Linking CXX shared library ycm_core.pyd
/usr/lib/gcc/i686-pc-cygwin/4.7.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lpython2.7
collect2: Fehler: ld gab 1 als Ende-Status zurück
ycm/CMakeFiles/ycm_core.dir/build.make:390: recipe for target 'ycm/ycm_core.pyd' failed
make[3]: *** [ycm/ycm_core.pyd] Error 1
CMakeFiles/Makefile2:168: recipe for target 'ycm/CMakeFiles/ycm_core.dir/all' failed
make[2]: *** [ycm/CMakeFiles/ycm_core.dir/all] Error 2
CMakeFiles/Makefile2:212: recipe for target 'ycm/CMakeFiles/ycm_support_libs.dir/rule' failed
make[1]: *** [ycm/CMakeFiles/ycm_support_libs.dir/rule] Error 2
Makefile:148: recipe for target 'ycm_support_libs' failed
make: *** [ycm_support_libs] Error 2

Do you have any ideas or experience on how to fix this?

@gitaarik
Copy link

gitaarik commented Jun 3, 2015

@whitedwarfsun I had the same problem, getting the LONG_BIT error in Cygwin. After a lot of searching and trying I came to a solution that worked for me. YouCompleteMe apparently has a Python C++ Boost library included to build it, but somehow that conflicts with the C++ Boost library of the Python installation in Cygwin. What I did was to copy the wrap_python.hpp header file of the Cygwin Python C++ Boost library to the YouCompleteMe Python C++ Boost libary, as in; overwrite it.

In my specific case it was this command, in your case the paths might be different:

cp /usr/include/boost/python/detail/wrap_python.hpp ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/python/detail/wrap_python.hpp

Then I ran the ./install.sh script again and it installed successfully, no LONG_BIT error :).

Hope this helps anyone!

@forcemain
Copy link

cp /usr/include/boost/python/detail/wrap_python.hpp ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/python/detail/wrap_python.hpp

@zuoxinyu
Copy link

@gitaarik This solution dosen't work on my cygwin. My python version is 2.7.10 and gcc is 5.2 , the clang is downloaded by the install.py automatically. I try many ways but everything goes wrong. It seems that I have to use a VM for vim.

@vheon
Copy link
Contributor

vheon commented Feb 27, 2016

@zuoxinyu why don't you compile YCM with MSVC?

bijancn pushed a commit to bijancn/YouCompleteMe that referenced this issue Jul 26, 2016
…ed_libclang

Fix a issue that libclang.dylib won't be loaded when it is linked with libLLVM dynamically
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants