csmith-project / creduce

C-Reduce, a C and C++ program reducer
Other
1.31k stars 123 forks source link

Automake-made `clang_delta` cannot find LLVM shared libraries #192

Open eeide opened 5 years ago

eeide commented 5 years ago

At the current head of the master branch (118d29c), when

clang_delta may not be able to find the LLVM shared libraries at run time.

This happens because the Automake-based build path does not set the rpath in the clang_delta binary.

I just fixed this problem for the CMake-based build path (commit 118d29c). The message for that commit has some additional info about this problem.

Fixing this problem for the Automake-based build path will probably require an invocation of AC_LIB_HAVE_LINKFLAGS or similar. See https://www.gnu.org/software/gnulib/manual/html_node/Searching-for-Libraries.html

But maybe this will never be fixed, because I might obsolete the Automake-based build path first.

blitz commented 5 years ago

I still see a similar looking problem when trying to build creduce on Fedora 30:

[88/88] Linking CXX executable clang_delta/clang_delta
FAILED: clang_delta/clang_delta
: && /usr/bin/c++  -std=c++11 -fno-rtti -fno-strict-aliasing -Wall -Wextra -Wno-long-long -Wno-unused-parameter -Wno-mi
ssing-field-initializers -fvisibility-inlines-hidden  -rdynamic clang_delta/CMakeFiles/clang_delta.dir/AggregateToScala
r.cpp.o clang_delta/CMakeFiles/clang_delta.dir/BinOpSimplification.cpp.o clang_delta/CMakeFiles/clang_delta.dir/CallExp
rToValue.cpp.o clang_delta/CMakeFiles/clang_delta.dir/ClangDelta.cpp.o clang_delta/CMakeFiles/clang_delta.dir/ClassTemp
lateToClass.cpp.o clang_delta/CMakeFiles/clang_delta.dir/CombineGlobalVarDecl.cpp.o clang_delta/CMakeFiles/clang_delta.
dir/CombineLocalVarDecl.cpp.o clang_delta/CMakeFiles/clang_delta.dir/CopyPropagation.cpp.o clang_delta/CMakeFiles/clang
_delta.dir/EmptyStructToInt.cpp.o clang_delta/CMakeFiles/clang_delta.dir/ExpressionDetector.cpp.o clang_delta/CMakeFile
s/clang_delta.dir/InstantiateTemplateParam.cpp.o clang_delta/CMakeFiles/clang_delta.dir/InstantiateTemplateTypeParamToI
nt.cpp.o clang_delta/CMakeFiles/clang_delta.dir/LiftAssignmentExpr.cpp.o clang_delta/CMakeFiles/clang_delta.dir/LocalTo
Global.cpp.o clang_delta/CMakeFiles/clang_delta.dir/MoveFunctionBody.cpp.o clang_delta/CMakeFiles/clang_delta.dir/MoveG
lobalVar.cpp.o clang_delta/CMakeFiles/clang_delta.dir/ParamToGlobal.cpp.o clang_delta/CMakeFiles/clang_delta.dir/ParamT
oLocal.cpp.o clang_delta/CMakeFiles/clang_delta.dir/ReduceArrayDim.cpp.o clang_delta/CMakeFiles/clang_delta.dir/ReduceA
rraySize.cpp.o clang_delta/CMakeFiles/clang_delta.dir/ReduceClassTemplateParameter.cpp.o clang_delta/CMakeFiles/clang_d
elta.dir/ReducePointerLevel.cpp.o clang_delta/CMakeFiles/clang_delta.dir/ReducePointerPairs.cpp.o clang_delta/CMakeFile
s/clang_delta.dir/RemoveAddrTaken.cpp.o clang_delta/CMakeFiles/clang_delta.dir/RemoveArray.cpp.o clang_delta/CMakeFiles
/clang_delta.dir/RemoveBaseClass.cpp.o clang_delta/CMakeFiles/clang_delta.dir/RemoveCtorInitializer.cpp.o clang_delta/C
MakeFiles/clang_delta.dir/RemoveEnumMemberValue.cpp.o clang_delta/CMakeFiles/clang_delta.dir/RemoveNamespace.cpp.o clan
g_delta/CMakeFiles/clang_delta.dir/RemoveNestedFunction.cpp.o clang_delta/CMakeFiles/clang_delta.dir/RemovePointer.cpp.
o clang_delta/CMakeFiles/clang_delta.dir/RemoveTrivialBaseTemplate.cpp.o clang_delta/CMakeFiles/clang_delta.dir/RemoveU
nresolvedBase.cpp.o clang_delta/CMakeFiles/clang_delta.dir/RemoveUnusedEnumMember.cpp.o clang_delta/CMakeFiles/clang_de
lta.dir/RemoveUnusedFunction.cpp.o clang_delta/CMakeFiles/clang_delta.dir/RemoveUnusedOuterClass.cpp.o clang_delta/CMak
eFiles/clang_delta.dir/RemoveUnusedStructField.cpp.o clang_delta/CMakeFiles/clang_delta.dir/RemoveUnusedVar.cpp.o clang
_delta/CMakeFiles/clang_delta.dir/RenameCXXMethod.cpp.o clang_delta/CMakeFiles/clang_delta.dir/RenameClass.cpp.o clang_
delta/CMakeFiles/clang_delta.dir/RenameFun.cpp.o clang_delta/CMakeFiles/clang_delta.dir/RenameParam.cpp.o clang_delta/C
MakeFiles/clang_delta.dir/RenameVar.cpp.o clang_delta/CMakeFiles/clang_delta.dir/ReplaceArrayAccessWithIndex.cpp.o clan
g_delta/CMakeFiles/clang_delta.dir/ReplaceArrayIndexVar.cpp.o clang_delta/CMakeFiles/clang_delta.dir/ReplaceCallExpr.cp
p.o clang_delta/CMakeFiles/clang_delta.dir/ReplaceClassWithBaseTemplateSpec.cpp.o clang_delta/CMakeFiles/clang_delta.di
r/ReplaceDependentName.cpp.o clang_delta/CMakeFiles/clang_delta.dir/ReplaceDependentTypedef.cpp.o clang_delta/CMakeFile
s/clang_delta.dir/ReplaceDerivedClass.cpp.o clang_delta/CMakeFiles/clang_delta.dir/ReplaceFunctionDefWithDecl.cpp.o cla
ng_delta/CMakeFiles/clang_delta.dir/ReplaceOneLevelTypedefType.cpp.o clang_delta/CMakeFiles/clang_delta.dir/ReplaceSimp
leTypedef.cpp.o clang_delta/CMakeFiles/clang_delta.dir/ReplaceUndefinedFunction.cpp.o clang_delta/CMakeFiles/clang_delt
a.dir/ReturnVoid.cpp.o clang_delta/CMakeFiles/clang_delta.dir/RewriteUtils.cpp.o clang_delta/CMakeFiles/clang_delta.dir
/SimpleInliner.cpp.o clang_delta/CMakeFiles/clang_delta.dir/SimplifyCallExpr.cpp.o clang_delta/CMakeFiles/clang_delta.d
ir/SimplifyCommaExpr.cpp.o clang_delta/CMakeFiles/clang_delta.dir/SimplifyDependentTypedef.cpp.o clang_delta/CMakeFiles
/clang_delta.dir/SimplifyIf.cpp.o clang_delta/CMakeFiles/clang_delta.dir/SimplifyNestedClass.cpp.o clang_delta/CMakeFil
es/clang_delta.dir/SimplifyRecursiveTemplateInstantiation.cpp.o clang_delta/CMakeFiles/clang_delta.dir/SimplifyStruct.c
pp.o clang_delta/CMakeFiles/clang_delta.dir/SimplifyStructUnionDecl.cpp.o clang_delta/CMakeFiles/clang_delta.dir/Templa
teArgToInt.cpp.o clang_delta/CMakeFiles/clang_delta.dir/TemplateNonTypeArgToInt.cpp.o clang_delta/CMakeFiles/clang_delt
a.dir/Transformation.cpp.o clang_delta/CMakeFiles/clang_delta.dir/TransformationManager.cpp.o clang_delta/CMakeFiles/cl
ang_delta.dir/UnifyFunctionDecl.cpp.o clang_delta/CMakeFiles/clang_delta.dir/UnionToStruct.cpp.o clang_delta/CMakeFiles
/clang_delta.dir/VectorToArray.cpp.o clang_delta/CMakeFiles/clang_delta.dir/git_version.cpp.o  -o clang_delta/clang_del
ta  -Wl,-rpath,/usr/lib64 /usr/lib64/libclangStaticAnalyzerFrontend.so.8 /usr/lib64/libclangStaticAnalyzerCheckers.so.8
 /usr/lib64/libclangStaticAnalyzerCore.so.8 /usr/lib64/libclangFrontendTool.so.8 /usr/lib64/libclangFrontend.so.8 /usr/
