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

Compilation error: call of overloaded 'log(uint32_t&)' is ambiguous #2154

Open
brancoliticus opened this issue Feb 6, 2020 · 17 comments
Open

Compilation error: call of overloaded 'log(uint32_t&)' is ambiguous #2154

brancoliticus opened this issue Feb 6, 2020 · 17 comments

Comments

@brancoliticus
Copy link

@brancoliticus brancoliticus commented Feb 6, 2020

My system is illumos OpenIndiana rolling release updated to latest version with development packages installed. g++ is at version 6.5.0.

Here is what I did:
git clone https://git.veripool.org/git/verilator
cd verilator
git checkout stable
autoconf
./configure
gmake

This is the error output:

g++ -I/usr/local/include -std=gnu++14 -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -I/usr/local/include -MMD -I. -I.. -I.. -I../../include -I../../include -DYYDEBUG -ggdb -DVL_DEBUG -D_GLIBCXX_DEBUG -MP -Wno-unused-parameter -Wno-shadow -DDEFENV_SYSTEMC="" -DDEFENV_SYSTEMC_ARCH="" -DDEFENV_SYSTEMC_INCLUDE="" -DDEFENV_SYSTEMC_LIBDIR="" -DDEFENV_VERILATOR_ROOT="/usr/local/share/verilator" -c ../V3Partition.cpp
../V3Partition.cpp: In static member function 'static uint32_t LogicMTask::stepCost(uint32_t)':
../V3Partition.cpp:547:34: error: call of overloaded 'log(uint32_t&)' is ambiguous
double logcost = log(cost);
^
In file included from /usr/include/math.h:35:0,
from /usr/gcc/6/include/c++/6.5.0/cmath:45,
from ../V3Ast.h:32,
from ../V3OrderGraph.h:50,
from ../V3Partition.h:28,
from ../V3Partition.cpp:30:
/usr/include/iso/math_iso.h:72:15: note: candidate: double std::log(double)
extern double log(double);
^~~
/usr/include/iso/math_iso.h:172:15: note: candidate: float std::log(float)
inline float log(float __X) { return __logf(__X); }
^~~
/usr/include/iso/math_iso.h:215:21: note: candidate: long double std::log(long double)
inline long double log(long double __X) { return __logl(__X); }
^~~
gmake[2]: *** [../Makefile_obj:286: V3Partition.o] Error 1
gmake[2]: Leaving directory '/export/home/branco/go/src/verilator_from_source/verilator/src/obj_dbg'
gmake[1]: *** [Makefile:70: ../bin/verilator_bin_dbg] Error 2
gmake[1]: Leaving directory '/export/home/branco/go/src/verilator_from_source/verilator/src'
gmake: *** [Makefile:230: verilator_exe] Error 2

@brancoliticus brancoliticus added the new label Feb 6, 2020
@wsnyder

This comment has been minimized.

Copy link
Member

@wsnyder wsnyder commented Feb 6, 2020

Try
double logcost = log(static_cast(cost));

If that works feel free to make a pull request, add your name to docs/CONTRIBUTORS and you can get the credit. :)

@brancoliticus

This comment has been minimized.

Copy link
Author

@brancoliticus brancoliticus commented Feb 7, 2020

Now it's a different error:

g++ -I/usr/local/include -std=gnu++14 -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -I/usr/local/include -MMD -I. -I.. -I.. -I../../include -I../../include -DYYDEBUG -ggdb -DVL_DEBUG -D_GLIBCXX_DEBUG -MP -Wno-unused-parameter -Wno-shadow -DDEFENV_SYSTEMC="" -DDEFENV_SYSTEMC_ARCH="" -DDEFENV_SYSTEMC_INCLUDE="" -DDEFENV_SYSTEMC_LIBDIR="" -DDEFENV_VERILATOR_ROOT="/usr/local/share/verilator" -c ../V3Partition.cpp
../V3Partition.cpp: In static member function 'static uint32_t LogicMTask::stepCost(uint32_t)':
../V3Partition.cpp:547:41: error: expected '<' before '(' token
double logcost = log(static_cast(cost));
^
../V3Partition.cpp:547:41: error: expected type-specifier before '(' token
../V3Partition.cpp:547:41: error: expected '>' before '(' token
gmake[2]: *** [../Makefile_obj:286: V3Partition.o] Error 1
gmake[2]: Leaving directory '/export/home/branco/go/src/verilator_from_source/verilator/src/obj_dbg'
gmake[1]: *** [Makefile:70: ../bin/verilator_bin_dbg] Error 2
gmake[1]: Leaving directory '/export/home/branco/go/src/verilator_from_source/verilator/src'
gmake: *** [Makefile:230: verilator_exe] Error 2

