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

Error at make: VariantIndex.cpp:89:16: error: call to 'abs' is ambiguous #141

Closed
evanbiederstedt opened this issue Dec 6, 2017 · 13 comments

Comments

@evanbiederstedt
Copy link

evanbiederstedt commented Dec 6, 2017

All dependencies appear to be installed correctly, in the "default" locations with sudo privileges. (I am not using the jemalloc memory allocator.)

Within /sga-master/src, I first ran ./configure via

$ ./configure  --with-sparsehash=/usr/local/include/sparsehash --with-bamtools=/usr/local/

whereby all checks pass successfully. Then I try make in the same location:


$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in bin
make[2]: Nothing to be done for `all'.
Making all in Thirdparty
make[2]: Nothing to be done for `all'.
Making all in Util
g++ -DHAVE_CONFIG_H -I. -I..  -I../Bigraph -I../Thirdparty -I/usr/local/include/sparsehash/include -I/usr/local//include -I/usr/local//include/bamtools -Wall -Wextra  -Wno-unknown-pragmas -std=c++98 -O3 -MT libutil_a-VariantIndex.o -MD -MP -MF .deps/libutil_a-VariantIndex.Tpo -c -o libutil_a-VariantIndex.o `test -f 'VariantIndex.cpp' || echo './'`VariantIndex.cpp
VariantIndex.cpp:89:16: error: call to 'abs' is ambiguous
            if(abs(record.position - position) < distance)
               ^~~
/usr/include/stdlib.h:129: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);}
^
1 error generated.
make[2]: *** [libutil_a-VariantIndex.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Resolutions?

@jts
Copy link
Owner

jts commented Dec 6, 2017

I suspect you're using gcc >4? Do you get an error if you use one of the 4.x gcc versions?

@evanbiederstedt
Copy link
Author

I suspect you're using gcc >4?

I don't think so. I'm trying this on my MacOS:

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$ gcc -dumpversion
4.2.1

So it looks like I get this via gcc 4.2.1

@jts
Copy link
Owner

jts commented Dec 6, 2017

It is probably due to clang. Could you try installing using homebrew? SGA hasn't been updated in awhile so homebew should give you the latest version.

@evanbiederstedt
Copy link
Author

It is probably due to clang.

The above via gcc -v looks like it's using clang version: Apple LLVM version 9.0.0 (clang-900.0.38)

Brew currently installs:

$ brew install gcc
Warning: gcc 7.2.0 is already installed

Could you try installing using homebrew?

I think you mean use the newest version of gcc installed via Homebrew. Homebrew places this in /usr/local/bin, it appears

I've tried export PATH=/usr/local/bin:$PATH before make clean and make, as well as creating a symbolic link from the Homebrew version, e.g.

cd /usr/local/bin
ln -s gcc-7 gcc

I'm still getting the same error with make:


g++ -DHAVE_CONFIG_H -I. -I..  -I../Bigraph -I../Thirdparty -I/usr/local/include/sparsehash/include -I/usr/local//include -I/usr/local//include/bamtools -Wall -Wextra  -Wno-unknown-pragmas -std=c++98 -O3 -MT libutil_a-VariantIndex.o -MD -MP -MF .deps/libutil_a-VariantIndex.Tpo -c -o libutil_a-VariantIndex.o `test -f 'VariantIndex.cpp' || echo './'`VariantIndex.cpp
VariantIndex.cpp:89:16: error: call to 'abs' is ambiguous
            if(abs(record.position - position) < distance)
               ^~~
/usr/include/stdlib.h:129: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);}
^
1 error generated.
make[2]: *** [libutil_a-VariantIndex.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2


@jts
Copy link
Owner

jts commented Dec 6, 2017

I meant to install sga with homebrew, sorry for being unclear:

brew install sga

@evanbiederstedt
Copy link
Author

Oh, I see

Hmmm. It doesn't like that:

$ brew install sga
Error: No available formula with the name "sga" 
==> Searching for a previously deleted formula...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching for similarly named formulae...
==> Searching local taps...

This similarly named formula was found:
vorbisgain
To install it, run:
  brew install vorbisgain
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.

Brew is upgraded/updated.

@evanbiederstedt
Copy link
Author

evanbiederstedt commented Dec 6, 2017

I meant to install sga with homebrew, sorry for being unclear:

Also, just to clarify, as I'm installing soon on Linux as well: what would be the correct gcc/clang versions to use?

@jts
Copy link
Owner

jts commented Dec 6, 2017

Ah sorry, you need to install the homebrew science formulas first:

brew tap homebrew/science
brew install sga

For linux gcc-4.7 or gcc-4.8 should be fine.

Jared

@evanbiederstedt
Copy link
Author

It works, thanks!

I'll let you know if there's an installation on Linux in a new Issue. Consider this closed I suppose (though it might be a good idea to tell Mac OS users just to try brew, or to specify the correct gcc, e.g. if they already use MacPorts/whatever)

Thanks, Evan

@jts
Copy link
Owner

jts commented Dec 7, 2017

Great, glad I could help.

@jts jts closed this as completed Dec 7, 2017
@sjackman
Copy link
Contributor

Here's a PR to fix this error call to 'abs' is ambiguous: #148

@sjackman
Copy link
Contributor

@evanbiederstedt Once PR brewsci/homebrew-bio#67 has been merged, you can install sga on both Linux and macOS using Linuxbrew and Homebrew.

brew install brewsci/bio/sga

See http://linuxbrew.sh and https://brew.sh

@evanbiederstedt
Copy link
Author

evanbiederstedt commented Feb 27, 2018 via email

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

3 participants