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

Fix compile errors for macOS 10.12 #2

Merged
merged 1 commit into from
Oct 5, 2018

Conversation

C-Elegans
Copy link
Contributor

On macOS Sierra, running 'make bench' gives compile errors in all of the
verilator testbenches, complaining about an ambiguous call to dump
(because there is no dump() defined for a uint64_t, or clang++ doesn't
define vluint64_t to be the same as uint64_t). This patch fixes those
compiler errors

Compiler error:

mpy_tb.cpp:113:13: error: call to member function 'dump' is ambiguous
                        m_trace->dump((uint64_t)(10ul*m_tickcount+5));
                        ~~~~~~~~~^~~~
/usr/local/Cellar/verilator/3.926/share/verilator/include/verilated_vcd_c.h:434:10: note: candidate function
    void dump (vluint64_t timeui) { m_sptrace.dump(timeui); }
         ^
/usr/local/Cellar/verilator/3.926/share/verilator/include/verilated_vcd_c.h:437:10: note: candidate function
    void dump (double timestamp) { dump(static_cast<vluint64_t>(timestamp)); }
         ^
/usr/local/Cellar/verilator/3.926/share/verilator/include/verilated_vcd_c.h:438:10: note: candidate function
    void dump (vluint32_t timestamp) { dump(static_cast<vluint64_t>(timestamp)); }
         ^
/usr/local/Cellar/verilator/3.926/share/verilator/include/verilated_vcd_c.h:439:10: note: candidate function
    void dump (int timestamp) { dump(static_cast<vluint64_t>(timestamp)); }

versions:

$ clang++ -v
    Apple LLVM version 9.0.0 (clang-900.0.38)
    Target: x86_64-apple-darwin16.7.0
    Thread model: posix

$ verilator --version
    Verilator 3.926 2018-08-22 rev UNKNOWN_REV

On macOS Sierra, running 'make bench' gives compile errors in all of the
verilator testbenches, complaining about an ambiguous call to dump
(because there is no dump() defined for a uint64_t, or clang++ doesn't
define vluint64_t to be the same as uint64_t). This patch fixes those
compiler errors

Compiler error:

mpy_tb.cpp:113:13: error: call to member function 'dump' is ambiguous
                        m_trace->dump((uint64_t)(10ul*m_tickcount+5));
                        ~~~~~~~~~^~~~
/usr/local/Cellar/verilator/3.926/share/verilator/include/verilated_vcd_c.h:434:10: note: candidate function
    void dump (vluint64_t timeui) { m_sptrace.dump(timeui); }
         ^
/usr/local/Cellar/verilator/3.926/share/verilator/include/verilated_vcd_c.h:437:10: note: candidate function
    void dump (double timestamp) { dump(static_cast<vluint64_t>(timestamp)); }
         ^
/usr/local/Cellar/verilator/3.926/share/verilator/include/verilated_vcd_c.h:438:10: note: candidate function
    void dump (vluint32_t timestamp) { dump(static_cast<vluint64_t>(timestamp)); }
         ^
/usr/local/Cellar/verilator/3.926/share/verilator/include/verilated_vcd_c.h:439:10: note: candidate function
    void dump (int timestamp) { dump(static_cast<vluint64_t>(timestamp)); }

Clang version:
$ clang++ -v
    Apple LLVM version 9.0.0 (clang-900.0.38)
    Target: x86_64-apple-darwin16.7.0
    Thread model: posix

$ verilator --version
    Verilator 3.926 2018-08-22 rev UNKNOWN_REV
@ZipCPU
Copy link
Owner

ZipCPU commented Oct 3, 2018

Is the mac using 32-bit integers as longs?

Double checking that nothing will overflow 32-bits ... doesn't look like it.

Thanks for pointing this out! I don't normally test on MacOS (or Windows), so I really depend upon kind folk like yourself noticing if there are problems.

Dan

@C-Elegans
Copy link
Contributor Author

That would not seem to be the case. I added the following static assertions to one of the files and it looks like uint64_t and vluint64_t are both 64 bits.

static_assert(sizeof(uint64_t) == 8, "uint64_t is not 64 bits");
static_assert(sizeof(vluint64_t) == 8, "vluint64_t is not 64 bits");

Very odd

@ZipCPU ZipCPU merged commit b99cf60 into ZipCPU:master Oct 5, 2018
@ZipCPU
Copy link
Owner

ZipCPU commented Oct 5, 2018

Merged. Please check that the updated tree works.

Thanks!

@C-Elegans
Copy link
Contributor Author

Yep! Thanks!

@C-Elegans C-Elegans deleted the fix_compile_errors_mac branch October 5, 2018 13:50
@Skriba98 Skriba98 mentioned this pull request May 24, 2021
ZipCPU added a commit that referenced this pull request Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants