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

macOS build error #19

Open
mingz2013 opened this issue Oct 8, 2017 · 6 comments
Open

macOS build error #19

mingz2013 opened this issue Oct 8, 2017 · 6 comments

Comments

@mingz2013
Copy link

g++ -DHAVE_CONFIG_H -I. -I./analyser -I./asm -I./info -I./io/posix -I./io -I./output -I./eval -I. -DNOMACROS -O3 -fomit-frame-pointer -Wall -fsigned-char -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Woverloaded-virtual -Wnon-virtual-dtor -MT htapp.o -MD -MP -MF .deps/htapp.Tpo -c -o htapp.o htapp.cc
htapp.cc:282:7: warning: unused variable 'buflen' [-Wunused-variable]
int buflen = ht_snprintf(buf, VFS_URL_MAX, "%s:%y", listbox->getCurProto(), &res);
^
htapp.cc:769:10: warning: cast to 'void ' from smaller integer type 'uint' (aka 'unsigned int') [-Wint-to-void-pointer-cast]
return (void
)(project->count());
^
htapp.cc:3026:9: error: call to 'abs' is ambiguous
while (abs(a - b) > 1) {
^~~
/usr/include/stdlib.h:137:6: note: candidate function
int abs(int) __pure2;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:115:44: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:117:44: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:693:1: note: candidate function
abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:697:1: note: candidate function
abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:701:1: note: candidate function
abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
^
2 warnings and 1 error generated.
gmake[2]: *** [Makefile:703: htapp.o] Error 1

@renmin
Copy link

renmin commented Oct 12, 2017

same error when build it on macOS 10.13

@njZhuMin
Copy link

njZhuMin commented Nov 8, 2017

Try change call of while (abs to while (fabs in htapp.cc. That should fix everything.

@shidexiao
Copy link

my upstairs is right

@severach
Copy link

severach commented Mar 18, 2018

Here's a better fix that doesn't have any casting risks or floating point accuracy problems.

--- htapp.cc.orig 2014-09-14 11:55:26.000000000 -0400
+++ htapp.cc  2018-03-18 15:31:13.604092939 -0400
@@ -3021,11 +3021,11 @@ void do_modal_resize()

 static uint isqr(uint u)
 {
  uint a = 2;
  uint b = u/a;
- while (abs(a - b) > 1) {
+ while (a>b && a-b>1 || b>a && b-a>1) {
    a = (a+b)/2;
    b = u/a;
         }
  return MIN(a, b);
 }

Arch Linux
OpenSuSE

@ryandesign
Copy link

It's been a few years since this problem was reported... could the developer please fix it?

Looks like a fix was submitted in #18 but closed for an unknown reason.

@ryandesign
Copy link

Oh I see, it was fixed in a different way in 3b62f2f—3 years ago, 1 year before this ticket was filed. But there has not been a release of ht in almost 5 years. So please close this ticket and release a new version of ht. Thanks.

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

No branches or pull requests

6 participants