Quantcast
Channel: Installation and Deployment
Viewing all articles
Browse latest Browse all 22112

Problem using LLVM with Qt 5.0.0 within on Ubuntu

$
0
0
Hi, I use LLVM (3.2) in my project (Qt 5.0.0) and it works as expected on Windows and OS X, but on Ubuntu it just crashes. If I start my application, don’t use any of the LLVM-specific stuff in my application, and try to quit my application, then I get the following debug traces: 0 __memmove_ssse3 memcpy-ssse3.S 1682 0x1348f8c 1 llvm::PassRegistry::removeRegistrationListener(llvm::PassRegistrationListener*) /usr/lib/i386-linux-gnu/libLLVM-3.0.so.1  0xb0278ddb 2 llvm::PassRegistrationListener::~PassRegistrationListener() /usr/lib/i386-linux-gnu/libLLVM-3.0.so.1  0xb026aa06 3 llvm::PassNameParser::~PassNameParser() /usr/lib/i386-linux-gnu/libLLVM-3.0.so.1  0xb026aca2 4 llvm::cl::list<llvm::PassInfo const*, bool, llvm::PassNameParser>::~list() /home/me/myApp/build/plugins/myApp/libLLVM.so  0xb31eb8a4 5 __run_exit_handlers exit.c 78 0x1242f51 6 __GI_exit exit.c 100 0x1242fdd 7 __libc_start_main libc-start.c 258 0x12294db 8 _start   0x8068ca1 If you look at line 4, my application uses my version of LLVM (which I build as a Qt plugin), but then at lines 1, 2 and 3, we can see that my application somehow decided to use the system version of LLVM. Why is that? I have no idea! All I know is that it used to work perfectly fine using Qt 4.8.x. I thought for a moment that it might be related to OpenGL/3D (Qt 5.0.0 uses OpenGL no matter what now, right?), especially since my Ubuntu box is in fact a virtual machine with no 3D acceleration (i.e. Mesa would take over and use llvmpipe?), but I then tried using the Ubuntu live CD (with 3D acceleration), and I got the same result, so I am puzzled… Otherwise, if I manually rename the system version of LLVM (so that my application cannot ‘see’ it), then everything works as expected (i.e. no crash) but I obviously don’t want and, in fact, can’t really do that! FWIW, here is another trace I get when starting my application and then trying to do some LLVM-specific stuff in my application: 0 llvm::FoldingSetNodeID::AddPointer(void const*) /usr/lib/i386-linux-gnu/libLLVM-3.0.so.1  0xb074f37a 1 clang::FunctionProtoType::Profile(llvm::FoldingSetNodeID&, clang::QualType, clang::QualType const*, unsigned int, clang::FunctionProtoType::ExtProtoInfo const&, clang::ASTContext const&) /home/me/myApp/build/libLLVM.so  0x43a6b2e 2 clang::FunctionProtoType::Profile(llvm::FoldingSetNodeID&, clang::ASTContext const&) /home/me/myApp/build/libLLVM.so  0x43a6dd4 3 llvm::ContextualFoldingSet<clang::FunctionProtoType, clang::ASTContext&>::NodeEquals(llvm::FoldingSetImpl::Node*, llvm::FoldingSetNodeID const&, unsigned int, llvm::FoldingSetNodeID&) const /home/me/myApp/build/libLLVM.so  0x427d59f 4 llvm::FoldingSetImpl::FindNodeOrInsertPos(llvm::FoldingSetNodeID const&, void*&) /usr/lib/i386-linux-gnu/libLLVM-3.0.so.1  0xb074fb67 5 clang::ASTContext::getFunctionType(clang::QualType, clang::QualType const*, unsigned int, clang::FunctionProtoType::ExtProtoInfo const&) const /home/me/myApp/build/libLLVM.so  0x426ecbb 6 clang::ASTContext::GetBuiltinType(unsigned int, clang::ASTContext::GetBuiltinTypeError&, unsigned int*) const /home/me/myApp/build/libLLVM.so  0x4274243 7 clang::Sema::LazilyCreateBuiltin(clang::IdentifierInfo*, unsigned int, clang::Scope*, bool, clang::SourceLocation) /home/me/myApp/build/libLLVM.so  0x48baa24 8 ?? /home/me/myApp/build/libLLVM.so  0x49fde04 9 clang::Sema::LookupName(clang::LookupResult&, clang::Scope*, bool) /home/me/myApp/build/libLLVM.so  0x4a03d13 10 clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>) /home/me/myApp/build/libLLVM.so  0x48cb270 11 clang::Sema::ActOnDeclarator(clang::Scope*, clang::Declarator&) /home/me/myApp/build/libLLVM.so  0x48cb8f3 12 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&) /home/me/myApp/build/libLLVM.so  0x47196e1 13 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) /home/me/myApp/build/libLLVM.so  0x4725883 14 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) /home/me/myApp/build/libLLVM.so  0x477563f 15 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) /home/me/myApp/build/libLLVM.so  0x4775d79 16 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) /home/me/myApp/build/libLLVM.so  0x4779c77 17 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) /home/me/myApp/build/libLLVM.so  0x4779f48 18 clang::ParseAST(clang::Sema&, bool, bool) /home/me/myApp/build/libLLVM.so  0x470e49c 19 clang::ASTFrontendAction::ExecuteAction() /home/me/myApp/build/libLLVM.so  0x4671a57 20 clang::CodeGenAction::ExecuteAction() /home/me/myApp/build/libLLVM.so  0x456db42 ... <More>     Again, you can see that sometimes my application uses its version of LLVM while, at other times, it uses the system version of LLVM…!? Now, I wouldn’t expect many people to use LLVM in their project, but… how would you go about handling the case where your application uses its version of a library which is also used by your Linux system?… Cheers, Alan.

Viewing all articles
Browse latest Browse all 22112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>