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

Windows MinGW/Msys based build

Added by Patrick Mulder about 1 month ago

Hello,

$ uname -a
MINGW64_NT-10.0-16299 machine-MOBL 3.0.7-338.x86_64 2019-07-11 10:58 UTC x86_64 Msys

The version above is the latest Msys one (there is also 2.x.x which gives different problems, missing flex, bison, etc. )

The make gives:

@

$ make
------------------------------------------------------------
making verilator in src
make -C src
make[1]: Entering directory '/c/Users/pmobil/git/verilator/src'
make -C obj_dbg -j 1  TGT=../../bin/verilator_bin_dbg VL_DEBUG=1 -f ../Makefile_obj serial
make[2]: Entering directory '/c/Users/pmobil/git/verilator/src/obj_dbg'
make[2]: Nothing to be done for 'serial'.
make[2]: Leaving directory '/c/Users/pmobil/git/verilator/src/obj_dbg'
make -C obj_dbg       TGT=../../bin/verilator_bin_dbg VL_DEBUG=1 -f ../Makefile_obj
make[2]: Entering directory '/c/Users/pmobil/git/verilator/src/obj_dbg'
      Compile flags:  g++ -I/mingw64/include -I/mingw64/include -std=gnu++14 -faligned-new -fcf-protection=none -Wno-bool-operation -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -I/mingw64/include -MMD -I. -I.. -I.. -I../../include -I../../include -DYYDEBUG -ggdb -DVL_DEBUG -D_GLIBCXX_DEBUG -MP -faligned-new -Wno-unused-parameter -Wno-shadow -DDEFENV_SYSTEMC="" -DDEFENV_SYSTEMC_ARCH="" -DDEFENV_SYSTEMC_INCLUDE="" -DDEFENV_SYSTEMC_LIBDIR="" -DDEFENV_VERILATOR_ROOT="/mingw64/share/verilator" 
g++ -I/mingw64/include -std=gnu++14  -faligned-new -fcf-protection=none -Wno-bool-operation -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -I/mingw64/include -MMD -I. -I.. -I.. -I../../include -I../../include -DYYDEBUG          -ggdb -DVL_DEBUG -D_GLIBCXX_DEBUG -MP  -faligned-new -Wno-unused-parameter -Wno-shadow -DDEFENV_SYSTEMC=\"\" -DDEFENV_SYSTEMC_ARCH=\"\" -DDEFENV_SYSTEMC_INCLUDE=\"\" -DDEFENV_SYSTEMC_LIBDIR=\"\" -DDEFENV_VERILATOR_ROOT=\"/mingw64/share/verilator\" -Wno-char-subscripts -Wno-unused -c ../V3ParseLex.cpp
In file included from ../V3ParseLex.cpp:36:
V3Lexer_pregen.yy.cpp:368:10: fatal error: FlexLexer.h: No such file or directory
  368 |
      |          ^
compilation terminated.
make[2]: *** [../Makefile_obj:291: V3ParseLex.o] Error 1
make[2]: Leaving directory '/c/Users/pmobil/git/verilator/src/obj_dbg'
make[1]: *** [Makefile:70: ../bin/verilator_bin_dbg] Error 2
make[1]: Leaving directory '/c/Users/pmobil/git/verilator/src'
make: *** [Makefile:226: verilator_exe] Error 2

@ FlexLexer.h is here:
$ find / -name "FlexLexer.h" 
/usr/include/FlexLexer.h

The configure log is attached.

configure_msys2.log View - logfile configure (3.96 KB)


Replies (6)

RE: Windows MinGW/Msys based build - Added by Wilson Snyder about 1 month ago

Given I see /mingw64/include on your command line I think your compiler isn't looking in /usr/include, e.g. where flex put the file (and where configure found them). "g++ -print-search-dirs" might help debug.

RE: Windows MinGW/Msys based build - Added by Patrick Stewart about 1 month ago

In msys2 you can just do "pacman -S mingw-w64-x86_64-verilator", there's already a package. You can see how it's built here: http://github.com/msys2/MINGW-packages/blob/master/mingw-w64-verilator/PKGBUILD

You shouldn't have /usr/include on the path if you're building for mingw*, that's headers for the msys2 subsystem (See http://github.com/msys2/msys2/wiki/MSYS2-introduction ).

RE: Windows MinGW/Msys based build - Added by Patrick Mulder about 1 month ago

I tried:

export CPPFLAGS=-I/usr/include
$ autoconf
$ configure