Side note: I hope this doesn't degenerate into a wack-a-mole type situation with hundreds of errors to fix one compilation error at a time.

Side note 2: It's not my credit so I don't want it.

@brancoliticus

This comment has been minimized.

Copy link
Author

@brancoliticus brancoliticus commented Feb 7, 2020

I fixed the compilation at least with: double logcost = log(static_cast(cost));

But now I get a new error:

g++ -I/usr/local/include -std=gnu++14 -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -I/usr/local/include -MMD -I. -I.. -I.. -I../../include -I../../include -DYYDEBUG -ggdb -DVL_DEBUG -D_GLIBCXX_DEBUG -MP -Wno-unused-parameter -Wno-shadow -DDEFENV_SYSTEMC="" -DDEFENV_SYSTEMC_ARCH="" -DDEFENV_SYSTEMC_INCLUDE="" -DDEFENV_SYSTEMC_LIBDIR="" -DDEFENV_VERILATOR_ROOT="/usr/local/share/verilator" -c ../V3TSP.cpp
../V3TSP.cpp: In member function 'virtual int TspTestState::cost(const TspTestState*) const':
../V3TSP.cpp:552:49: error: call of overloaded 'sqrt(unsigned int)' is ambiguous
return lround(sqrt(xabsxabs + yabsyabs));
^
In file included from /usr/include/math.h:35:0,
from /usr/gcc/6/include/c++/6.5.0/cmath:45,
from ../V3TSP.cpp:35:
/usr/include/iso/math_iso.h:77:15: note: candidate: double std::sqrt(double)
extern double sqrt(double);
^~~~
/usr/include/iso/math_iso.h:183:15: note: candidate: float std::sqrt(float)
inline float sqrt(float __X) { return __sqrtf(__X); }
^~~~
/usr/include/iso/math_iso.h:232:21: note: candidate: long double std::sqrt(long double)
inline long double sqrt(long double __X) { return __sqrtl(__X); }
^~~~
gmake[2]: *** [../Makefile_obj:286: V3TSP.o] Error 1
gmake[2]: Leaving directory '/export/home/branco/go/src/verilator_from_source/verilator/src/obj_dbg'
gmake[1]: *** [Makefile:70: ../bin/verilator_bin_dbg] Error 2
gmake[1]: Leaving directory '/export/home/branco/go/src/verilator_from_source/verilator/src'
gmake: *** [Makefile:230: verilator_exe] Error 2

@wsnyder

This comment has been minimized.

Copy link
Member

@wsnyder wsnyder commented Feb 7, 2020

Same sort of fix, might need several more....

return lround(sqrt(static_cast<double>(xabsxabs + yabsyabs)));
@brancoliticus

This comment has been minimized.

Copy link
Author

@brancoliticus brancoliticus commented Feb 7, 2020

Please note that static_cast<double> gets printed as static_cast when not inside github interface code markdown. So I presume you wrote static_cast<double> and the github interface ate the <double> part?

Did you therefore write return lround(sqrt(static_cast<double>(xabs*xabs + yabs*yabs))); instead of return lround(sqrt(static_cast(xabsxabs + yabsyabs))); as I see?

I'm unsure about the double instead of float or long double part? Do I put everything to double everywhere? So I don't ask on every possible new occurrence of casting to floating point?

@wsnyder

This comment has been minimized.

Copy link
Member

@wsnyder wsnyder commented Feb 7, 2020

Sorry, should have added spaces (edited above).

       return lround(sqrt(static_cast<double>(xabsxabs + yabsyabs)));

