Rebuild FreeBSD dari source
, cukup lama googling mencari referensi error yang terjadi, ternyata solusinya cukup simple meskipun dengan nebak2 library clang(1)
yg digunakan. Seperti kita ketahui bahwa FreeBSD 10.0-RELEASE
sudah merubah untuk default compilernya dari GCC
ke clang(1)
. Berikut saya post error yang terjadi:c++ -O2 -pipe -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/tools/clang/include -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support -I. -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/../../lib/clang/include -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DNDEBUG -fno-strict-aliasing -DLLVM_DEFAULT_TARGET_TRIPLE=\"i386-unknown-freebsd10.3\" -DLLVM_HOST_TRIPLE=\"i386-unknown-freebsd10.3\" -DDEFAULT_SYSROOT=\"\" -ffunction-sections -fdata-sections -I/usr/obj/usr/src/tmp/legacy/usr/include -fno-exceptions -fno-rtti -c /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/APFloat.cpp -o APFloat.o
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/APFloat.cpp:15:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/ADT/APFloat.h:20:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/ADT/APInt.h:19:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/ADT/ArrayRef.h:14:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/ADT/SmallVector.h:17:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/Support/AlignOf.h:19:
In file included from /usr/include/c++/v1/cstddef:38:
In file included from /usr/include/c++/v1/stddef.h:51:
/usr/include/c++/v1/__nullptr:24:29: error: variable has incomplete type 'struct _LIBCPP_TEMPLATE_VIS'
struct _LIBCPP_TEMPLATE_VIS nullptr_t
^
/usr/include/c++/v1/__nullptr:24:8: note: forward declaration of 'std::__1::_LIBCPP_TEMPLATE_VIS'
struct _LIBCPP_TEMPLATE_VIS nullptr_t
^
/usr/include/c++/v1/__nullptr:24:38: error: expected ';' after top level declarator
struct _LIBCPP_TEMPLATE_VIS nullptr_t
^
/usr/include/c++/v1/__nullptr:47:48: error: unknown type name 'nullptr_t'
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
^
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/APFloat.cpp:15:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/ADT/APFloat.h:20:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/ADT/APInt.h:19:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/ADT/ArrayRef.h:14:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/ADT/SmallVector.h:19:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/Support/MathExtras.h:18:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/Support/SwapByteOrder.h:18:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/../../lib/clang/include/llvm/Support/DataTypes.h:36:
In file included from /usr/include/c++/v1/cmath:301:
In file included from /usr/include/c++/v1/math.h:309:
/usr/include/c++/v1/type_traits:472:114: error: expected class name
: public integral_constant(nullptr)) == 1> {};
^
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/APFloat.cpp:15:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/ADT/APFloat.h:20:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/ADT/APInt.h:19:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/ADT/ArrayRef.h:14:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/ADT/SmallVector.h:19:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/Support/MathExtras.h:18:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include/llvm/Support/SwapByteOrder.h:18:
In file included from /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/../../lib/clang/include/llvm/Support/DataTypes.h:36:
/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) _NOEXCEPT {return acosf(__lcpp_x);}
^
/usr/include/c++/v1/math.h:654:46: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return acosf(__lcpp_x);}
^
/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) _NOEXCEPT {return acosl(__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) _NOEXCEPT {return acosl(__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) _NOEXCEPT {return asinf(__lcpp_x);}
^
/usr/include/c++/v1/math.h:666:46: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return asinf(__lcpp_x);}
^
/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) _NOEXCEPT {return asinl(__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) _NOEXCEPT {return asinl(__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) _NOEXCEPT {return atanf(__lcpp_x);}
^
/usr/include/c++/v1/math.h:678:46: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return atanf(__lcpp_x);}
^
/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) _NOEXCEPT {return atanl(__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) _NOEXCEPT {return atanl(__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, float __lcpp_x) _NOEXCEPT {return atan2f(__lcpp_y, __lcpp_x);}
^
/usr/include/c++/v1/math.h:690:46: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return atan2f(__lcpp_y, __lcpp_x);}
^
/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, long double __lcpp_x) _NOEXCEPT {return atan2l(__lcpp_y, __lcpp_x);}
^
/usr/include/c++/v1/math.h:691:46: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return atan2l(__lcpp_y, __lcpp_x);}
^
/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) _NOEXCEPT {return ceilf(__lcpp_x);}
^
/usr/include/c++/v1/math.h:713:46: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ceilf(__lcpp_x);}
^
/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) _NOEXCEPT {return ceill(__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) _NOEXCEPT {return ceill(__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.
*** Error code 1
Stop.
make[3]: stopped in /usr/src/lib/clang/libllvmsupport
*** Error code 1
Stop.
make[2]: stopped in /usr/src
*** Error code 1
Stop.
make[1]: stopped in /usr/src
*** Error code 1
Stop.
make: stopped in /usr/src
Solusi yang saya lakukan adalah sbb:Keyword ada di
/usr/include/c++/v1/cmath:746
, error itu kurang lebih seputar header declaration
konflik dengan header
yang sudah terinstall sebelomnya. Tipe data long double
sepertinya tidak dapat didefinisikan di scope
ketika proses build object file
. Temukan file cmath
di /usr
dengan perintah:root:/usr# find . -type f -name "cmath"
./src/contrib/libstdc++/include/tr1/cmath
./src/contrib/libc++/include/cmath (cmath dari source SVN)
./include/c++/v1/cmath (cmath yang bermasalah)
./local/lib/gcc5/include/c++/ext/cmath
./local/lib/gcc5/include/c++/tr1/cmath
./local/lib/gcc5/include/c++/cmath
OK, kita liat susunan direktori & filenya banyak kemiripan antara /usr/include/c++/v1/
dengan /usr/src/contrib/libc++/include/
. Kita tinggal copykan saja tapi sebelomnya kita backup terlebih dahulu.root:~# cd /usr/include/c++
root:/usr/include/c++# mv v1 v1.old
root:/usr/include/c++# cp -rp /usr/src/contrib/libc++/include .
root:/usr/include/c++# mv include v1
Silahkan dicoba kembali proses make buildworld
, saya mengalami kekurangan dua file header yg dibutuhkan yaitu cxxabi.h
dan unwind.h
, silahkan kita cari lagi kedua file ini di /usr/src
dan kopikan saja:root:/usr/include/c++/v1# find /usr/src -type f -name "cxxabi.h"
/usr/src/contrib/libstdc++/libsupc++/cxxabi.h
/usr/src/contrib/libcxxrt/cxxabi.h (Kita ambil yang ini)
root:/usr/include/c++/v1# cp /usr/src/contrib/libcxxrt/cxxabi.h .
root:/usr/include/c++/v1# find /usr/src -type f -name "unwind.h"
/usr/src/sys/ia64/include/unwind.h
/usr/src/contrib/libcxxrt/unwind.h
/usr/src/contrib/llvm/tools/clang/lib/Headers/unwind.h (Kita ambil yang ini)
/usr/src/contrib/libexecinfo/unwind.h
/usr/src/include/unwind.h
root:/usr/include/c++/v1# cp /usr/src/contrib/llvm/tools/clang/lib/Headers/unwind.h .
Silahkan make buildworld
kembali, jika ada error coba teliti stderr
di consolenya. Dan silahkan tebak2 lagi seperti contoh langkah diatas :-).