Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  IPC::Locker
  Parallel::Forker
  Voneline
General Info
  Papers

Compile errors with Mingw32 on fstapi.c

Added by Richard Myers about 1 year ago

Hi,

I'm getting errors on literals used in fstapi.c with the mingw32 g++ compiler (7.3.0) on Fedora 28. mingw64 g++ compiler gives the same errors. It compiles fine with the linux g++ compiler. I've tried playing with the white space before and after the literals, to more or less no effect. I've exhausted my Google-fu repertoire. I reckon my next step might be to replace all the literals with garden variety string formatting (%" PRIu32 " -> %d). Any better ideas how I might move forward?

[rmm@crank obj_dir] $ /usr/bin/i686-w64-mingw32-g++  -I.  -MMD -I/home/rmm/src/verilator-4.008/include -I/home/rmm/src/verilator-4.008/include/vltstd -DVL_PRINTF=printf -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=1 -faligned-new -Wno-bool-operation -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow  -std=c++11   -DDLL  -MMD -MP -DVL_DEBUG=1 -c -I .. -O2 -fstrict-aliasing -c -o verilated_fst_c.o verilated_fst_c.cpp
In file included from verilated_fst_c.cpp:30:0:
/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp:203:44: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
                 fprintf(stderr, FST_APIMESS"GetTempPath() failed in "__FILE__" line %d, exiting.\n", __LINE__);
                                            ^
/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp:211:52: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
                         fprintf(stderr, FST_APIMESS"GetTempFileName() failed in "__FILE__" line %d, exiting.\n", __LINE__);
                                                    ^
In file included from verilated_fst_c.cpp:30:0:
/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp: In function 'fstEnumHandle fstWriterCreateEnumTable(void*, const char*, uint32_t, unsigned int, const char**, const char**)':
/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp:2758:47: error: expected ')' before 'PRIu32'
  elem_count_len = sprintf(elem_count_buf, "%" PRIu32 , elem_count);
                                               ^~~~~~
/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp: In function 'int fstReaderProcessHier(void*, FILE*)':
/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp:4097:55: error: expected ')' before 'PRId64'
         if(xc->timezero) fprintf(fv, "$timezero\n\t%" PRId64 "\n$end\n", xc->timezero);
                                                       ^~~~~~
/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp:4190:101: error: expected ')' before 'PRId64'
                                                                 fprintf(fv, "$attrbegin %s %s %s %" PRId64 " $end\n", attrtypes[attrtype], arraytypes[subtype], str, attrarg);
                                                                                                     ^~~~~~
/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp:4193:101: error: expected ')' before 'PRId64'
                                                                 fprintf(fv, "$attrbegin %s %s %s %" PRId64 " $end\n", attrtypes[attrtype], enumvaluetypes[subtype], str, attrarg);
                                                                                                     ^~~~~~
/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp:4196:101: error: expected ')' before 'PRId64'
                                                                 fprintf(fv, "$attrbegin %s %s %s %" PRId64 " $end\n", attrtypes[attrtype], packtypes[subtype], str, attrarg);
                                                                                                     ^~~~~~
/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp:4211:116: error: expected ')' before 'PRId64'
                                                                              fprintf(fv, "$attrbegin %s %02x %" PRId64 " %" PRId64 " $end\n", attrtypes[attrtype], subtype, sidx, attrarg);
                                                                                                                 ^~~~~~
/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp:4215:119: error: expected ')' before 'PRId64'
                                                                           fprintf(fv, "$attrbegin %s %02x %s %" PRId64 " $end\n", attrtypes[attrtype], subtype, str, attrarg);
                                                                                                                 ^~~~~~
/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp:4295:65: error: expected ')' before 'PRIu32'
                                         fprintf(fv, "$var %s %" PRIu32 " %s %s $end\n", vartypes[vartype], modlen, vcdid_buf, str);
                                                                 ^~~~~~
/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp:4311:65: error: expected ')' before 'PRIu32'
                                         fprintf(fv, "$var %s %" PRIu32 " %s %s $end\n", vartypes[vartype], modlen, vcdid_buf, str);
                                                                 ^~~~~~
/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp: In function 'int fstReaderIterBlocks2(void*, void (*)(void*, uint64_t, fstHandle, const unsigned char*), void (*)(void*, uint64_t, fstHandle, const unsigned char*, uint32_t), void*, FILE*)':
/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp:4975:71: error: expected ')' before 'PRIu64'
                                         wx_len = sprintf(wx_buf, "#%" PRIu64 "\n", beg_tim);
                                                                       ^~~~~~
/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp:5409:63: error: expected ')' before 'PRIu64'
                                 wx_len = sprintf(wx_buf, "#%" PRIu64 "\n", time_table[i]);

[rmm@crank obj_dir] $ /usr/bin/i686-w64-mingw32-g++ -Q -v Using built-in specs. COLLECT_GCC=/usr/bin/i686-w64-mingw32-g++ COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-w64-mingw32/7.3.0/lto-wrapper Target: i686-w64-mingw32 Configured with: ../configure --prefix=/usr --bindir=/usr/bin --includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --with-gnu-as --with-gnu-ld --verbose --without-newlib --disable-multilib --disable-plugin --with-system-zlib --disable-nls --without-included-gettext --disable-win32-registry --enable-languages=c,c++,objc,obj-c++,fortran --with-bugurl=http://bugzilla.redhat.com/bugzilla --with-cloog --enable-threads=posix --enable-libgomp --target=i686-w64-mingw32 --with-sysroot=/usr/i686-w64-mingw32/sys-root --with-gxx-include-dir=/usr/i686-w64-mingw32/sys-root/mingw/include/c++ Thread model: posix gcc version 7.3.0 20180125 (Fedora MinGW 7.3.0-1.fc28) (GCC)

It fails in a different way with Cygwin 2.11.2 (GCC 7.3.0, 64-bit). ftello, fseek, etc. was not declared in this scope ...

Thanks! Richard ^~~~

out - /usr/bin/i686-w64-mingw32-g++ -dM -E -x c++ /dev/null > out (13.7 KB)


Replies (2)

RE: Compile errors with Mingw32 on fstapi.c - Added by Wilson Snyder about 1 year ago

Can you create a patch to fix these, then send the result to "Tony Bybell" <> so they can be fixed upstream in gtkwave?

/home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp:203:44: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix] fprintf(stderr, FST_APIMESS"GetTempPath() failed in "__FILE__" line %d, exiting.\n", LINE);

I suspect a space is needed between FST_APIMESS and the following quote. Globally replace /FST_APIMESS"/FST_APIMESS "/.

In file included from verilated_fst_c.cpp:30:0: /home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp: In function 'fstEnumHandle fstWriterCreateEnumTable(void*, const char*, uint32_t, unsigned int, const char**, const char**)': /home/rmm/src/verilator-4.008/include/gtkwave/fstapi.cpp:2758:47: error: expected ')' before 'PRIu32' elem_count_len = sprintf(elem_count_buf, "%" PRIu32 , elem_count); ^~~~

I suspect PRIu32 is not defined due to some missing #include of a header file.

RE: Compile errors with Mingw32 on fstapi.c - Added by Wilson Snyder about 1 year ago

Fix for space concatenation submitted upstream.

    (1-2/2)