There aren't any uses of "long double" as Verilog doesn't support that type.

@brancoliticus

This comment has been minimized.

Copy link
Author

@brancoliticus brancoliticus commented Feb 7, 2020

I hit a perl issue:

pod2man bin/verilator verilator.1
gmake: pod2man: Command not found
gmake: *** [Makefile:271: verilator.1] Error 127

I have a pod2{man,text,html} at /opt/local/bin/pod2man. How do I tell gmake to use them? I also don't have pod2latex.

@brancoliticus

This comment has been minimized.

Copy link
Author

@brancoliticus brancoliticus commented Feb 7, 2020

I changed PATH=$PATH:/opt/local/bin and it finished the compilation.
Now gmake test fails.

Output from 'gmake test>~verilator_gmake_test_output.txt' :


making verilator in src
gmake -C src 
gmake[1]: Entering directory '/export/home/branco/go/src/verilator_from_source/verilator/src'
gmake -C obj_dbg -j 1  TGT=../../bin/verilator_bin_dbg VL_DEBUG=1 -f ../Makefile_obj serial
gmake[2]: Entering directory '/export/home/branco/go/src/verilator_from_source/verilator/src/obj_dbg'
gmake[2]: Nothing to be done for 'serial'.
gmake[2]: Leaving directory '/export/home/branco/go/src/verilator_from_source/verilator/src/obj_dbg'
gmake -C obj_dbg       TGT=../../bin/verilator_bin_dbg VL_DEBUG=1 -f ../Makefile_obj
gmake[2]: Entering directory '/export/home/branco/go/src/verilator_from_source/verilator/src/obj_dbg'
      Compile flags:  g++ -I/usr/local/include -I/usr/local/include -std=gnu++14 -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -I/usr/local/include -MMD -I. -I.. -I.. -I../../include -I../../include -DYYDEBUG -ggdb -DVL_DEBUG -D_GLIBCXX_DEBUG -MP -Wno-unused-parameter -Wno-shadow -DDEFENV_SYSTEMC="" -DDEFENV_SYSTEMC_ARCH="" -DDEFENV_SYSTEMC_INCLUDE="" -DDEFENV_SYSTEMC_LIBDIR="" -DDEFENV_VERILATOR_ROOT="/usr/local/share/verilator"
gmake[2]: Leaving directory '/export/home/branco/go/src/verilator_from_source/verilator/src/obj_dbg'
gmake -C obj_dbg       TGT=../../bin/verilator_coverage_bin_dbg VL_DEBUG=1 VL_VLCOV=1 -f ../Makefile_obj serial_vlcov
gmake[2]: Entering directory '/export/home/branco/go/src/verilator_from_source/verilator/src/obj_dbg'
gmake[2]: Nothing to be done for 'serial_vlcov'.
gmake[2]: Leaving directory '/export/home/branco/go/src/verilator_from_source/verilator/src/obj_dbg'
gmake -C obj_dbg       TGT=../../bin/verilator_coverage_bin_dbg VL_DEBUG=1 VL_VLCOV=1 -f ../Makefile_obj
gmake[2]: Entering directory '/export/home/branco/go/src/verilator_from_source/verilator/src/obj_dbg'
      Compile flags:  g++ -I/usr/local/include -I/usr/local/include -std=gnu++14 -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -I/usr/local/include -MMD -I. -I.. -I.. -I../../include -I../../include -DYYDEBUG -ggdb -DVL_DEBUG -D_GLIBCXX_DEBUG -MP -Wno-unused-parameter -Wno-shadow -DDEFENV_SYSTEMC="" -DDEFENV_SYSTEMC_ARCH="" -DDEFENV_SYSTEMC_INCLUDE="" -DDEFENV_SYSTEMC_LIBDIR="" -DDEFENV_VERILATOR_ROOT="/usr/local/share/verilator"
