I am using the vcd2fst
tool (installed with GTKwave) to convert a .vcd
file to .fst
using the following command:
vcd2fst -v wave.vcd -f dummy.fst
This works fine in my host Ubuntu 18.04 machine.
Meanwhile, when the same command (and the same version of the tool) is launched on an Ubuntu 16.04 Virtual Machine, it results in a Segmentation Fault (core dumped)
.
Trying to debug that with GDB results in the following, my guess is that it has to do with memory allocation, but the same problem is still happening even when I increase the allocated RAM from 2GB to 8GB. Any ideas ?
gdb --args vcd2fst -v wave.vcd -f dummy.fst
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from vcd2fst...done.
(gdb) run
Starting program: /usr/local/bin/vcd2fst -v wave.vcd -f dummy.fst
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x0000000000403de3 in LZ4_hashSequence64 (tableType=<optimized out>,
sequence=<optimized out>) at ./fst/lz4.c:420
420 ./fst/lz4.c: No such file or directory.
(gdb)
Following is the backtrace, after the segfault happens:
(gdb) backtrace
#0 0x0000000000403de3 in LZ4_hashSequence64 (tableType=<optimized out>,
sequence=<optimized out>) at ./fst/lz4.c:420
#1 LZ4_hashSequenceT (tableType=<optimized out>, sequence=<optimized out>)
at ./fst/lz4.c:403
#2 LZ4_hashPosition (tableType=byU32, p=0xffffffffffffffff) at ./fst/lz4.c:407
#3 LZ4_putPosition (
p=0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>, tableBase=0x7fffffff1a40, tableType=byU32,
srcBase=0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>) at ./fst/lz4.c:421
#4 0x00000000004049a2 in LZ4_compress_generic (acceleration=<optimized out>,
dictIssue=noDictIssue, dict=noDict, tableType=byU32,
outputLimited=notLimited, maxOutputSize=0, inputSize=741835,
dest=0x77b6a0 "x\332\355Y\315r\033\067\f\036\220K-WZ\273Ό\332ؖ\022S\272h'\355\241i\023;\223\203\313͵\235\236rȱ禽\365\001<}\202>C;}\317\342\003\301\325j%\333r\232I\233\214!/\177@\220\004@\220",
source=0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>, ctx=0x7fffffff1a40) at ./fst/lz4.c:492
#5 LZ4_compress_fast_extState (state=state@entry=0x7fffffff1a40,
source=source@entry=0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>,
dest=dest@entry=0x77b6a0 "x\332\355Y\315r\033\067\f\036\220K-WZ\273Ό\332ؖ\022S\272h'\355\241i\023;\223\203\313͵\235\236rȱ禽\365\001<}\202>C;}\317\342\003\301\325j%\333r\232I\233\214!/\177@\220\004@\220",
inputSize=<optimized out>, maxOutputSize=<optimized out>,
acceleration=<optimized out>, acceleration@entry=1) at ./fst/lz4.c:670
#6 0x0000000000405480 in LZ4_compress_fast (
source=source@entry=0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>,
dest=dest@entry=0x77b6a0 "x\332\355Y\315r\033\067\f\036\220K-WZ\273Ό\332ؖ\022S\272h'\355\241i\023;\223\203\313͵\235\236rȱ禽\365\001<}\202>C;}\317\342\003\301\325j%\333r\232I\233\214!/\177@\220\004@\220",
inputSize=<optimized out>, maxOutputSize=<optimized out>,
acceleration=acceleration@entry=1) at ./fst/lz4.c:691
---Type <return> to continue, or q <return> to quit---
#7 0x000000000040b183 in LZ4_compress_default (maxOutputSize=<optimized out>,
inputSize=<optimized out>,
dest=0x77b6a0 "x\332\355Y\315r\033\067\f\036\220K-WZ\273Ό\332ؖ\022S\272h'\355\241i\023;\223\203\313͵\235\236rȱ禽\365\001<}\202>C;}\317\342\003\301\325j%\333r\232I\233\214!/\177@\220\004@\220",
source=0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>) at ./fst/lz4.c:702
#8 LZ4_compress (
source=source@entry=0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>,
dest=dest@entry=0x77b6a0 "x\332\355Y\315r\033\067\f\036\220K-WZ\273Ό\332ؖ\022S\272h'\355\241i\023;\223\203\313͵\235\236rȱ禽\365\001<}\202>C;}\317\342\003\301\325j%\333r\232I\233\214!/\177@\220\004@\220", inputSize=<optimized out>)
at ./fst/lz4.c:1459
#9 0x00000000004145a0 in fstWriterClose (ctx=ctx@entry=0x62e5f0)
at ./fst/fstapi.c:2031
#10 0x00000000004029d6 in fst_main (vname=vname@entry=0x61e370 "wave.vcd",
fstname=fstname@entry=0x61e390 "dummy.fst") at vcd2fst.c:1580
#11 0x0000000000401fa2 in main (argc=5, argv=0x7fffffffdce8) at vcd2fst.c:1822
Here is the solution that worked for me, suggested by the author Anthony Bybell:
Add the following line right before line 311 for the "mmap compatibility" section.
#define __CYGWIN__