Then there comes this:

C:/msys64/mingw64/x86_64-w64-mingw32/include/_mingw_mac.h:10: note: this is the location of the previous definition
   10 | #define __STRINGIFY(x) #x
      |
In file included from C:/msys64/mingw64/include/c++/9.1.0/x86_64-w64-mingw32/bits/gthr.h:148,
                 from C:/msys64/mingw64/include/c++/9.1.0/ext/atomicity.h:35,
                 from C:/msys64/mingw64/include/c++/9.1.0/bits/ios_base.h:39,
                 from C:/msys64/mingw64/include/c++/9.1.0/ios:42,
                 from C:/msys64/mingw64/include/c++/9.1.0/ostream:38,
                 from C:/msys64/mingw64/include/c++/9.1.0/iostream:39,
                 from ../config_build.h:65,
                 from ../V3Global.h:24,
                 from ../Verilator.cpp:21:
C:/msys64/mingw64/include/c++/9.1.0/x86_64-w64-mingw32/bits/gthr-default.h: In function 'int __gthread_yield()':
C:/msys64/mingw64/include/c++/9.1.0/x86_64-w64-mingw32/bits/gthr-default.h:693:10: error: 'sched_yield' was not declared in this scope
  693 |   return __gthrw_(sched_yield) ();
      |          ^~~~~~~~
In file included from C:/msys64/mingw64/include/c++/9.1.0/cctype:42,
                 from C:/msys64/mingw64/include/c++/9.1.0/bits/localefwd.h:42,
                 from C:/msys64/mingw64/include/c++/9.1.0/ios:41,
                 from C:/msys64/mingw64/include/c++/9.1.0/ostream:38,
                 from C:/msys64/mingw64/include/c++/9.1.0/iostream:39,
                 from ../config_build.h:65,
                 from ../V3Global.h:24,
                 from ../Verilator.cpp:21:
C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h: At global scope:
C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:411:23: error: expected ',' or '...' before numeric constant
  411 |   int __cdecl abs(int _X);
      |                       ^~

Still googling ... but maybe someone has an idea what is wrong.

RE: Windows MinGW/Msys based build - Added by Patrick Mulder about 1 month ago

In config.log there is already this:

configure:6888: checking whether g++ supports Verilated threads
configure:6903: g++ -o conftest.exe  -I${prefix}/include -std=gnu++14  -faligned-new -fcf-protection=none -Wno-bool-operation -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -I/usr/include -I${prefix}/include  -L${exec_prefix}/lib conftest.cpp  >&5
In file included from C:/msys64/mingw64/include/c++/9.1.0/x86_64-w64-mingw32/bits/gthr.h:148,
                 from C:/msys64/mingw64/include/c++/9.1.0/ext/atomicity.h:35,
                 from C:/msys64/mingw64/include/c++/9.1.0/memory:73,
                 from C:/msys64/mingw64/include/c++/9.1.0/thread:39,
                 from conftest.cpp:19:
C:/msys64/mingw64/include/c++/9.1.0/x86_64-w64-mingw32/bits/gthr-default.h: In function 'int __gthread_yield()':
C:/msys64/mingw64/include/c++/9.1.0/x86_64-w64-mingw32/bits/gthr-default.h:693:10: error: 'sched_yield' was not declared in this scope
  693 |   return __gthrw_(sched_yield) ();
      |          ^~~~~~~~

MSys seems to have confusions of Posix vs Windows threads:

https://stackoverflow.com/questions/5618736/c-mingw-ctime-nanosleep-not-found

$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\msys64\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-9.1.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++ --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --enable-plugin --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev3, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 9.1.0 (Rev3, Built by MSYS2 project)

RE: Windows MinGW/Msys based build - Added by Patrick Stewart about 1 month ago

As I said before, you shouldn't put /usr/include on the path, it will break everything. The easy thing to do is just use the existing package:
pacman -S mingw-w64-x86_64-verilator
Otherwise, follow the method used in the PKGBUILD:
export MSYSTEM_PREFIX='/mingw64'
export MSYSTEM_CHOST='x86_64-w64-mingw32'

cp /usr/include/FlexLexer.h src/

export MSYS2_ARG_CONV_EXCL="-DDEFENV" 

autoconf

./configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST}

make

RE: Windows MinGW/Msys based build - Added by Patrick Mulder about 1 month ago

Thanks, yes that works:

pacman -S mingw-w64-x86_64-verilator

Also, thanks for the additional pointers.

    (1-6/6)