Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verilator-3.872 compile error in new cygwin installation #914

Closed
veripoolbot opened this issue Apr 29, 2015 · 3 comments
Closed

verilator-3.872 compile error in new cygwin installation #914

veripoolbot opened this issue Apr 29, 2015 · 3 comments
Assignees
Labels
area: configure/compiling Issue involves configuring or compilating Verilator itself resolution: fixed Closed; fixed

Comments

@veripoolbot
Copy link
Contributor


Author Name: Matthew Barr
Original Redmine Issue: 914 from https://www.veripool.org
Original Date: 2015-04-29
Original Assignee: Wilson Snyder (@wsnyder)


Short story: in include/verilatedos.h on line 142 consider changing:

  1. ifdef __uint32_t_defined // Newer Cygwin uint32_t in stdint.h as an unsigned int
    to:
  2. if defined(__uint32_t_defined) || defined(___int32_t_defined) // Newer Cygwin uint32_t in stdint.h as an unsigned int

This fixes compilation error in new cygwin installations due to conflicting uint32_t definitions, and should continue to work with older cygwin installations. Details are below.

Thanks and Best Regards,
Matt Barr

I just installed 32-bit Cygwin under Windows 7 and tried to re-build and re-install verilator-3.872. After ./configure I ran make and got the following compilation error:

make[2]: Entering directory '/home/Matt/Verilator/verilator-3.872/src/obj_dbg'
Compile flags: g++ -I/usr/local/include -MMD -I. -I.. -I.. -I../../include -DYYDEBUG -ggdb -DVL_DEBUG -MP -DDEFENV_SYSTEMC="" -DDEFENV_SYSTEMC_ARCH="" -DDEFENV_SYSTEMC_INCLUDE="" -DDEFENV_SYSTEMC_LIBDIR="" -DDEFENV_SYSTEMPERL="" -DDEFENV_SYSTEMPERL_INCLUDE="" -DDEFENV_VERILATOR_ROOT="/usr/local/share/verilator"
g++ -I/usr/local/include -MMD -I. -I.. -I.. -I../../include -DYYDEBUG -ggdb -DVL_DEBUG -MP -DDEFENV_SYSTEMC="" -DDEFENV_SYSTEMC_ARCH="" -DDEFENV_SYSTEMC_INCLUDE="" -DDEFENV_SYSTEMC_LIBDIR="" -DDEFENV_SYSTEMPERL="" -DDEFENV_SYSTEMPERL_INCLUDE="" -DDEFENV_VERILATOR_ROOT="/usr/local/share/verilator" -c ../Verilator.cpp
In file included from ../config_build.h:81:0,
from ../V3Global.h:24,
from ../Verilator.cpp:21:
../../include/verilatedos.h:146:24: error: conflicting declaration ‘typedef long unsigned int uint32_t’
typedef unsigned long uint32_t; ///< 32-bit unsigned type (backward compatibility)
^
In file included from /usr/include/sys/types.h:62:0,
from ../config_build.h:70,
from ../V3Global.h:24,
from ../Verilator.cpp:21:
/usr/include/sys/_stdint.h:32:20: note: previous declaration as ‘typedef __uint32_t uint32_t’
typedef __uint32_t uint32_t ;
^
../Makefile_obj:279: recipe for target 'Verilator.o' failed

In include/verilatedos.h we have (line 137):

  1. include <stdint.h>
    typedef unsigned char uint8_t; ///< 8-bit unsigned type (backward compatibility)
    typedef unsigned short int uint16_t; ///< 16-bit unsigned type (backward compatibility)
    typedef unsigned char vluint8_t; ///< 8-bit unsigned type
    typedef unsigned short int vluint16_t; ///< 16-bit unsigned type
  2. ifdef ___int32_t_defined // Newer Cygwin uint32_t in stdint.h as an unsigned int
    typedef int32_t vlsint32_t; ///< 32-bit signed type
    typedef uint32_t vluint32_t; ///< 32-bit unsigned type
  3. else // Older Cygwin has long==uint32_t
    typedef unsigned long uint32_t; ///< 32-bit unsigned type (backward compatibility)
    typedef long vlsint32_t; ///< 32-bit signed type
    typedef unsigned long vluint32_t; ///< 32-bit unsigned type
  4. endif

In cygwin's /usr/include/sys/_stdint.h we have (line 30):

#ifdef ___int32_t_defined
typedef __int32_t int32_t ;
typedef __uint32_t uint32_t ;
#define __int32_t_defined 1
#endif

It appears that cygwin now defines ___int32_t_defined while verilatedos.h is looking for __uint32_t_defined. It has been year or more since I built verilator, but this used to work and it appears there has since been a change on the cygwin side.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Matthew Barr
Original Date: 2015-04-29T17:05:56Z


Apologies for the mangled format in the original posting, thought it was WYSIWYG, should have previewed...

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2015-05-08T00:42:44Z


Thanks for the fix.

Pushed to git towards 3.873.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2015-06-06T18:04:07Z


In 3.874.

@veripoolbot veripoolbot added area: configure/compiling Issue involves configuring or compilating Verilator itself resolution: fixed Closed; fixed labels Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: configure/compiling Issue involves configuring or compilating Verilator itself resolution: fixed Closed; fixed
Projects
None yet
Development

No branches or pull requests

2 participants