Vinculando-se ao clang-llvm
Eu tenho trabalhado em uma pequena ferramenta com o clang / llvm, mas não consegui obter com êxito o vinculador do g ++ e do gnu para vincular corretamente meu código ao clang.
meu vinculador está gerando os seguintes erros:
undefined reference to `clang::FileManager::~FileManager()'
undefined reference to `clang::FileManager::FileManager()'
undefined reference to `llvm::sys::getHostTriple()'
undefined reference to `clang::Diagnostic::Diagnostic(clang::DiagnosticClient*)'
undefined reference to `llvm::outs()'
undefined reference to `clang::TargetInfo::CreateTargetInfo(clang::Diagnostic&, clang::TargetOptions&)'
undefined reference to `clang::SourceManager::getOrCreateContentCache(clang::FileEntry const*)'
undefined reference to `clang::SourceManager::createFileID(clang::SrcMgr::ContentCache const*, clang::SourceLocation, clang::SrcMgr::CharacteristicKind, unsigned int, unsigned int)'
meus comandos de compilação ficam assim:
g++ -g -fno-rtti -I~/llvm-2.8/tools/clang-2.8/include \
-I~/llvm-2.8/llvm/include \
`~/bin/llvm-config --cxxflags` \
-c Frontend.cpp
g++ -g -fno-rtti -I~/llvm-2.8/tools/clang-2.8/include \
-I~/llvm-2.8/llvm/include \
`~/bin/llvm-config --cxxflags` \
-c exec.cpp
g++ -I~/llvm-2.8/tools/clang-2.8/include \
-I~/llvm-2.8/llvm/include -L~/opt/lib/ \
-g -fno-rtti -lclangDriver -lclangAnalysis \
-lclangFrontend -lclangSema -lclangAST -lclangParse \
-lclangLex -lclangBasic \
`~/bin/llvm-config --cxxflags --ldflags --libs` \
Frontend.o exec.o -o run
quaisquer dicas ou conselhos serão bem-vindos.
Saúde, ct
PS: Estive explorando algumas das informações desta página:
http://ubuntuforums.org/showthread.php?t=532693
e pode funcionar, postarei um comentário sobre essa dica quando puder.
Soluçãousando o código clang deste tutorial (que teve que ser modificado para remover as referências a FileSystemOptions b / c clang / Basic / FileSystemOptions.h não existe no clang-2.8):http://clangtutorial.codeplex.com/
g++ tutorial1.cpp -g -fno-rtti -lclangFrontend -lclangDriver \
-lclangCodeGen -lclangSema -lclangChecker -lclangAnalysis \
-lclangRewrite -lclangAST -lclangParse -lclangLex -lclangBasic \
-lLLVMSupport -lLLVMSystem -I~/opt/include/ \
`llvm-config --cxxflags --ldflags --libs all`
parecia fazer o truque!