[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[creduce-dev] Build creduce on Arch Linux
Hello,
I tried building https://embed.cs.utah.edu/creduce/creduce-2.10.0.tar.gz
on Arch Linux. Turns out that it only works if I apply the patch
attached (that I wrote). I suspect the reason for this lies in the
version of libclang being used. I installed libclang.so using "pacman -S
clang". The version is:
$ pacman -Q clang
clang 11.0.0-4
Can we somehow make the newest creduce commit
(https://github.com/csmith-project/creduce) work both on Arch Linux and
other machines? I think we need to check the version of libclang in a
#ifdef.
Greetings
Volker Weißmann
diff -ur original/creduce-2.10.0/clang_delta/CMakeLists.txt myfork/creduce-2.10.0/clang_delta/CMakeLists.txt
--- original/creduce-2.10.0/clang_delta/CMakeLists.txt 2019-05-13 23:17:30.000000000 +0200
+++ myfork/creduce-2.10.0/clang_delta/CMakeLists.txt 2020-12-29 01:36:11.522510944 +0100
@@ -86,24 +86,7 @@
)
set(CLANG_LIBS
- clangStaticAnalyzerFrontend
- clangStaticAnalyzerCheckers
- clangStaticAnalyzerCore
- clangFrontendTool
- clangFrontend
- clangDriver
- clangSerialization
- clangCodeGen
- clangParse
- clangSema
- clangAnalysis
- clangRewriteFrontend
- clangRewrite
- clangAST
- clangBasic
- clangEdit
- clangLex
- clangARCMigrate
+ clang-cpp
)
add_executable(clang_delta
diff -ur original/creduce-2.10.0/clang_delta/CommonRenameClassRewriteVisitor.h myfork/creduce-2.10.0/clang_delta/CommonRenameClassRewriteVisitor.h
--- original/creduce-2.10.0/clang_delta/CommonRenameClassRewriteVisitor.h 2019-05-13 23:17:30.000000000 +0200
+++ myfork/creduce-2.10.0/clang_delta/CommonRenameClassRewriteVisitor.h 2020-12-29 01:36:11.519177605 +0100
@@ -98,7 +98,7 @@
return true;
IdentifierInfo *IdInfo = DeclName.getAsIdentifierInfo();
- std::string IdName = IdInfo->getName();
+ std::string IdName = IdInfo->getName().data();
std::string Name;
if (getNewNameByName(IdName, Name)) {
SourceLocation LocStart = NameInfo.getBeginLoc();
@@ -332,7 +332,7 @@
TransAssert(DTST && "Bad DependentTemplateSpecializationType!");
const IdentifierInfo *IdInfo = DTST->getIdentifier();
- std::string IdName = IdInfo->getName();
+ std::string IdName = IdInfo->getName().data();
std::string Name;
if (getNewNameByName(IdName, Name)) {
SourceLocation LocStart = DTSLoc.getTemplateNameLoc();
diff -ur original/creduce-2.10.0/clang_delta/Makefile.am myfork/creduce-2.10.0/clang_delta/Makefile.am
--- original/creduce-2.10.0/clang_delta/Makefile.am 2019-05-13 23:17:30.000000000 +0200
+++ myfork/creduce-2.10.0/clang_delta/Makefile.am 2020-12-29 01:36:11.519177605 +0100
@@ -128,12 +128,7 @@
# libraries. So probably, we could move `LLVMLDFLAGS' back to the definition
# of `clang_delta_LDFLAGS'. I'll do that later.
clang_delta_LDADD = \
- -lclangStaticAnalyzerFrontend -lclangStaticAnalyzerCheckers \
- -lclangStaticAnalyzerCore \
- -lclangFrontendTool -lclangFrontend -lclangDriver -lclangSerialization \
- -lclangCodeGen -lclangParse -lclangSema -lclangAnalysis \
- -lclangRewriteFrontend -lclangRewrite -lclangAST -lclangBasic -lclangEdit -lclangLex \
- -lclangARCMigrate \
+ -lclang-cpp \
$(LLVMLIBS) \
$(CLANG_LDFLAGS) \
$(LLVMLDFLAGS)
diff -ur original/creduce-2.10.0/clang_delta/Makefile.in myfork/creduce-2.10.0/clang_delta/Makefile.in
--- original/creduce-2.10.0/clang_delta/Makefile.in 2019-05-13 23:17:30.000000000 +0200
+++ myfork/creduce-2.10.0/clang_delta/Makefile.in 2020-12-29 01:36:11.519177605 +0100
@@ -575,12 +575,7 @@
# libraries. So probably, we could move `LLVMLDFLAGS' back to the definition
# of `clang_delta_LDFLAGS'. I'll do that later.
clang_delta_LDADD = \
- -lclangStaticAnalyzerFrontend -lclangStaticAnalyzerCheckers \
- -lclangStaticAnalyzerCore \
- -lclangFrontendTool -lclangFrontend -lclangDriver -lclangSerialization \
- -lclangCodeGen -lclangParse -lclangSema -lclangAnalysis \
- -lclangRewriteFrontend -lclangRewrite -lclangAST -lclangBasic -lclangEdit -lclangLex \
- -lclangARCMigrate \
+ -lclang-cpp \
$(LLVMLIBS) \
$(CLANG_LDFLAGS) \
$(LLVMLDFLAGS)
diff -ur original/creduce-2.10.0/clang_delta/RemoveNamespace.cpp myfork/creduce-2.10.0/clang_delta/RemoveNamespace.cpp
--- original/creduce-2.10.0/clang_delta/RemoveNamespace.cpp 2019-05-13 23:17:30.000000000 +0200
+++ myfork/creduce-2.10.0/clang_delta/RemoveNamespace.cpp 2020-12-29 01:36:11.522510944 +0100
@@ -458,7 +458,7 @@
TransAssert(DTST && "Bad DependentTemplateSpecializationType!");
const IdentifierInfo *IdInfo = DTST->getIdentifier();
- std::string IdName = IdInfo->getName();
+ std::string IdName = IdInfo->getName().data();
std::string Name;
// FIXME:
diff -ur original/creduce-2.10.0/clang_delta/RewriteUtils.cpp myfork/creduce-2.10.0/clang_delta/RewriteUtils.cpp
--- original/creduce-2.10.0/clang_delta/RewriteUtils.cpp 2019-05-13 23:17:30.000000000 +0200
+++ myfork/creduce-2.10.0/clang_delta/RewriteUtils.cpp 2020-12-29 01:36:11.519177605 +0100
@@ -730,7 +730,7 @@
++I;
indentSpace = MB.substr(lineOffs, I-lineOffs);
- return indentSpace;
+ return indentSpace.data();
}
bool RewriteUtils::addLocalVarToFunc(const std::string &VarStr,
diff -ur original/creduce-2.10.0/clang_delta/Transformation.cpp myfork/creduce-2.10.0/clang_delta/Transformation.cpp
--- original/creduce-2.10.0/clang_delta/Transformation.cpp 2019-05-13 23:17:30.000000000 +0200
+++ myfork/creduce-2.10.0/clang_delta/Transformation.cpp 2020-12-29 01:36:11.499177577 +0100
@@ -357,7 +357,7 @@
llvm::SmallString<8> IntStr;
Result.toStringUnsigned(IntStr);
- std::stringstream TmpSS(IntStr.str());
+ std::stringstream TmpSS(IntStr.str().data());
if (!(TmpSS >> Sz)) {
TransAssert(0 && "Non-integer value!");
diff -ur original/creduce-2.10.0/clang_delta/TransformationManager.cpp myfork/creduce-2.10.0/clang_delta/TransformationManager.cpp
--- original/creduce-2.10.0/clang_delta/TransformationManager.cpp 2019-05-13 23:17:30.000000000 +0200
+++ myfork/creduce-2.10.0/clang_delta/TransformationManager.cpp 2020-12-29 01:36:11.519177605 +0100
@@ -18,6 +18,8 @@
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/TargetInfo.h"
+#include "clang/Basic/FileManager.h"
+#include "clang/Basic/Builtins.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Parse/ParseAST.h"
@@ -101,16 +103,16 @@
CompilerInvocation &Invocation = ClangInstance->getInvocation();
InputKind IK = FrontendOptions::getInputKindForExtension(
StringRef(SrcFileName).rsplit('.').second);
- if (IK.getLanguage() == InputKind::C) {
- Invocation.setLangDefaults(ClangInstance->getLangOpts(), InputKind::C, T, PPOpts);
+ if (IK.getLanguage() == clang::Language::C) {
+ Invocation.setLangDefaults(ClangInstance->getLangOpts(), clang::Language::C, T, PPOpts);
}
- else if (IK.getLanguage() == InputKind::CXX) {
+ else if (IK.getLanguage() == clang::Language::CXX) {
// ISSUE: it might cause some problems when building AST
// for a function which has a non-declared callee, e.g.,
// It results an empty AST for the caller.
- Invocation.setLangDefaults(ClangInstance->getLangOpts(), InputKind::CXX, T, PPOpts);
+ Invocation.setLangDefaults(ClangInstance->getLangOpts(), clang::Language::CXX, T, PPOpts);
}
- else if(IK.getLanguage() == InputKind::OpenCL) {
+ else if(IK.getLanguage() == clang::Language::OpenCL) {
//Commandline parameters
std::vector<const char*> Args;
Args.push_back("-x");
@@ -122,7 +124,7 @@
ClangInstance->createFileManager();
if(CLCPath != NULL && ClangInstance->hasFileManager() &&
- ClangInstance->getFileManager().getDirectory(CLCPath, false) != NULL) {
+ ClangInstance->getFileManager().getDirectory(CLCPath, false)) {
Args.push_back("-I");
Args.push_back(CLCPath);
}
@@ -132,10 +134,10 @@
Args.push_back("-fno-builtin");
CompilerInvocation::CreateFromArgs(Invocation,
- &Args[0], &Args[0] + Args.size(),
+ llvm::ArrayRef<const char*>(&Args[0], Args.size()),
ClangInstance->getDiagnostics());
Invocation.setLangDefaults(ClangInstance->getLangOpts(),
- InputKind::OpenCL, T, PPOpts);
+ clang::Language::OpenCL, T, PPOpts);
}
else {
ErrorMsg = "Unsupported file type!";