# Messed up C++ library



## goose121 (Jun 20, 2017)

I think I messed up libc++. I was trying to get something to compile, and I think I `pkg remove -f`'ed devel/llvm39 and reinstalled it. Now when I try and compile anything in C++ I get an error like the following:

```
/usr/include/c++/v1/cmath:679:46: error: declaration conflicts with target of
      using declaration already in scope
inline _LIBCPP_INLINE_VISIBILITY float       acos(float __lcpp_x) _NOEXC...
                                             ^
/usr/include/c++/v1/math.h:654:46: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY float       acos(float __lcpp_x) _NOEXC...
                                             ^
/usr/include/c++/v1/cmath:675:9: note: using declaration
using ::acos;
        ^
/usr/include/c++/v1/cmath:680:46: error: declaration conflicts with target of
      using declaration already in scope
inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) ...
                                             ^
/usr/include/c++/v1/math.h:655:46: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) ...
                                             ^
/usr/include/c++/v1/cmath:675:9: note: using declaration
using ::acos;
        ^
/usr/include/c++/v1/cmath:686:1: error: declaration conflicts with target of
      using declaration already in scope
acos(_A1 __lcpp_x) _NOEXCEPT {return acos((double)__lcpp_x);}
^
/usr/include/c++/v1/math.h:661:1: note: target of using declaration
acos(_A1 __lcpp_x) _NOEXCEPT {return acos((double)__lcpp_x);}
^
/usr/include/c++/v1/cmath:675:9: note: using declaration
using ::acos;
        ^
/usr/include/c++/v1/cmath:694:46: error: declaration conflicts with target of
      using declaration already in scope
inline _LIBCPP_INLINE_VISIBILITY float       asin(float __lcpp_x) _NOEXC...
                                             ^
/usr/include/c++/v1/math.h:666:46: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY float       asin(float __lcpp_x) _NOEXC...
                                             ^
/usr/include/c++/v1/cmath:690:9: note: using declaration
using ::asin;
        ^
/usr/include/c++/v1/cmath:695:46: error: declaration conflicts with target of
      using declaration already in scope
inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) ...
                                             ^
/usr/include/c++/v1/math.h:667:46: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) ...
                                             ^
/usr/include/c++/v1/cmath:690:9: note: using declaration
using ::asin;
        ^
/usr/include/c++/v1/cmath:701:1: error: declaration conflicts with target of
      using declaration already in scope
asin(_A1 __lcpp_x) _NOEXCEPT {return asin((double)__lcpp_x);}
^
/usr/include/c++/v1/math.h:673:1: note: target of using declaration
asin(_A1 __lcpp_x) _NOEXCEPT {return asin((double)__lcpp_x);}
^
/usr/include/c++/v1/cmath:690:9: note: using declaration
using ::asin;
        ^
/usr/include/c++/v1/cmath:709:46: error: declaration conflicts with target of
      using declaration already in scope
inline _LIBCPP_INLINE_VISIBILITY float       atan(float __lcpp_x) _NOEXC...
                                             ^
/usr/include/c++/v1/math.h:678:46: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY float       atan(float __lcpp_x) _NOEXC...
                                             ^
/usr/include/c++/v1/cmath:705:9: note: using declaration
using ::atan;
        ^
/usr/include/c++/v1/cmath:710:46: error: declaration conflicts with target of
      using declaration already in scope
inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) ...
                                             ^
/usr/include/c++/v1/math.h:679:46: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) ...
                                             ^
/usr/include/c++/v1/cmath:705:9: note: using declaration
using ::atan;
        ^
/usr/include/c++/v1/cmath:716:1: error: declaration conflicts with target of
      using declaration already in scope
atan(_A1 __lcpp_x) _NOEXCEPT {return atan((double)__lcpp_x);}
^
/usr/include/c++/v1/math.h:685:1: note: target of using declaration
atan(_A1 __lcpp_x) _NOEXCEPT {return atan((double)__lcpp_x);}
^
/usr/include/c++/v1/cmath:705:9: note: using declaration
using ::atan;
        ^
/usr/include/c++/v1/cmath:724:46: error: declaration conflicts with target of
      using declaration already in scope
inline _LIBCPP_INLINE_VISIBILITY float       atan2(float __lcpp_y, floa...
                                             ^
/usr/include/c++/v1/math.h:690:46: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY float       atan2(float __lcpp_y, floa...
                                             ^
/usr/include/c++/v1/cmath:720:9: note: using declaration
using ::atan2;
        ^
/usr/include/c++/v1/cmath:725:46: error: declaration conflicts with target of
      using declaration already in scope
inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y...
                                             ^
/usr/include/c++/v1/math.h:691:46: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y...
                                             ^
/usr/include/c++/v1/cmath:720:9: note: using declaration
using ::atan2;
        ^
/usr/include/c++/v1/cmath:736:1: error: declaration conflicts with target of
      using declaration already in scope
atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
^
/usr/include/c++/v1/math.h:702:1: note: target of using declaration
atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
^
/usr/include/c++/v1/cmath:720:9: note: using declaration
using ::atan2;
        ^
/usr/include/c++/v1/cmath:750:46: error: declaration conflicts with target of
      using declaration already in scope
inline _LIBCPP_INLINE_VISIBILITY float       ceil(float __lcpp_x) _NOEXC...
                                             ^
/usr/include/c++/v1/math.h:713:46: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY float       ceil(float __lcpp_x) _NOEXC...
                                             ^
/usr/include/c++/v1/cmath:746:9: note: using declaration
using ::ceil;
        ^
/usr/include/c++/v1/cmath:751:46: error: declaration conflicts with target of
      using declaration already in scope
inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) ...
                                             ^
/usr/include/c++/v1/math.h:714:46: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) ...
                                             ^
/usr/include/c++/v1/cmath:746:9: note: using declaration
using ::ceil;
        ^
/usr/include/c++/v1/cmath:757:1: error: declaration conflicts with target of
      using declaration already in scope
ceil(_A1 __lcpp_x) _NOEXCEPT {return ceil((double)__lcpp_x);}
^
/usr/include/c++/v1/math.h:720:1: note: target of using declaration
ceil(_A1 __lcpp_x) _NOEXCEPT {return ceil((double)__lcpp_x);}
^
/usr/include/c++/v1/cmath:746:9: note: using declaration
using ::ceil;
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
```
Does anyone know how I can fix my C++ installation?
EDIT: I can't reinstall from source, because trying to compile either buildworld or just libc++ gives me a similar stream of errors


----------



## SirDice (Jun 20, 2017)

goose121 said:


> I can't reinstall from source, because trying to compile either buildworld or just libc++ gives me a similar stream of errors


A buildworld doesn't depend on _external_ compilers or libraries. So you should be able to build it even if you severely screwed devel/llvm39 up.

Does /etc/make.conf exist? If yes, what does it contain?


----------



## goose121 (Jun 22, 2017)

It contains:

```
DEVELOPER=yes
DEFAULT_VERSIONS+=ssl=openssl
```
I also tried without DEVELOPER=yes; it still gave me the same errors


----------



## goose121 (Jun 22, 2017)

I have absolutely no idea what went wrong, but I noticed that all of the errors were in included files, so I got rid of /usr/include/c++ (by moving it, not deleting it), re-created /usr/include/c++ as an empty directory, copied /usr/include/contrib/c++/include to /usr/include/c++/v1, and everything works!


----------