gmake[2]: Leaving directory '/export/home/branco/go/src/verilator_from_source/verilator/src/obj_dbg'
gmake -C obj_opt -j 1  TGT=../../bin/verilator_bin -f ../Makefile_obj serial
gmake[2]: Entering directory '/export/home/branco/go/src/verilator_from_source/verilator/src/obj_opt'
gmake[2]: Nothing to be done for 'serial'.
gmake[2]: Leaving directory '/export/home/branco/go/src/verilator_from_source/verilator/src/obj_opt'
gmake -C obj_opt       TGT=../../bin/verilator_bin -f ../Makefile_obj
gmake[2]: Entering directory '/export/home/branco/go/src/verilator_from_source/verilator/src/obj_opt'
      Compile flags:  g++ -I/usr/local/include -I/usr/local/include -std=gnu++14 -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -I/usr/local/include -MMD -I. -I.. -I.. -I../../include -I../../include -DYYDEBUG -O2 -MP -Wno-unused-parameter -Wno-shadow -DDEFENV_SYSTEMC="" -DDEFENV_SYSTEMC_ARCH="" -DDEFENV_SYSTEMC_INCLUDE="" -DDEFENV_SYSTEMC_LIBDIR="" -DDEFENV_VERILATOR_ROOT="/usr/local/share/verilator"
gmake[2]: Leaving directory '/export/home/branco/go/src/verilator_from_source/verilator/src/obj_opt'
gmake[1]: Leaving directory '/export/home/branco/go/src/verilator_from_source/verilator/src'
test_regress/t/t_a1_first_cc.pl
======================================================================
dist/t_a1_first_cc: ==================================================
dist/t_a1_first_cc: %Skip: Skip: scenario 'dist' not enabled for test
======================================================================
vlt/t_a1_first_cc: ==================================================
	perl ../bin/verilator --debug --debugi 0 --gdbbt --no-dump-tree -V
-n
No stack.
Starting Verilator 4.026 2020-01-11 rev v4.026-2-g0c6c83e2
Starting Verilator 4.026 2020-01-11 rev v4.026-2-g0c6c83e2
Verilator 4.026 2020-01-11 rev v4.026-2-g0c6c83e2

Copyright 2003-2020 by Wilson Snyder.  Verilator is free software; you can
redistribute it and/or modify the Verilator internals under the terms of
either the GNU Lesser General Public License Version 3 or the Perl Artistic
License Version 2.0.

See https://verilator.org for documentation

Summary of configuration:
  Compiled in defaults if not in environment:
    SYSTEMC            = 
    SYSTEMC_ARCH       = 
    SYSTEMC_INCLUDE    = 
    SYSTEMC_LIBDIR     = 
    VERILATOR_ROOT     = /usr/local/share/verilator

Environment:
    PERL               = 
    SYSTEMC            = 
    SYSTEMC_ARCH       = 
    SYSTEMC_INCLUDE    = 
    SYSTEMC_LIBDIR     = 
    VERILATOR_ROOT     = /export/home/branco/go/src/verilator_from_source/verilator/test_regress/..
    VERILATOR_BIN      = 
[Thread debugging using libthread_db enabled]
[Inferior 1 (process 1549    ) exited normally]
No stack.
	perl /export/home/branco/go/src/verilator_from_source/verilator/test_regress/../bin/verilator --prefix Vt_a1_first_cc ../obj_vlt/t_a1_first_cc/Vt_a1_first_cc__main.cpp --exe --make gmake --x-assign unique -cc -Mdir obj_vlt/t_a1_first_cc -OD --debug-check --comp-limit-members 10 --debug --debugi 0 --gdbbt --no-dump-tree --trace --clk clk  -f input.vc +define+TEST_OBJ_DIR=obj_vlt/t_a1_first_cc t/t_a1_first_cc.v    > obj_vlt/t_a1_first_cc/vlt_compile.log
-n
No stack.
Starting Verilator 4.026 2020-01-11 rev v4.026-2-g0c6c83e2
Starting Verilator 4.026 2020-01-11 rev v4.026-2-g0c6c83e2
[Thread debugging using libthread_db enabled]
[Inferior 1 (process 1555    ) exited normally]
No stack.
	make -C obj_vlt/t_a1_first_cc -f /export/home/branco/go/src/verilator_from_source/verilator/test_regress/Makefile_obj --no-print-directory VM_PREFIX=Vt_a1_first_cc TEST_OBJ_DIR=obj_vlt/t_a1_first_cc CPPFLAGS_DRIVER=-DT_A1_FIRST_CC   Vt_a1_first_cc    > obj_vlt/t_a1_first_cc/vlt_gcc.log
