AliveToolkit / alive2

Automatic verification of LLVM optimizations
MIT License
719 stars 93 forks source link

Unknown command line argument '-tv' #1022

Closed singhsanjana closed 3 months ago

singhsanjana commented 3 months ago

I installed llvm as follows.

cd $LLVM2_HOME
mkdir build
cd build
cmake -GNinja -DLLVM_ENABLE_RTTI=ON -DLLVM_ENABLE_EH=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PROJECTS="llvm;clang" ../llvm
ninja

and alive2 as follows.

cd $ALIVE2_HOME/alive2/build
cmake -GNinja -DCMAKE_PREFIX_PATH=$LLVM2_BUILD -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DBUILD_TV=1 -DCMAKE_BUILD_TYPE=Release ..
ninja

I am using llvm/clang version 14.0.6. There were no errors in the config process, however a tv.so file was not generated. I got the following errors.

Error opening '$ALIVE2_HOME/alive2/build/tv/tv.so': $ALIVE2_HOME/alive2/build/tv/tv.so: cannot open shared object file: No such file or directory
  -load request ignored.
opt: Unknown command line argument '-tv'.  Try: '$LLVM2_HOME/llvm-project/build/bin/opt --help'

How do I perform translation validation? Also, please refer some sample tests for TV and the command to perform TV.

nunoplopes commented 3 months ago

Well, I can't guess what happened given the information you posted. Do a ninja tv/tv.so and make sure it gives no errors. Then check the file exists and has the right permissions. I can't think of anything else.

regehr commented 3 months ago

@singhsanjana you might run ninja -v and send us the output, a configure line like you used should work

singhsanjana commented 3 months ago

Hi @regehr

The steps listed above had resulted in: [46/46] Linking CXX executable alive

However, when I tried ninja again it resulted in errors listed below. Interestingly, another attempt today also resulted in [46/46] Linking CXX executable alive but all other attempts resulted in the errors listed below.

Also the gcc version on my system is 11.4.0, in case that's relevant.

[14/28] Building CXX object CMakeFiles/llvm_util.dir/llvm_util/utils.cpp.o
FAILED: CMakeFiles/llvm_util.dir/llvm_util/utils.cpp.o 
/usr/bin/clang++ -DNO_REDIS_SUPPORT -I/user/singhs/alive2 -I/user/singhs/alive2/build -I/user/singhs/llvm-project/llvm/include -I/user/singhs/llvm-project/build/include -Wall -Werror -fPIC -fstrict-enums  -O3 -O3    -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=c++20 -MD -MT CMakeFiles/llvm_util.dir/llvm_util/utils.cpp.o -MF CMakeFiles/llvm_util.dir/llvm_util/utils.cpp.o.d -o CMakeFiles/llvm_util.dir/llvm_util/utils.cpp.o -c /user/singhs/alive2/llvm_util/utils.cpp
/user/singhs/alive2/llvm_util/utils.cpp:168:16: error: member reference base type 'uint64_t' (aka 'unsigned long') is not a structure or union
        if (ofs.isScalable() || sz.isScalable())
            ~~~^~~~~~~~~~~
/user/singhs/alive2/llvm_util/utils.cpp:181:21: error: member reference base type 'llvm::LinearPolySize<llvm::TypeSize>::ScalarTy' (aka 'unsigned long') is not a structure or union
        if (ofs_next.isScalable())
            ~~~~~~~~^~~~~~~~~~~
/user/singhs/alive2/llvm_util/utils.cpp:351:22: error: no member named 'value_or' in 'llvm::MaybeAlign'
      fn->getAlign().value_or(llvm::Align(8)).value(), true, true);
      ~~~~~~~~~~~~~~ ^
3 errors generated.
[16/28] Building CXX object CMakeFiles/llvm_util.dir/llvm_util/llvm2alive.cpp.o
FAILED: CMakeFiles/llvm_util.dir/llvm_util/llvm2alive.cpp.o 
/usr/bin/clang++ -DNO_REDIS_SUPPORT -I/user/singhs/alive2 -I/user/singhs/alive2/build -I/user/singhs/llvm-project/llvm/include -I/user/singhs/llvm-project/build/include -Wall -Werror -fPIC -fstrict-enums  -O3 -O3    -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=c++20 -MD -MT CMakeFiles/llvm_util.dir/llvm_util/llvm2alive.cpp.o -MF CMakeFiles/llvm_util.dir/llvm_util/llvm2alive.cpp.o.d -o CMakeFiles/llvm_util.dir/llvm_util/llvm2alive.cpp.o -c /user/singhs/alive2/llvm_util/llvm2alive.cpp
/user/singhs/alive2/llvm_util/llvm2alive.cpp:18:10: fatal error: 'llvm/Support/ModRef.h' file not found
#include "llvm/Support/ModRef.h"
         ^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[17/28] Building CXX object CMakeFiles/alive-exec.dir/tools/alive-exec.cpp.o
