Andersbakken / rtags

A client/server indexer for c/c++/objc[++] with integration for Emacs based on clang.
http://www.rtags.net
GNU General Public License v3.0
1.83k stars 252 forks source link

Build failure on CentOS 7 #1149

Closed tytus64 closed 6 years ago

tytus64 commented 6 years ago

Please mark appropriate

Problem description

Build for rtags 2.18 fails on CentOS 7: make.log

/home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp: In function ‘Location createLocation(const CXCursor&, CXCursorKind, bool, unsigned int)’: /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:910:52: error: invalid initialization of reference of type ‘const CXCursor&’ from expression of type ‘CXSourceLocation’ return createLocation(location, blocked, offset); ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:897:10: error: in passing argument 1 of ‘Location createLocation(const CXCursor&, CXCursorKind, bool, unsigned int)’ Location DiagnosticsProvider::createLocation(const CXCursor &cursor, CXCursorKind kind, bool blocked, unsigned offset) ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp: At global scope: /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:970:11: error: ‘Filter’ does not name a type const Filter ∈ ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:971:11: error: ‘Filter’ does not name a type const Filter &out; ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp: In function ‘CXChildVisitResult childrenVisitor(CXCursor, CXCursor, CXClientData)’: /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:978:13: error: ‘struct ChildrenVisitor’ has no member named ‘out’ if ((u->out.isNull() || !u->out.match(cursor)) && (u->in.isNull() || u->in.match(cursor))) { ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:978:33: error: ‘struct ChildrenVisitor’ has no member named ‘out’ if ((u->out.isNull() || !u->out.match(cursor)) && (u->in.isNull() || u->in.match(cursor))) { ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:978:59: error: ‘struct ChildrenVisitor’ has no member named ‘in’ if ((u->out.isNull() || !u->out.match(cursor)) && (u->in.isNull() || u->in.match(cursor))) { ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:978:77: error: ‘struct ChildrenVisitor’ has no member named ‘in’ if ((u->out.isNull() || !u->out.match(cursor)) && (u->in.isNull() || u->in.match(cursor))) { ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp: At global scope: /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:984:48: error: ‘Filter’ does not name a type List children(CXCursor parent, const Filter &in, const Filter &out) ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:984:56: error: ISO C++ forbids declaration of ‘in’ with no type [-fpermissive] List children(CXCursor parent, const Filter &in, const Filter &out) ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:984:66: error: ‘Filter’ does not name a type List children(CXCursor parent, const Filter &in, const Filter &out) ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:984:74: error: ISO C++ forbids declaration of ‘out’ with no type [-fpermissive] List children(CXCursor parent, const Filter &in, const Filter &out) ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp: In function ‘List children(CXCursor, const int&, const int&)’: /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:986:60: error: too many initializers for ‘ChildrenVisitor’ ChildrenVisitor userData = { in, out, List() }; ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:986:60: error: could not convert ‘in’ from ‘const int’ to ‘List’ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp: In function ‘String typeName(const CXCursor&)’: /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:1031:74: error: ‘typeString’ was not declared in this scope ret = typeString(clang_getResultType(clang_getCursorType(cursor))); ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:1031:74: note: suggested alternative: In file included from /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:16:0: /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.h:615:8: note: ‘RTags::typeString’ String typeString(const CXType &type); ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp: In function ‘String typeString(const CXType&)’: /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:1067:52: error: ‘builtinTypeName’ was not declared in this scope const char builtIn = builtinTypeName(type.kind); ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:1067:52: note: suggested alternative: In file included from /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:16:0: /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.h:556:20: note: ‘RTags::builtinTypeName’ inline const char builtinTypeName(CXTypeKind kind) ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp: In member function ‘virtual void ElispFormatter::format(const Value&, std::function<void(const char, long unsigned int)>) const’: /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:1133:60: error: ‘elispEscape’ was not declared in this scope const String str = elispEscape(value.toString()); ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:1133:60: note: suggested alternative: In file included from /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:16:0: /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.h:888:21: note: ‘RTags::elispEscape’ inline const String elispEscape(const String &data) ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:1139:72: error: ‘elispEscape’ was not declared in this scope const String str = elispEscape(value.toCustom()->toString()); ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:1139:72: note: suggested alternative: In file included from /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:16:0: /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.h:888:21: note: ‘RTags::elispEscape’ inline const String elispEscape(const String &data) ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:1177:85: error: ‘elispEscape’ was not declared in this scope const String str = elispEscape(String::formatTime(value.toDate().time())); ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:1177:85: note: suggested alternative: In file included from /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:16:0: /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.h:888:21: note: ‘RTags::elispEscape’ inline const String elispEscape(const String &data) ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp: At global scope: /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:1189:1: error: expected declaration before ‘}’ token } ^ /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp: In function ‘Location createLocation(const CXCursor&, CXCursorKind, bool, unsigned int*)’: /home/BCSECURE/piotr.romanus/temp/rtags-2.18/src/RTags.cpp:911:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ make[2]: [src/CMakeFiles/rtags.dir/RTags.cpp.o] Error 1 make[1]: [src/CMakeFiles/rtags.dir/all] Error 2 make: *** [all] Error 2

Expected behavior

Describe what you expected to happen. Build should not fail. All prerequisites seems to be satisfied. make.log

Actual behavior

Build failed on "make"

Environment

Centos 7

cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 .. -- The C compiler identification is GNU 4.8.5 -- The CXX compiler identification is GNU 4.8.5 -- 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 -- 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 -- llvm-config executable found: /usr/bin/llvm-config -- Using Clang version 3.4.2 from /usr/lib64/llvm with CXXFLAGS -I/usr/include -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_FORTIFY_SOURCE -- Found LibClang: /usr/lib64/llvm/libclang.so
-- Performing Test LIBCLANG_COMPILES -- Performing Test LIBCLANG_COMPILES - Success -- Found PkgConfig: /usr/bin/pkg-config (found version "0.27.1") -- Looking for backtrace -- Looking for backtrace - found -- Looking for CLOCK_MONOTONIC_RAW -- Looking for CLOCK_MONOTONIC_RAW - found -- Looking for CLOCK_MONOTONIC -- Looking for CLOCK_MONOTONIC - found -- Looking for mach_absolute_time -- Looking for mach_absolute_time - not found -- Looking for inotify_init -- Looking for inotify_init - found -- Looking for kqueue -- Looking for kqueue - not found -- Looking for epoll_wait -- Looking for epoll_wait - found -- Looking for select -- Looking for select - found -- Looking for FD_CLOEXEC -- Looking for FD_CLOEXEC - found -- Looking for SO_NOSIGPIPE -- Looking for SO_NOSIGPIPE - not found -- Looking for MSG_NOSIGNAL -- Looking for MSG_NOSIGNAL - found -- Looking for GetLogicalProcessorInformation -- Looking for GetLogicalProcessorInformation - not found -- Looking for SCHED_IDLE -- Looking for SCHED_IDLE - found -- Looking for SHM_DEST -- Looking for SHM_DEST - found -- Performing Test HAVE_STATMTIM -- Performing Test HAVE_STATMTIM - Success -- Found ZLIB: /usr/lib64/libz.so (found version "1.2.7") -- Found OpenSSL: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so (found version "1.0.2k") -- Performing Test HAVE_CXX11 -- Performing Test HAVE_CXX11 - Success -- Performing Test HAVE_UNORDERDED_MAP_WORKING_MOVE_CONSTRUCTOR -- Performing Test HAVE_UNORDERDED_MAP_WORKING_MOVE_CONSTRUCTOR - Success -- Performing Test HAVE_STRING_ITERATOR_ERASE -- Performing Test HAVE_STRING_ITERATOR_ERASE - Success -- Found CPPUNIT: /usr/lib64/libcppunit.so
-- -- The following OPTIONAL packages have been found:

-- The following REQUIRED packages have been found:

-- Configuring done -- Generating done -- Build files have been written to: /home/BCSECURE/piotr.romanus/temp/rtags-2.18/build

Feature request

Describe the feature we should add to RTags.

myrgy commented 6 years ago

I spent some time trying to build that. Solution for me was to build gcc7, llvm 5 and clang. Don't forget about cmake3 After that I was able to build rtags, Otherwise seems that it's not possible since centos7 has llvm3, cmake2 and gcc4

casch-at commented 6 years ago

Ok guys! Have set up two VM's, one with CentOS 6 (6.8) and one with CentOS 7 (7.5). On CentOS 6 the GCC is to old and LLVM/Clang is not available at all. Here,one would need to compile GCC and LLVM/Clang from source, and Emacs, if one wants to use all the fancy-pancy other RTags packages, as there is only Emacs 23.3 available through the package manager. On CentOS 7, it was enough for me to install the following packages.

yum install git texinfo-tex emacs gcc gcc-g++ flex glibc cmake openssl-devel clang-devel llvm-devel

And than the usual:

git clone --depth 1 --recursive https://github.com/Andersbakken/rtags.git
cd rtags
mkdir build
cd build
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=1
make 
bin/rdm # In other terminal...
bin/rc -J

Must be some other problem. Closing it!

regards, Christian

skok-gpfw commented 4 years ago

I had to update gcc and llvm using redhat's toolset packages: yum install llvm-toolset-7-llvm-devel llvm-toolset-7-clang-devel devtoolset-7-gcc-c++ (and maybe some more) enable them with the command scl enable devtoolset-7 llvm-toolset-7 bash then latest rtags compiles