Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  BugVise
  CovVise
  Force-Gate-Sim
  Gspice
  IPC::Locker
  Rsvn
  SVN::S4
  Voneline
  WFH
General Info
  Papers

Building on OSX

Added by Daniel O'Connor over 1 year ago

Hi, I'm trying to build Verilator on OSX but I get the following errors during compilation..
[Maelstrom 9:37] ~/work/verilator >make
------------------------------------------------------------
making verilator in src
cd obj_dbg && /Applications/Xcode.app/Contents/Developer/usr/bin/make -j 1  TGT=../../bin/verilator_bin_dbg VL_DEBUG=1 -f ../Makefile_obj serial
make[2]: Nothing to be done for `serial'.
cd obj_dbg && /Applications/Xcode.app/Contents/Developer/usr/bin/make       TGT=../../bin/verilator_bin_dbg VL_DEBUG=1 -f ../Makefile_obj
      Compile flags:  g++ -I/usr/local/include -MMD -I. -I.. -I.. -I../../include -DYYDEBUG -ggdb -DVL_DEBUG -MP -Qunused-arguments -faligned-new -Wno-unused-parameter -Wno-undefined-bool-conversion -Wno-shadow -DDEFENV_SYSTEMC="" -DDEFENV_SYSTEMC_ARCH="" -DDEFENV_SYSTEMC_INCLUDE="" -DDEFENV_SYSTEMC_LIBDIR="" -DDEFENV_VERILATOR_ROOT="/usr/local/share/verilator" 
g++ -I/usr/local/include -MMD -I. -I.. -I.. -I../../include -DYYDEBUG      -ggdb -DVL_DEBUG -MP  -Qunused-arguments -faligned-new -Wno-unused-parameter -Wno-undefined-bool-conversion -Wno-shadow -DDEFENV_SYSTEMC=\"\" -DDEFENV_SYSTEMC_ARCH=\"\" -DDEFENV_SYSTEMC_INCLUDE=\"\" -DDEFENV_SYSTEMC_LIBDIR=\"\" -DDEFENV_VERILATOR_ROOT=\"/usr/local/share/verilator\" -c ../Verilator.cpp
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:28:
../V3Error.h:192:10: error: unknown type name 'ostream'; did you mean 'std::ostream'?
  inline ostream& operator<<(ostream& os, V3ErrorCode rhs) { return os<<rhs.ascii(); }
         ^~~~~~~
         std::ostream
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:147:38: note: 'std::ostream' declared here
typedef basic_ostream<char>          ostream;
                                     ^
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:28:
../V3Error.h:192:30: error: unknown type name 'ostream'; did you mean 'std::ostream'?
  inline ostream& operator<<(ostream& os, V3ErrorCode rhs) { return os<<rhs.ascii(); }
                             ^~~~~~~
                             std::ostream
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:147:38: note: 'std::ostream' declared here
typedef basic_ostream<char>          ostream;
                                     ^
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:28:
../V3Error.h:199:13: error: no template named 'set'; did you mean 'std::set'?
    typedef set<string> MessagesSet;
            ^~~
            std::set
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/set:400:28: note: 'std::set' declared here
class _LIBCPP_TEMPLATE_VIS set
                           ^
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:28:
../V3Error.h:199:17: error: unknown type name 'string'; did you mean 'std::string'?
    typedef set<string> MessagesSet;
                ^~~~~~
                std::string
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:194:65: note: 'std::string' declared here
typedef basic_string<char, char_traits<char>, allocator<char> > string;
                                                                ^
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:28:
../V3Error.h:212:12: error: unknown type name 'ostringstream'; did you mean 'std::ostringstream'?
    static ostringstream s_errorStr;            // Error string being formed
           ^~~~~~~~~~~~~
           std::ostringstream
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:152:38: note: 'std::ostringstream' declared here
typedef basic_ostringstream<char>    ostringstream;
                                     ^
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:28:
../V3Error.h:231:12: error: unknown type name 'string'; did you mean 'std::string'?
    static string       msgPrefix();    // returns %Error/%Warn
           ^~~~~~
           std::string
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:194:65: note: 'std::string' declared here
typedef basic_string<char, char_traits<char>, allocator<char> > string;
                                                                ^
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:28:
../V3Error.h:244:12: error: unknown type name 'string'; did you mean 'std::string'?
    static string       lineStr (const char* filename, int lineno);
           ^~~~~~
           std::string
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:194:65: note: 'std::string' declared here
typedef basic_string<char, char_traits<char>, allocator<char> > string;
                                                                ^
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:28:
../V3Error.h:249:12: error: unknown type name 'string'; did you mean 'std::string'?
    static string warnMore();
           ^~~~~~
           std::string
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:194:65: note: 'std::string' declared here
typedef basic_string<char, char_traits<char>, allocator<char> > string;
                                                                ^
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:28:
../V3Error.h:255:12: error: unknown type name 'ostringstream'; did you mean 'std::ostringstream'?
    static ostringstream& v3errorStr() { return s_errorStr; }
           ^~~~~~~~~~~~~
           std::ostringstream
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:152:38: note: 'std::ostringstream' declared here
typedef basic_ostringstream<char>    ostringstream;
                                     ^
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:28:
../V3Error.h:257:28: error: unknown type name 'ostringstream'; did you mean 'std::ostringstream'?
    static void v3errorEnd(ostringstream& sstr);        // static, but often overridden in classes.
                           ^~~~~~~~~~~~~
                           std::ostringstream
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:152:38: note: 'std::ostringstream' declared here
typedef basic_ostringstream<char>    ostringstream;
                                     ^
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:28:
../V3Error.h:220:17: error: use of undeclared identifier 'cerr'; did you mean 'std::cerr'?
    V3Error() { cerr<<("Static class"); abort(); }
                ^~~~
                std::cerr
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iostream:57:33: note: 'std::cerr' declared here
extern _LIBCPP_FUNC_VIS ostream cerr;
                                ^
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:28:
../V3Error.h:262:24: error: unknown type name 'ostringstream'
inline void v3errorEnd(ostringstream& sstr) { V3Error::v3errorEnd(sstr); }
                       ^
../V3Error.h:263:29: error: unknown type name 'ostringstream'
inline void v3errorEndFatal(ostringstream& sstr) { V3Error::v3errorEnd(sstr); assert(0); VL_UNREACHABLE }
                            ^
../V3Error.h:296:5: error: unknown type name 'ostringstream'; did you mean 'std::ostringstream'?
    ostringstream os; os<<t; return os.str();
    ^~~~~~~~~~~~~
    std::ostringstream
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:152:38: note: 'std::ostringstream' declared here
typedef basic_ostringstream<char>    ostringstream;
                                     ^
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:28:
../V3Error.h:307:8: error: unknown type name 'string'; did you mean 'std::string'?
inline string ucfirst(const string& text) {
       ^~~~~~
       std::string
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:194:65: note: 'std::string' declared here
typedef basic_string<char, char_traits<char>, allocator<char> > string;
                                                                ^
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:28:
../V3Error.h:307:29: error: unknown type name 'string'; did you mean 'std::string'?
inline string ucfirst(const string& text) {
                            ^~~~~~
                            std::string
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:194:65: note: 'std::string' declared here
typedef basic_string<char, char_traits<char>, allocator<char> > string;
                                                                ^
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:28:
../V3Error.h:308:5: error: unknown type name 'string'; did you mean 'std::string'?
    string out = text;
    ^~~~~~
    std::string
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:194:65: note: 'std::string' declared here
typedef basic_string<char, char_traits<char>, allocator<char> > string;
                                                                ^
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:29:
../V3FileLine.h:46:13: error: no template named 'map'; did you mean 'std::map'?
    typedef map<string,int> FileNameNumMap;
            ^~~
            std::map
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/map:807:28: note: 'std::map' declared here
class _LIBCPP_TEMPLATE_VIS map
                           ^
In file included from ../Verilator.cpp:21:
In file included from ../V3Global.h:29:
../V3FileLine.h:46:17: error: use of undeclared identifier 'string'
    typedef map<string,int> FileNameNumMap;
                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [Verilator.o] Error 1
make[1]: *** [../bin/verilator_bin_dbg] Error 2
make: *** [verilator_exe] Error 2

Any ideas? I am a C++ noob :)

Thanks


Replies (7)

RE: Building on OSX - Added by Wilson Snyder over 1 year ago

These files include V3Global.h which includes config_build.h, which has a "using namespace std;" which should prevent this error. Not sure what's different about OS-X.

P.S. The development branch (develop-v4.0) removes using namespace std, but this will not be ready for release for some time.

RE: Building on OSX - Added by Daniel O'Connor over 1 year ago

It doesn't appear in my config_build.h, see.
[Maelstrom 11:17] ~/work/verilator >rg 'using namespace std;'
src/flexfix
27:    $line =~ s/^class istream;/\#include <iostream>\nusing namespace std;\n/;

test_regress/t/t_vpi_memory.cpp
37:using namespace std;

test_regress/t/t_vpi_var.cpp
37:using namespace std;

test_regress/t/t_vpi_get.cpp
37:using namespace std;

test_regress/t/t_scope_map.cpp
16:using namespace std;

I added it to the bottom of config_global.h and it builds now.

RE: Building on OSX - Added by Wilson Snyder over 1 year ago

It's in config_build.h.in. If it didn't get into config_build.h something probably went wrong with your configure and you should check what happened as may be missing other settings. (Or, just diff "config_build.h.in config_build.h" to see what's different.)

RE: Building on OSX - Added by Daniel O'Connor over 1 year ago

Oops I spoke too soon, I had to add '#define DTVERSION "1.0.0"' to it as well.

RE: Building on OSX - Added by Daniel O'Connor over 1 year ago

It's not in my config_build.h.in :(

I am at Git version verilator_3_920-8-ge1410775

RE: Building on OSX - Added by Wilson Snyder over 1 year ago

You must have changes in it then.

V4$ git describe --long
verilator_3_920-8-ge141077
V4$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
V4$ grep using src/config_build.h.in
using namespace std;
V4$ md5sum src/config_build.h.in
76948d7ac9d45b34966af888a768a29b  src/config_build.h.in

RE: Building on OSX - Added by Daniel O'Connor over 1 year ago

Ahh, I think the issue was that I ran autoreconf instead of autoconf out of habit and that rewrote the .in file..

Resetting my tree and running the right command gets it building.

Sorry for the noise!

    (1-7/7)