jucipp icon indicating copy to clipboard operation
jucipp copied to clipboard

Install instructions for rh/other distributions

Open thawkins opened this issue 8 years ago • 22 comments

Jucipp linux builds are based around debian, support for redhat/centos/fedora builds and instructions should be provided.

thawkins avatar Dec 15 '15 00:12 thawkins

Feel free to make a pull request on docs/install.md.

eidheim avatar Dec 15 '15 07:12 eidheim

We should probably also have a contents section on top when this file (docs/install.md) gets more contributions.

eidheim avatar Dec 15 '15 07:12 eidheim

It does compile without additional requirements outside those easily available for Fedora.

I don't know much about the dnf or rpm in general, but the dependencies definitely exist.

epsilon-phase avatar Dec 16 '15 19:12 epsilon-phase

I will try and build out a docker file with a minimal fedora 23 system in it and try to sort out a dnf list to handle the dependancies

thawkins avatar Dec 17 '15 03:12 thawkins

I've tried installing juCi++ on CentOS 7 (current version) by adapting the procedure from Fedora, and these are the results:

  • using sudo yum instead of sudo dnf
  • Boost version is too old, it's 1.53 there, but CMakeLists.txt of juCi++ requests 1.54
  • gtksourceviewmm doesn't exist as a package in any version
  • there's no aspell-en

I'd say we don't need to support it :P

milleniumbug avatar Mar 30 '16 23:03 milleniumbug

Thank you, removing CentOS from the title then.

eidheim avatar Mar 31 '16 06:03 eidheim

I've tried installing juCi++ on openSuSE Leap 42, it can create and compile a hello world example, but it can't parse it with Clang (libclang: crash detected during reparsing gets written on stderr). Also, the debugger crashes in Clang's code. If anyone's willing to investigate more, here are dependencies necessary for build:

sudo zypper install git CMake make gcc-c++ llvm-clang-devel llvm-clang lldb-devel boost-devel gtksourceviewmm-devel gtkmm3-devel aspell-devel aspell-en

Building it is identical as in other Linux distributions:

git clone --recursive https://github.com/cppit/jucipp
mkdir jucipp/build
cd jucipp/build
cmake -DCMAKE_CXX_COMPILER=g++ ..
make
sudo make install

milleniumbug avatar Apr 15 '16 15:04 milleniumbug

The libclang crash also happens on Gentoo. That's what I get when I run it under lldb:

Process 5968 stopped

  • thread #7: tid = 6006, 0x00007fffea6042a0 libclangLex.so.3.8clang::TokenLexer::Lex(clang::Token&) + 368, name = 'juci', stop reason = signal SIGSEGV: invalid address (fault address: 0x20007) frame #0: 0x00007fffea6042a0 libclangLex.so.3.8clang::TokenLexer::Lex(clang::Token&) + 368 libclangLex.so.3.8`clang::TokenLexer::Lex: -> 0x7fffea6042a0 <+368>: movzwl (%r12), %eax 0x7fffea6042a5 <+373>: andw $0x1ff, %ax ; imm = 0x1FF 0x7fffea6042a9 <+377>: movw %ax, 0x10(%rbp) 0x7fffea6042ad <+381>: testb $0x4, 0x3(%r12)

ramonacat avatar Jun 01 '16 21:06 ramonacat

I do believe that the reason for the segfault is inside libclangmm, as the tests for it also do segfault, altough I don't have enough knowledge/experience to debug further. Can someone smarter than me have a look at it? :)

ramonacat avatar Jun 03 '16 17:06 ramonacat

The tests in libclangmm has not been updated in a while, and they have to be rewritten in glib (g_assert_cmpstr/g_assert_cmpint) to make understandable output I think, and for libclang to help writing them (less use of defines).

eidheim avatar Jun 03 '16 18:06 eidheim

@agares if you could give me instructions on how to install the dependencies on Gentoo, I could have a look in a Gentoo docker image. Not quite sure which docker image to use for Gentoo though, maybe you know a decent one?

eidheim avatar Jun 03 '16 19:06 eidheim

OpenSuse's libclang crashes whenever for instance #include <iostream> is added: libclang: crash detected during reparsing:

bash-4.2# lldb ./tests/source_clang_test 
(lldb) target create "./tests/source_clang_test"
Current executable set to './tests/source_clang_test' (x86_64).
(lldb) run
Process 2728 launched: './tests/source_clang_test' (x86_64)

