You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, I'd like to say HUGE THANK YOU for writing this detailed manual!
Background: I needed to file a bug about crash in LLVM 10, 11, and 12, and would give up without your help.
(A crashed LLVM generates rec-something.sh and rec-something.cpp files, but these tend to be huge for large projects with lots of includes, and https://llvm.org/docs/HowToSubmitABug.html requests people filing bugs to minimize them using C-Reduce)
There were some modifications I had to apply to your steps, and I thought I'll share them here, while I still remember (most of) them.
I'm on Windows 10, with VS 2019 Enterprise and GitBash.
• I had both ActivePerl and Strawberry Perl installed, which made cpan commands from your guide fail in strange ways, and this was resolved by simply uninstalling the ActivePerl and redoing the cpan commands
• It turned out that at some point Python3 was needed (I don't remember at which stage, I believe it was one of the cpan packages unittests or something?), so I had to install it. It is also helpful for running the creduce-clang-crash.py later)
• The unifdef repository got inaccessible:
$ git clone git://dotat.at/unifdef.git
Cloning into 'unifdef'...
fatal: Could not read from remote repository.
so I had to use git clone git://dotat.at/unifdef.git. I've contacted Tony Flinch about this, as the unifdef's home page also refers to the same repo, and he explained that this seems to be some IPv6 issue and I can use whichever of the two repos work as the code should be in sync.
• I was unable to build creduce by pointing it to latest commit of llvm-project (which I believe is 14.x ATM). Also I couldn't do it with origin/release/11.x (when trying the "matching" origin/llvm-11 branch of creduce) - in both cases it failed when trying to compile, or perhaps link, the clang_delta with clang-cpp or something like this. What eventually worked for me was to:
• I wanted to manually compile LLVM as you suggest, because I was also getting these errors about cmake files missing. But I have VS 2019, and you wrote:
Important: As of this writing, LLVM miscompiles with VS 2019. Please make sure you are using 2015 or 2017.
so I was in despair, but then my coworker made me realize, that I already have LLVM 10.0.0 installed (after all I was trying to report a bug in it), and that supposedly LLVM should compile with LLVM! Indeed this worked fine, with the following:
In other words, I was able to build LLVM from release/10.x source by using the already installed LLVM10.0.0 compiler binaries:)
• above commands do not work for me from vanilla cmd.exe:
FAILED: cmTC_13eab.exe
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_13eab.dir --rc=C:\PROGRA~1\LLVM10~1.0\bin\llvm-rc.exe --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~1\LLVM10~1.0\bin\lld-link.exe /nologo CMakeFiles\cmTC_13eab.dir\testCCompiler.c.obj /out:cmTC_13eab.exe /implib:cmTC_13eab.lib /pdb:cmTC_13eab.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK Pass 1: command "C:\PROGRA~1\LLVM10~1.0\bin\lld-link.exe /nologo CMakeFiles\cmTC_13eab.dir\testCCompiler.c.obj /out:cmTC_13eab.exe /implib:cmTC_13eab.lib /pdb:cmTC_13eab.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_13eab.dir/intermediate.manifest CMakeFiles\cmTC_13eab.dir/manifest.res" failed (exit code 1) with the following output:
lld-link: error: could not open 'kernel32.lib': no such file or directory
lld-link: error: could not open 'user32.lib': no such file or directory
lld-link: error: could not open 'gdi32.lib': no such file or directory
lld-link: error: could not open 'winspool.lib': no such file or directory
lld-link: error: could not open 'shell32.lib': no such file or directory
lld-link: error: could not open 'ole32.lib': no such file or directory
lld-link: error: could not open 'oleaut32.lib': no such file or directory
lld-link: error: could not open 'uuid.lib': no such file or directory
lld-link: error: could not open 'comdlg32.lib': no such file or directory
lld-link: error: could not open 'advapi32.lib': no such file or directory
lld-link: error: could not open 'msvcrtd.lib': no such file or directory
lld-link: error: could not open 'oldnames.lib': no such file or directory
ninja: build stopped: subcommand failed.
• they also do not work for me from the x86 Native Tools Command Prompt for VS 2019:
in it, first!
• also, they do work from x64 Native Tools Command Prompt for VS 2019 (so "x64" vs "x86" here makes a big deal)
• For creduce, I've used the following cmake command:
• To build creduce, I had to manually edit some .l files to avoid complains about #include <unistd.h> not working on Windows, due to this header missing:
• I don't think you need ninja install step for creduce, because we gonna use the creduce "binary" (it's actually a perl script) inside src/creduce-build/creduce, not in C:\Program Files (x86)\creduce. Actually, when I've tried to use the one from Program Files (x86)/creduce, it complained about pass_unifdef missing :
prereqs not found for pass pass_unifdef at C:\\Program Files (x86)\\creduce\\bin\\creduce.exe line 364.
at C:\\Program Files (x86)\\creduce\\bin\\creduce.exe line 35.
main::__ANON__("prereqs not found for pass pass_unifdef at C:\\\\Program Files "...) called at C:\\Program Files (x86)\\creduce\\bin\\creduce.exe line 364
main::call_prereq_check("pass_unifdef") called at C:\\Program Files (x86)\\creduce\\bin\\creduce.exe line 1025
and this is perhaps because we've copied unifdef to src/creduce-build/unifdef in one of your steps
• OTOH the LLVM's /c/ade/llvm-project/clang/utils/creduce-clang-crash.py script, really wants the executable to have an ".exe" suffix, so I had to manually copy the /c/ade/creduce-build/creduce/creduce to /c/ade/creduce-build/creduce/creduce.exe
• The creduce binary is actually a Perl script, which is a problem on Windows, where the shebang line which tells bash to use Perl interpreter for it, obviously doesn't work. It will work, though, from Git Bash shell, for example:
works fine, as GitBash parses the shebang in creduce.exe and thus uses Perl interpreter for it. The same command will not work from regular cmd.exe prompt, though:
This version of C:\ade\creduce-build\creduce\creduce.exe is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.
• You might need to edit creduce.exe so that it doesn't try to read key presses from console:
$ 'C:\\ade\\creduce-build\\creduce\\creduce.exe' '--tidy' 'rec-cf789c.test.bat' 'rec-cf789c.reduced.cpp'
===< 2968 >===
running 1 interestingness test in parallel
===< pass_unifdef :: 0 >===
Undefined subroutine &Term::ReadKey::ReadMode called at C:\\ade\\creduce-build\\creduce\\creduce.exe line 620.
at C:\\ade\\creduce-build\\creduce\\creduce.exe line 35.
main::__ANON__("Undefined subroutine &Term::ReadKey::ReadMode called at C:\\\\a"...) called at C:\\ade\\creduce-build\\creduce\\creduce.exe line 620
main::delta_pass(HASH(0x3395278)) called at C:\\ade\\creduce-build\\creduce\\creduce.exe line 1080
the fix is something like:
$ diff /c/ade/creduce-build/creduce/creduce{,.exe}
38c38
< my $SKIP_KEY_OFF = 0;
---
> my $SKIP_KEY_OFF = 1;
• The LLVM's /c/ade/llvm-project/clang/utils/creduce-clang-crash.py script assumes the environment to be rather "bash-like", which is almost fine, when you run it from GitBash, but unfortunately the creduce.exe tool itself expects the test script passed to it to be a "Windows executable", not a bash script, so one has to add some additional ".bat" wrapper around the generated ".sh" file in order to make creduce.exe recognize it as something it can execute. At the same time, because creduce.exe is a Perl script, trying to execute it directly with Popen fails, so I had to manually prepend the call to Perl interpreter:
where the rec-* files were copied to this directory from wherever the crashed LLVM has put them originally.
It still has some issues near the start, but continues and seems to be properly reducing the file:
===< 13524 >===
running 1 interestingness test in parallel
===< pass_unifdef :: 0 >===
The system cannot find the path specified.
The system cannot find the path specified.
***************************************************
pass_unifdef::0 has encountered a bug:
pass failed to modify the variant
Please consider tarring up C:\ade\crash\creduce_bug_000
and mailing it to creduce-bugs@flux.utah.edu and we will try to fix
the bug.
This bug is not fatal, C-Reduce will continue to execute.
***************************************************
===< pass_comments :: 0 >===
(-3.7 %, 4559098 bytes)
===< pass_ifs :: 0 >===
===< pass_includes :: 0 >===
===< pass_line_markers :: 0 >===
===< pass_blank :: 0 >===
(-1.6 %, 4465926 bytes)
(0.3 %, 4384925 bytes)
===< pass_clang_binsrch :: replace-function-def-with-decl >===
Use of uninitialized value $line in pattern match (m//) at C:/ade/creduce-build/creduce/pass_clang_binsrch.pm line 36.
===< pass_clang_binsrch :: remove-unused-function >===
Use of uninitialized value $line in pattern match (m//) at C:/ade/creduce-build/creduce/pass_clang_binsrch.pm line 36.
===< pass_lines :: 0 >===
(2.6 %, 4282061 bytes)
(3.5 %, 4244116 bytes)
(3.9 %, 4226659 bytes)
(4.1 %, 4215602 bytes)
(4.4 %, 4205283 bytes)
...
Once again, big thanks for writing this manual. Sharing my above addendum is the least I could do to pay back.
The text was updated successfully, but these errors were encountered:
First of all, I'd like to say HUGE THANK YOU for writing this detailed manual!
Background: I needed to file a bug about crash in LLVM 10, 11, and 12, and would give up without your help.
(A crashed LLVM generates rec-something.sh and rec-something.cpp files, but these tend to be huge for large projects with lots of includes, and https://llvm.org/docs/HowToSubmitABug.html requests people filing bugs to minimize them using C-Reduce)
There were some modifications I had to apply to your steps, and I thought I'll share them here, while I still remember (most of) them.
I'm on Windows 10, with VS 2019 Enterprise and GitBash.
• I had both ActivePerl and Strawberry Perl installed, which made
cpan
commands from your guide fail in strange ways, and this was resolved by simply uninstalling the ActivePerl and redoing thecpan
commands• It turned out that at some point Python3 was needed (I don't remember at which stage, I believe it was one of the cpan packages unittests or something?), so I had to install it. It is also helpful for running the creduce-clang-crash.py later)
• The unifdef repository got inaccessible:
so I had to use
git clone git://dotat.at/unifdef.git
. I've contacted Tony Flinch about this, as the unifdef's home page also refers to the same repo, and he explained that this seems to be some IPv6 issue and I can use whichever of the two repos work as the code should be in sync.• I was unable to build creduce by pointing it to latest commit of llvm-project (which I believe is 14.x ATM). Also I couldn't do it with
origin/release/11.x
(when trying the "matching"origin/llvm-11
branch of creduce) - in both cases it failed when trying to compile, or perhaps link, the clang_delta with clang-cpp or something like this. What eventually worked for me was to:and also:
• I wanted to manually compile LLVM as you suggest, because I was also getting these errors about cmake files missing. But I have VS 2019, and you wrote:
In other words, I was able to build LLVM from release/10.x source by using the already installed LLVM10.0.0 compiler binaries:)
• above commands do not work for me from vanilla cmd.exe:
• they also do not work for me from the
x86 Native Tools Command Prompt for VS 2019
:• but they do work for me, if I run a vanilla
cmd.exe
and manually execute:in it, first!
• also, they do work from
x64 Native Tools Command Prompt for VS 2019
(so "x64" vs "x86" here makes a big deal)• For creduce, I've used the following
cmake
command:• To build creduce, I had to manually edit some
.l
files to avoid complains about#include <unistd.h>
not working on Windows, due to this header missing:• I don't think you need
ninja install
step for creduce, because we gonna use the creduce "binary" (it's actually a perl script) insidesrc/creduce-build/creduce
, not inC:\Program Files (x86)\creduce
. Actually, when I've tried to use the one fromProgram Files (x86)/creduce
, it complained about pass_unifdef missing :and this is perhaps because we've copied unifdef to
src/creduce-build/unifdef
in one of your steps• OTOH the LLVM's
/c/ade/llvm-project/clang/utils/creduce-clang-crash.py
script, really wants the executable to have an ".exe" suffix, so I had to manually copy the/c/ade/creduce-build/creduce/creduce
to/c/ade/creduce-build/creduce/creduce.exe
• The creduce binary is actually a Perl script, which is a problem on Windows, where the shebang line which tells bash to use Perl interpreter for it, obviously doesn't work. It will work, though, from Git Bash shell, for example:
works fine, as GitBash parses the shebang in creduce.exe and thus uses Perl interpreter for it. The same command will not work from regular cmd.exe prompt, though:
• You might need to edit creduce.exe so that it doesn't try to read key presses from console:
the fix is something like:
• The LLVM's
/c/ade/llvm-project/clang/utils/creduce-clang-crash.py
script assumes the environment to be rather "bash-like", which is almost fine, when you run it from GitBash, but unfortunately thecreduce.exe
tool itself expects the test script passed to it to be a "Windows executable", not a bash script, so one has to add some additional ".bat" wrapper around the generated ".sh" file in order to make creduce.exe recognize it as something it can execute. At the same time, because creduce.exe is a Perl script, trying to execute it directly withPopen
fails, so I had to manually prepend the call to Perl interpreter:I invoke it like this:
where the
rec-*
files were copied to this directory from wherever the crashed LLVM has put them originally.It still has some issues near the start, but continues and seems to be properly reducing the file:
Once again, big thanks for writing this manual. Sharing my above addendum is the least I could do to pay back.
The text was updated successfully, but these errors were encountered: