harfbuzz / harfbuzzjs

Providing HarfBuzz shaping library for client/server side JavaScript projects
https://harfbuzz.github.io/harfbuzzjs/
Other
204 stars 35 forks source link

Can’t build on macOS #11

Closed khaledhosny closed 4 years ago

khaledhosny commented 4 years ago

Running ./build.sh on an up to date macOS Catalina gives:

Cloning into 'harfbuzz'...
remote: Enumerating objects: 1984, done.
remote: Counting objects: 100% (1984/1984), done.
remote: Compressing objects: 100% (1233/1233), done.
remote: Total 1984 (delta 742), reused 1362 (delta 612), pack-reused 0
Receiving objects: 100% (1984/1984), 7.17 MiB | 374.00 KiB/s, done.
Resolving deltas: 100% (742/742), done.
Already up to date.
In file included from libc/malloc.cc:25:
libc/emmalloc.cpp:58:1: error: C++ requires a type specifier for all declarations
static_assert(sizeof(void*) == 4, "32-bit system");
^
libc/emmalloc.cpp:59:1: error: C++ requires a type specifier for all declarations
static_assert(sizeof(size_t) == 4, "32-bit system");
^
libc/emmalloc.cpp:60:1: error: C++ requires a type specifier for all declarations
static_assert(sizeof(int) == 4, "32-bit system");
^
libc/emmalloc.cpp:64:1: error: C++ requires a type specifier for all declarations
static_assert(CHAR_BIT == 8, "standard char bit size");
^
libc/emmalloc.cpp:65:1: error: C++ requires a type specifier for all declarations
static_assert(SIZE_T_BIT == 32, "standard size_t bit size");
^
libc/emmalloc.cpp:112:1: error: C++ requires a type specifier for all declarations
static_assert(ALLOC_UNIT == ALIGNMENT, "expected size of allocation unit");
^
libc/emmalloc.cpp:113:1: error: C++ requires a type specifier for all declarations
static_assert(METADATA_SIZE == ALIGNMENT, "expected size of metadata");
^
libc/emmalloc.cpp:141:1: error: C++ requires a type specifier for all declarations
static_assert(sizeof(FreeInfo) == ALLOC_UNIT, "expected size of free info");
^
libc/emmalloc.cpp:144:30: error: use of undeclared identifier 'nullptr'
static Region* firstRegion = nullptr;
                             ^
libc/emmalloc.cpp:148:29: error: use of undeclared identifier 'nullptr'
static Region* lastRegion = nullptr;
                            ^
libc/emmalloc.cpp:193:14: error: use of undeclared identifier 'nullptr'
      return nullptr;
             ^
