# Freshly installed system, strange error with various ports: call to 'abs' is ambiguous



## Snurg (Nov 28, 2017)

I am setting up a new 11.1release system. 
Now I am installing program by program after the basic stuff has been set up (X, fvwm, some browsers).

Now as I attempted to install libreoffice, `make install` stopped because of errors: "call to 'abs' is ambiguous" in its vigra dependency. So I left that for later.
Here a snippet from the output, maybe it gives you an idea?

```
/usr/ports/graphics/vigra/work/vigra-e6c21f3/include/vigra/mathutil.hxx:151:14: note: expanded from macro 'VIGRA_DEFINE_MISSING_ABS'
inline T abs(T t) { return t < 0 ? static_cast<T>(-t) : t; }
^
/usr/ports/graphics/vigra/work/vigra-e6c21f3/include/vigra/mathutil.hxx:642:67: error: call to 'abs' is ambiguous
inline NormTraits<long long>::NormType norm(long long t) { return abs((long int) t); }
^~~
/usr/src/include/stdlib.h:85:6: note: candidate function
int abs(int) __pure2;
^
/usr/include/c++/v1/math.h:640:1: note: candidate function
abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
^
/usr/include/c++/v1/math.h:644:1: note: candidate function
abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);}
^
/usr/include/c++/v1/math.h:648:1: note: candidate function
abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
```

Now I get apparently the same problem when attempting to install waterfox.


```
[ 27%] Building CXX object lib/Transforms/Utils/CMakeFiles/LLVMTransformUtils.dir/DemoteRegToStack.cpp.o
/usr/ports/lang/rust/work/rustc-1.22.1-src/src/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp:117:29: error: call to 'abs' is ambiguous
uint64_t DiffUnitsAbs = std::abs(DiffUnits);
^~~~~~~~
/usr/include/c++/v1/math.h:640:1: note: candidate function
abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
^
/usr/include/c++/v1/math.h:644:1: note: candidate function
abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);}
^
/usr/include/c++/v1/math.h:648:1: note: candidate function
abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
^
/usr/src/include/stdlib.h:85:6: note: candidate function
int abs(int) __pure2;
^
1 error generated.
gmake[6]: *** [lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/build.make:87: lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/AlignmentFromAssumptions.cpp.o] Error 1
gmake[6]: Leaving directory '/usr/ports/lang/rust/work/rustc-1.22.1-src/build/x86_64-unknown-freebsd/llvm/build'
gmake[5]: *** [CMakeFiles/Makefile2:1915: lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/all] Error 2
gmake[5]: *** Waiting for unfinished jobs....
```

What makes me wonder is that these are all errors I have encountered up to now. All other stuff installed smoothly. And the two things that fail, they seem to fail due to exactly the same compilation issue?!?
I probably made some very stupid mistake. Any idea?


----------



## ShelLuser (Nov 28, 2017)

Did you make any changes in the configuration?  That is usually the #1 cause for problems, sometimes there can be a little hiccup with a port (or a setting) and when you deviate from the original you could trigger stuff like that.

When in doubt: `# make rmconfig config` and just hit enter. Then try `# make build` to see what happens.

Just to make sure: when you talk about installing program after program you're talking about building the ports, right? You're not mixing installation types?  So, for example, using `# pkg install <stuff>` to install one program and then build another program manually (the classic `# make install clean`)?

And when the errors continue to pop up also make sure that you're using the latest revision of the ports tree. So optionally also try `# portsnap fetch update` before trying to build again.


----------



## tankist02 (Nov 29, 2017)

Anything interesting in /etc/make.conf file?


----------



## Snurg (Nov 29, 2017)

ShelLuser said:


> Did you make any changes in the configuration?


Firstly not, then tried to reduce some options which I thought could be unneccessary for my needs, but the errors remained. So thanks for the `# make rmconfig config` tip!


ShelLuser said:


> You're not mixing installation types?


I am    I know I am a bad guy  
Reason is that sometimes applications are incompatible, i.e. pkg wants to downgrade or even deinstall other things just for a particular app.

And this is the case with LibreOffice.
pkg wants to uninstall my browser and downgrade several other packages, and I do not want that.

So I tried what I often did with success: build the port and make it work somehow.
And then the other program, Waterfox, it is still very fresh and untested, and there are rumors of conflicts, too.
But what *really* surprised me was that both failed due to the *exactly same* compiler error. I mean, this seems a bit unusual to me...

Now I had some thoughts.
The ports were quite fresh, I did the last portsnap fetch update a few hours ago.
Maybe it's just a quarterly issue which needs the  pkg -vv option? The plethora of things pkg wanted to downgrade for LibreOffice might indicate it's an old pkg.
Or is it just some compiler option that is needed to fix the ambiguity problem with stdlib.h and math.h regarding abs()?

Still looking for good ideas.



tankist02 said:


> Anything interesting in /etc/make.conf file?


That file does not exist (yet?).


----------



## SirDice (Nov 29, 2017)

Snurg said:


> That file does not exist (yet?).


Ok, that's good. It means it can't get in the way. In general a lot of new users try to "tune" things the wrong way and end up with strange compiler errors or unstable executables. So it's always good to rule this out quickly.


----------