make: Warning: Can't find `.mk': No such file or directory
Current working directory /export/home/branco/go/src/verilator_from_source/verilator/test_regress/obj_vlt/t_a1_first_cc
make: Fatal error in reader: /export/home/branco/go/src/verilator_from_source/verilator/test_regress/Makefile_obj, line 17: Read of include file `.mk' failed
Current working directory /export/home/branco/go/src/verilator_from_source/verilator/test_regress/obj_vlt/t_a1_first_cc
vlt/t_a1_first_cc: %Error: Exec of make failed: make: Warning: Can't find `.mk': No such file or directory
vlt/t_a1_first_cc: FAILED: Exec of make failed: make: Warning: Can't find `.mk': No such file or directory

======================================================================
	#vlt/t_a1_first_cc: %Error: Exec of make failed: make: Warning: Can't find `.mk': No such file or directory
		make && test_regress/t/t_a1_first_cc.pl  --vlt
TESTS DONE, FAILED: Passed 0  Failed 1  Unsup 0  Time 0:04

@wsnyder

This comment has been minimized.

Copy link
Member

@wsnyder wsnyder commented Feb 7, 2020

Looks like "make" isn't GNU make. Run whatever command gets you gnu make, perhaps gmake.

@brancoliticus

This comment has been minimized.

Copy link
Author

@brancoliticus brancoliticus commented Feb 7, 2020

I did run 'gmake test'. It seems like usage of 'make' is embedded in the script, not the command I used to launch it.

@wsnyder

This comment has been minimized.

Copy link
Member

@wsnyder wsnyder commented Feb 7, 2020

Please pull and use master "git pull ; git checkout master" where you should now be able to "export MAKE=gmake" then this should work. If not let's see what's next.

BTW we won't be officially regressing OpenSolaris/illumos. By using that, you should expect you mayl need to do some small amount of occasional debug/maintenance and pull requests to keep it working.

wsnyder added a commit that referenced this issue Feb 7, 2020
@brancoliticus

This comment has been minimized.

Copy link
Author

@brancoliticus brancoliticus commented Feb 8, 2020

I did:
git stash
git pull
git checkout master
git statsh pop
PATH=$PATH:/opt/local/bin
gmake
MAKE=gmake
make test

The result is:
make: Fatal error in reader: Makefile, line 204: Unexpected end of line seen

203 DISTFILES := $(DISTFILES_INC)
204
205 EXAMPLES_FIRST = \

@wsnyder

This comment has been minimized.

Copy link
Member

@wsnyder wsnyder commented Feb 8, 2020

gmake MAKE=gmake test

@brancoliticus

This comment has been minimized.

Copy link
Author

@brancoliticus brancoliticus commented Feb 8, 2020

gmake MAKE=gmake test >~/verilator_gmake_test.txt 2>~/verilator_gmake_test_error_output.txt

didn't work.

verilator_gmake_test.txt
verilator_gmake_test_error_output.txt

@wsnyder

This comment has been minimized.

Copy link
Member

@wsnyder wsnyder commented Feb 8, 2020

You don't have the fixes, you need to "git pull".

@brancoliticus

This comment has been minimized.

Copy link
Author

@brancoliticus brancoliticus commented Feb 8, 2020

WIth the two changes to fix floating point issues of course,

git log:

commit 70358e8 (HEAD -> master, origin/master, origin/HEAD)
Author: Wilson Snyder wsnyder@wsnyder.org
Date: Sat Feb 8 10:58:07 2020 -0500

Fix compiler warning.

gmake test >~/verilator_gmake_test.txt 2>~/verilator_gmake_test_error_output.txt:

verilator_gmake_test.txt
verilator_gmake_test_error_output.txt

@wsnyder

This comment has been minimized.

Copy link
Member

@wsnyder wsnyder commented Feb 8, 2020

This

make -C obj_vlt/t_a1_first_cc

Should be saying gmake. Not sure why it isn't now, please debug and provide whatever patches make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.