libc/emmalloc.cpp:238:51: error: use of undeclared identifier 'nullptr'
static FreeInfo* freeLists[MAX_FREELIST_INDEX] = {nullptr, nullptr, nullptr, nullptr, nullptr,
                                                  ^
libc/emmalloc.cpp:238:60: error: use of undeclared identifier 'nullptr'
static FreeInfo* freeLists[MAX_FREELIST_INDEX] = {nullptr, nullptr, nullptr, nullptr, nullptr,
                                                           ^
libc/emmalloc.cpp:238:69: error: use of undeclared identifier 'nullptr'
static FreeInfo* freeLists[MAX_FREELIST_INDEX] = {nullptr, nullptr, nullptr, nullptr, nullptr,
                                                                    ^
libc/emmalloc.cpp:238:78: error: use of undeclared identifier 'nullptr'
static FreeInfo* freeLists[MAX_FREELIST_INDEX] = {nullptr, nullptr, nullptr, nullptr, nullptr,
                                                                             ^
libc/emmalloc.cpp:238:87: error: use of undeclared identifier 'nullptr'
static FreeInfo* freeLists[MAX_FREELIST_INDEX] = {nullptr, nullptr, nullptr, nullptr, nullptr,
                                                                                      ^
libc/emmalloc.cpp:239:3: error: use of undeclared identifier 'nullptr'
  nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
  ^
libc/emmalloc.cpp:239:12: error: use of undeclared identifier 'nullptr'
  nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
           ^
libc/emmalloc.cpp:239:21: error: use of undeclared identifier 'nullptr'
  nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
                    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
In file included from harfbuzz/src/harfbuzz.cc:1:
In file included from harfbuzz/src/hb-aat-layout.cc:28:
harfbuzz/src/hb.hh:426:1: error: C++ requires a type specifier for all declarations
static_assert ((sizeof (int8_t) == 1), "");
^
harfbuzz/src/hb.hh:427:1: error: C++ requires a type specifier for all declarations
static_assert ((sizeof (uint8_t) == 1), "");
^
harfbuzz/src/hb.hh:428:1: error: C++ requires a type specifier for all declarations
static_assert ((sizeof (int16_t) == 2), "");
^
harfbuzz/src/hb.hh:429:1: error: C++ requires a type specifier for all declarations
static_assert ((sizeof (uint16_t) == 2), "");
^
harfbuzz/src/hb.hh:430:1: error: C++ requires a type specifier for all declarations
static_assert ((sizeof (int32_t) == 4), "");
^
harfbuzz/src/hb.hh:431:1: error: C++ requires a type specifier for all declarations
static_assert ((sizeof (uint32_t) == 4), "");
^
harfbuzz/src/hb.hh:432:1: error: C++ requires a type specifier for all declarations
static_assert ((sizeof (int64_t) == 8), "");
^
harfbuzz/src/hb.hh:433:1: error: C++ requires a type specifier for all declarations
static_assert ((sizeof (uint64_t) == 8), "");
^
harfbuzz/src/hb.hh:434:1: error: C++ requires a type specifier for all declarations
static_assert ((sizeof (hb_codepoint_t) == 4), "");
^
harfbuzz/src/hb.hh:435:1: error: C++ requires a type specifier for all declarations
static_assert ((sizeof (hb_position_t) == 4), "");
^
harfbuzz/src/hb.hh:436:1: error: C++ requires a type specifier for all declarations
static_assert ((sizeof (hb_mask_t) == 4), "");
^
harfbuzz/src/hb.hh:437:1: error: C++ requires a type specifier for all declarations
static_assert ((sizeof (hb_var_int_t) == 4), "");
^
In file included from harfbuzz/src/harfbuzz.cc:1:
In file included from harfbuzz/src/hb-aat-layout.cc:28:
In file included from harfbuzz/src/hb.hh:604:
harfbuzz/src/hb-meta.hh:41:18: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template<typename... Ts> struct _hb_void_t { typedef void type; };
                 ^
harfbuzz/src/hb-meta.hh:42:18: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template<typename... Ts> using hb_void_t = typename _hb_void_t<Ts...>::type;
                 ^
harfbuzz/src/hb-meta.hh:42:44: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
template<typename... Ts> using hb_void_t = typename _hb_void_t<Ts...>::type;
                                           ^
harfbuzz/src/hb-meta.hh:44:33: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template<typename Head, typename... Ts> struct _hb_head_t { typedef Head type; };
                                ^
harfbuzz/src/hb-meta.hh:45:18: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template<typename... Ts> using hb_head_t = typename _hb_head_t<Ts...>::type;
                 ^
harfbuzz/src/hb-meta.hh:45:44: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
template<typename... Ts> using hb_head_t = typename _hb_head_t<Ts...>::type;
                                           ^
harfbuzz/src/hb-meta.hh:47:65: error: unknown type name 'constexpr'
template <typename T, T v> struct hb_integral_constant { static constexpr T value = v; };
                                                                ^
harfbuzz/src/hb-meta.hh:47:76: error: expected ';' at end of declaration list
template <typename T, T v> struct hb_integral_constant { static constexpr T value = v; };
                                                                           ^
                                                                           ;
harfbuzz/src/hb-meta.hh:48:44: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
template <bool b> using hb_bool_constant = hb_integral_constant<bool, b>;
                                           ^
harfbuzz/src/hb-meta.hh:49:22: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using hb_true_type = hb_bool_constant<true>;
                     ^
harfbuzz/src/hb-meta.hh:50:23: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using hb_false_type = hb_bool_constant<false>;
                      ^
harfbuzz/src/hb-meta.hh:79:48: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
template <typename T> using hb_type_identity = typename hb_type_identity_t<T>::type;
                                               ^
harfbuzz/src/hb-meta.hh:83:25: error: unknown type name 'constexpr'
  template <typename T> constexpr T*
                        ^
harfbuzz/src/hb-meta.hh:83:35: error: member 'T' declared as a template
  template <typename T> constexpr T*
  ~~~~~~~~~~~~~~~~~~~~~           ^
harfbuzz/src/hb-meta.hh:83:36: error: expected ';' at end of declaration list
  template <typename T> constexpr T*
                                   ^
                                   ;
harfbuzz/src/hb-meta.hh:102:47: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
template <typename T> using hb_remove_const = typename hb_match_const<T>::type;
                                              ^
harfbuzz/src/hb-meta.hh:103:44: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
template <typename T> using hb_add_const = const T;
                                           ^
harfbuzz/src/hb-meta.hh:107:51: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
template <typename T> struct hb_match_reference<T &&>   : hb_type_identity_t<T>, hb_bool_constant<true> {};
                                                  ^
harfbuzz/src/hb-meta.hh:108:51: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
template <typename T> using hb_remove_reference = typename hb_match_reference<T>::type;
                                                  ^
harfbuzz/src/hb-meta.hh:109:23: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
template <typename T> auto _hb_try_add_lvalue_reference (hb_priority<1>) -> hb_type_identity<T&>;
                      ^
harfbuzz/src/hb-meta.hh:109:23: error: 'auto' not allowed in function return type
template <typename T> auto _hb_try_add_lvalue_reference (hb_priority<1>) -> hb_type_identity<T&>;
                      ^~~~
harfbuzz/src/hb-meta.hh:109:73: error: expected ';' at end of declaration
template <typename T> auto _hb_try_add_lvalue_reference (hb_priority<1>) -> hb_type_identity<T&>;
                                                                        ^
                                                                        ;
fatal error: too many errors emitted, stopping now [-ferror-limit=]
15 warnings and 20 errors generated.
./build.sh: line 40: wasm-opt: command not found
ebraminio commented 4 years ago

Oh, I guess macOS's clang is not that up to date, it doesn't seem it is equivalent to clang 9 or even 8 which defaults to C++11, can you test using a clang from brew? You may like to install binaryen to provide wasm-opt which is needed also.

khaledhosny commented 4 years ago

This works, thanks!

ebraminio commented 4 years ago

You may like to install binaryen to provide wasm-opt which is needed also.

Not that needed, it results to better uncompressed size of wasm but the not modified one may can be compressed better in my experience so not that important I'd say.

This works, thanks!

🙏