lib64/libclangDriver.so.8 /usr/lib64/libclangSerialization.so.8 /usr/lib64/libclangCodeGen.so.8 /usr/lib64/libclangPars
e.so.8 /usr/lib64/libclangSema.so.8 /usr/lib64/libclangAnalysis.so.8 /usr/lib64/libclangRewriteFrontend.so.8 /usr/lib64
/libclangRewrite.so.8 /usr/lib64/libclangAST.so.8 /usr/lib64/libclangBasic.so.8 /usr/lib64/libclangEdit.so.8 /usr/lib64
/libclangLex.so.8 /usr/lib64/libclangARCMigrate.so.8 && :
/usr/bin/ld: clang_delta/CMakeFiles/clang_delta.dir/ReplaceArrayIndexVar.cpp.o: undefined reference to symbol '_ZN4llvm
19SmallPtrSetImplBaseC2EPPKvRKS0_@@LLVM_8'
/usr/bin/ld: //usr/lib64/libLLVM-8.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
eeide commented 5 years ago

@blitz, thanks for the information about Fedora 30. I don't have access to that platform.

FWIW, in the output you included, I noticed that you are using Ninja, which means (I assume) that you are using the CMake-based build system for C-Reduce, not the Automake-based build system.

The linking problems under the two systems are probably related, but this issue (#192) is about the problem in the Automake-based build system in particular. It might be worthwhile to create a separate issue for the (CMake-based) problem that you are having.

If you open a new issue, be sure to describe exactly what version of LLVM/Clang you are using and how you built/installed it. Also be sure to describe exactly what version of C-Reduce you are using, exactly what CMake command you ran, exacly wha Ninja command you ran, etc. Thanks!