** (source_clang_test:2728): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-FEHh3wC3Kg: Connection refused
Process 2728 stopped
* thread #2: tid = 2734, 0x00007fffeba468f8 libclangLex.so.3.7`clang::TokenLexer::Lex(clang::Token&) + 744, name = 'source_clang_te', stop reason = signal SIGSEGV: invalid address (fault address: 0x20007)
    frame #0: 0x00007fffeba468f8 libclangLex.so.3.7`clang::TokenLexer::Lex(clang::Token&) + 744
libclangLex.so.3.7`clang::TokenLexer::Lex:
->  0x7fffeba468f8 <+744>: andw   (%r15), %ax
    0x7fffeba468fc <+748>: movw   %ax, 0x10(%r14)
    0x7fffeba46901 <+753>: testb  $0x4, 0x3(%r15)
    0x7fffeba46906 <+758>: sete   %al
(lldb) bt
* thread #2: tid = 2734, 0x00007fffeba468f8 libclangLex.so.3.7`clang::TokenLexer::Lex(clang::Token&) + 744, name = 'source_clang_te', stop reason = signal SIGSEGV: invalid address (fault address: 0x20007)
  * frame #0: 0x00007fffeba468f8 libclangLex.so.3.7`clang::TokenLexer::Lex(clang::Token&) + 744
    frame #1: 0x00007fffeba42d26 libclangLex.so.3.7`clang::Preprocessor::Lex(clang::Token&) + 102
    frame #2: 0x00007fffe2c3f424 libclangParse.so.3.7`clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) + 116
    frame #3: 0x00007fffe2bfb9e8 libclangParse.so.3.7`clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&) + 4280
    frame #4: 0x00007fffe2bf6224 libclangParse.so.3.7`clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState) + 1044
    frame #5: 0x00007fffe2bf3bb4 libclangParse.so.3.7`clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*, true>, clang::prec::Level) + 1412
    frame #6: 0x00007fffe2bf3623 libclangParse.so.3.7`clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 227
    frame #7: 0x00007fffe2bfb501 libclangParse.so.3.7`clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&) + 3025
    frame #8: 0x00007fffe2bf6224 libclangParse.so.3.7`clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState) + 1044
    frame #9: 0x00007fffe2bf35c2 libclangParse.so.3.7`clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 130
    frame #10: 0x00007fffe2bef25e libclangParse.so.3.7`clang::Parser::ParseCXXMemberInitializer(clang::Decl*, bool, clang::SourceLocation&) + 830
    frame #11: 0x00007fffe2bedf96 libclangParse.so.3.7`clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::AttributeList*, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject*) + 5334
    frame #12: 0x00007fffe2bea268 libclangParse.so.3.7`clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int, clang::Decl*) + 3048
    frame #13: 0x00007fffe2be849e libclangParse.so.3.7`clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::Parser::ParsedAttributesWithRange&) + 7070
    frame #14: 0x00007fffe2bce313 libclangParse.so.3.7`clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 723
    frame #15: 0x00007fffe2c36487 libclangParse.so.3.7`clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 823
    frame #16: 0x00007fffe2c35ec6 libclangParse.so.3.7`clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int, clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 1174
    frame #17: 0x00007fffe2c358b4 libclangParse.so.3.7`clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int, clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 212
    frame #18: 0x00007fffe2bcdab0 libclangParse.so.3.7`clang::Parser::ParseDeclaration(unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 432
    frame #19: 0x00007fffe2c411db libclangParse.so.3.7`clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) + 3131
    frame #20: 0x00007fffe2be2d10 libclangParse.so.3.7`clang::Parser::ParseInnerNamespace(std::vector<clang::SourceLocation, std::allocator<clang::SourceLocation> >&, std::vector<clang::IdentifierInfo*, std::allocator<clang::IdentifierInfo*> >&, std::vector<clang::SourceLocation, std::allocator<clang::SourceLocation> >&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) + 288
    frame #21: 0x00007fffe2be2699 libclangParse.so.3.7`clang::Parser::ParseNamespace(unsigned int, clang::SourceLocation&, clang::SourceLocation) + 4601
    frame #22: 0x00007fffe2bcd9ea libclangParse.so.3.7`clang::Parser::ParseDeclaration(unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 234
    frame #23: 0x00007fffe2c411db libclangParse.so.3.7`clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) + 3131
    frame #24: 0x00007fffe2c404da libclangParse.so.3.7`clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 410
    frame #25: 0x00007fffe2bc1356 libclangParse.so.3.7`clang::ParseAST(clang::Sema&, bool, bool) + 406
    frame #26: 0x00007fffebf06e79 libclangFrontend.so.3.7`clang::FrontendAction::Execute() + 57
    frame #27: 0x00007fffebeb7b64 libclangFrontend.so.3.7`clang::ASTUnit::Parse(std::shared_ptr<clang::PCHContainerOperations>, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >) + 1860
    frame #28: 0x00007fffebebd88b libclangFrontend.so.3.7`clang::ASTUnit::Reparse(std::shared_ptr<clang::PCHContainerOperations>, llvm::ArrayRef<std::pair<std::string, llvm::MemoryBuffer*> >) + 923
    frame #29: 0x00007ffff34a349c libclang.so.3.7`??? + 700
    frame #30: 0x00007fffe330ca90 libLLVMSupport.so.3.7`llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 192
    frame #31: 0x00007fffe330cb84 libLLVMSupport.so.3.7`??? + 20
    frame #32: 0x00007fffe3367a9a libLLVMSupport.so.3.7`??? + 10
    frame #33: 0x00007ffff1ac50a4 libpthread.so.0`start_thread + 196
    frame #34: 0x00007ffff17f9fed libc.so.6`__clone + 109

eidheim avatar Jun 03 '16 20:06 eidheim

@Agares this seems like a libclang issue on both OpenSuse and Gentoo. I would suggest reporting the issue at Gentoo/OpenSuse.

eidheim avatar Jun 03 '16 20:06 eidheim

Hello there. I use Opensuse and I'm interested in seeing this fixed. How do I compile the tests? Creating a build/ folder inside tests/ and running cmake there doesn't seem to work.

~/A/j/t/build (master|?) $ cmake -DCMAKE_CXX_COMPILER=g++ ..
-- The C compiler identification is GNU 6.3.1
-- The CXX compiler identification is GNU 6.3.1
-- 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
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.7)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
CMake Error at CMakeLists.txt:60 (add_executable):
  Error evaluating generator expression:

    $<TARGET_OBJECTS:project_shared>

  Objects of target "project_shared" referenced but no such target exists.


CMake Error at CMakeLists.txt:47 (add_executable):
  Error evaluating generator expression:

    $<TARGET_OBJECTS:project_shared>

  Objects of target "project_shared" referenced but no such target exists.


CMake Error at CMakeLists.txt:17 (add_executable):
  Error evaluating generator expression:

    $<TARGET_OBJECTS:project_shared>

  Objects of target "project_shared" referenced but no such target exists.


CMake Error at CMakeLists.txt:37 (add_executable):
  Error evaluating generator expression:

    $<TARGET_OBJECTS:project_shared>

  Objects of target "project_shared" referenced but no such target exists.


CMake Error at CMakeLists.txt:22 (add_executable):
  Error evaluating generator expression:

    $<TARGET_OBJECTS:project_shared>

  Objects of target "project_shared" referenced but no such target exists.


CMake Error at CMakeLists.txt:42 (add_executable):
  Error evaluating generator expression:

    $<TARGET_OBJECTS:project_shared>

  Objects of target "project_shared" referenced but no such target exists.


CMake Error at CMakeLists.txt:27 (add_executable):
  Error evaluating generator expression:

    $<TARGET_OBJECTS:project_shared>

  Objects of target "project_shared" referenced but no such target exists.


CMake Error at CMakeLists.txt:32 (add_executable):
  Error evaluating generator expression:

    $<TARGET_OBJECTS:project_shared>

  Objects of target "project_shared" referenced but no such target exists.


CMake Error: CMake can not determine linker language for target: git_test
CMake Error: Cannot determine link language for target "git_test".
CMake Error: CMake can not determine linker language for target: source_clang_test
CMake Error: Cannot determine link language for target "source_clang_test".
CMake Error: CMake can not determine linker language for target: process_test
CMake Error: Cannot determine link language for target "process_test".
CMake Error: CMake can not determine linker language for target: meson_build_test
CMake Error: Cannot determine link language for target "meson_build_test".
CMake Error: CMake can not determine linker language for target: compile_commands_test
CMake Error: Cannot determine link language for target "compile_commands_test".
CMake Error: CMake can not determine linker language for target: source_test
CMake Error: Cannot determine link language for target "source_test".
CMake Error: CMake can not determine linker language for target: filesystem_test
CMake Error: Cannot determine link language for target "filesystem_test".
CMake Error: CMake can not determine linker language for target: cmake_build_test
CMake Error: Cannot determine link language for target "cmake_build_test".
-- Generating done
-- Build files have been written to: /home/julian/Aplicaciones/jucipp/tests/build