FAILED: CMakeFiles/alive-exec.dir/tools/alive-exec.cpp.o 
/usr/bin/clang++ -DNO_REDIS_SUPPORT -I/user/singhs/alive2 -I/user/singhs/alive2/build -I/user/singhs/llvm-project/llvm/include -I/user/singhs/llvm-project/build/include -Wall -Werror -fPIC -fstrict-enums  -O3 -O3    -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=c++20 -MD -MT CMakeFiles/alive-exec.dir/tools/alive-exec.cpp.o -MF CMakeFiles/alive-exec.dir/tools/alive-exec.cpp.o.d -o CMakeFiles/alive-exec.dir/tools/alive-exec.cpp.o -c /user/singhs/alive2/tools/alive-exec.cpp
/user/singhs/alive2/tools/alive-exec.cpp:21:10: fatal error: 'llvm/TargetParser/Triple.h' file not found
#include "llvm/TargetParser/Triple.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[19/28] Building CXX object CMakeFiles/quick-fuzz.dir/tools/quick-fuzz.cpp.o
FAILED: CMakeFiles/quick-fuzz.dir/tools/quick-fuzz.cpp.o 
/usr/bin/clang++ -DNO_REDIS_SUPPORT -I/user/singhs/alive2 -I/user/singhs/alive2/build -I/user/singhs/llvm-project/llvm/include -I/user/singhs/llvm-project/build/include -Wall -Werror -fPIC -fstrict-enums  -O3 -O3    -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=c++20 -MD -MT CMakeFiles/quick-fuzz.dir/tools/quick-fuzz.cpp.o -MF CMakeFiles/quick-fuzz.dir/tools/quick-fuzz.cpp.o.d -o CMakeFiles/quick-fuzz.dir/tools/quick-fuzz.cpp.o -c /user/singhs/alive2/tools/quick-fuzz.cpp
/user/singhs/alive2/tools/quick-fuzz.cpp:27:10: fatal error: 'llvm/TargetParser/Triple.h' file not found
#include "llvm/TargetParser/Triple.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[20/28] Building CXX object CMakeFiles/alive-tv.dir/tools/alive-tv.cpp.o
FAILED: CMakeFiles/alive-tv.dir/tools/alive-tv.cpp.o 
/usr/bin/clang++ -DNO_REDIS_SUPPORT -I/user/singhs/alive2 -I/user/singhs/alive2/build -I/user/singhs/llvm-project/llvm/include -I/user/singhs/llvm-project/build/include -Wall -Werror -fPIC -fstrict-enums  -O3 -O3    -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=c++20 -MD -MT CMakeFiles/alive-tv.dir/tools/alive-tv.cpp.o -MF CMakeFiles/alive-tv.dir/tools/alive-tv.cpp.o.d -o CMakeFiles/alive-tv.dir/tools/alive-tv.cpp.o -c /user/singhs/alive2/tools/alive-tv.cpp
/user/singhs/alive2/tools/alive-tv.cpp:24:10: fatal error: 'llvm/TargetParser/Triple.h' file not found
#include "llvm/TargetParser/Triple.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[21/28] Building CXX object tv/CMakeFiles/tv.dir/tv.cpp.o
FAILED: tv/CMakeFiles/tv.dir/tv.cpp.o 
/usr/bin/clang++ -DNO_REDIS_SUPPORT -I/user/singhs/alive2 -I/user/singhs/alive2/build -I/user/singhs/llvm-project/llvm/include -I/user/singhs/llvm-project/build/include -Wall -Werror -fPIC -fstrict-enums  -O3 -O3  -fPIC   -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=c++20 -MD -MT tv/CMakeFiles/tv.dir/tv.cpp.o -MF tv/CMakeFiles/tv.dir/tv.cpp.o.d -o tv/CMakeFiles/tv.dir/tv.cpp.o -c /user/singhs/alive2/tv/tv.cpp
/user/singhs/alive2/tv/tv.cpp:21:10: fatal error: 'llvm/TargetParser/Triple.h' file not found
#include "llvm/TargetParser/Triple.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
[22/28] Building CXX object CMakeFiles/alive.dir/tools/alive_parser.cpp.o
ninja: build stopped: subcommand failed.
nunoplopes commented 3 months ago

You're compiling against an old version of LLVM.

singhsanjana commented 3 months ago

I am using the LLVM built at $LLVM2_BUILD and version of that is 14.0.6

$LLVM2_BUILD/bin/clang --version
clang version 14.0.6
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /user/singhs/llvm-project/build/bin
nunoplopes commented 3 months ago

Yes, that's super old. We only support the latest git version.

singhsanjana commented 3 months ago

I can see that LLVM 18.1.2 as the latest release. I will switch to that. Thank you very much for your prompt support.