~/A/j/t/build (master|?) $ make
Scanning dependencies of target git_test
make[2]: *** No rule to make target 'CMakeFiles/git_test.dir/build'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/git_test.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

junrrein avatar May 05 '17 17:05 junrrein

@junrrein, from the repository root path:

mkdir build
cd build
cmake -DENABLE_TESTING=1 ..
make # or for instance depending on number of cores and memory available: make -j4
make test

eidheim avatar May 05 '17 18:05 eidheim

@eidheim Thanks for the instructions.

On one hand, I can hit the same issue you did when adding #include <iostream> to the souce_clang_text main.cpp file.

On the other hand, I'm not sure what exactly to report to my distro. What is going on? Is there a minimal test case that reproduces this isse? (like trying to parse the same string using libclang, wihout using libclangmm perpahps?).

I don't really know how to proceed from here.

junrrein avatar May 05 '17 20:05 junrrein

@junrrein Thank you for looking into this. I'll see if I can make a minimal test case using libclang only Tomorrow morning.

eidheim avatar May 05 '17 20:05 eidheim

@junrrein It seems that the crash happens due to some library conflict. I did: sudo docker run -ti opensuse:latest bash and after installing gcc6-c++ and the rest of the dependencies I replaced tests/source_clang_test.cc with:

#include <clang-c/Index.h>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
  auto index = clang_createIndex(1, 1);
  
  vector<const char*> args;
  
  string buffer=R"(
#include<iostream>

int main() {}
)";
  
  auto flags=CXTranslationUnit_CacheCompletionResults | CXTranslationUnit_PrecompiledPreamble | CXTranslationUnit_Incomplete | CXTranslationUnit_IncludeBriefCommentsInCodeCompletion;
  
  CXUnsavedFile files[1];
  files[0].Filename="/root/jucipp/tests/source_clang_test_files/main.cpp";
  files[0].Contents=buffer.c_str();
  files[0].Length=buffer.size();
  auto tu = clang_parseTranslationUnit(index, "/root/jucipp/tests/source_clang_test_files/main.cpp", args.data(), args.size(), files, 1, flags);
  
  clang_disposeTranslationUnit(tu);
}

and built jucipp with tests. After, when running /root/jucipp/build/tests/source_clang_test, libclang crashes.

However if I compile source_clang_test.cc with g++-6 -std=c++1y -lclang source_clang_test.cc it works fine.

My guess is that there is some naming conflicts between the libraries that jucipp uses in OpenSuse. It is strange that only OpenSuse has this problem, one might want to look at the patches they apply for the various used libraries.

eidheim avatar May 06 '17 08:05 eidheim

Ok, the conflicting library was actually libclangmm. I did the following in the libclangmm submodule and its src directory:

sed -i "s/namespace clang/namespace clangmm/g" *
sed -i "s/clang::/clangmm::/g" *

and hopefully, after recompliling, juCi++ should then work under OpenSuse. I'll fix the libclangmm repository soon, and update the submodule for jucipp master as well.

edit: you must run sed -i "s/clang::/clangmm::/g" * in the jucipp/src directory as well.

eidheim avatar May 06 '17 09:05 eidheim

@junrrein I just pushed the changes to master, juCi++ should now work on OpenSuse (at least the tests run successfully). Thank you for your help in resolving this issue!

eidheim avatar May 06 '17 10:05 eidheim

@junrrein Let me know if you manage to build juCi++ with lldb support on OpenSuse. It seems to be missing the lldb header files. And feel free to add OpenSuse to the installation document:)

eidheim avatar May 07 '17 06:05 eidheim

@eidheim Sorry for disappearing! Somehow the notifications got filtered out from my email inbox.

I can now build and use jCi++ without issue! I do have the lldb header files, but I'm running Opensuse Tumbleweed (rolling release).

I'll update the installation instructions and submit a pull request.

Thanks!

junrrein avatar May 13 '17 14:05 junrrein