mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.35k stars 1.33k forks source link

Mapbox GL - Compilation from sources fails in MacOS #16598

Open mbmshafraz opened 3 years ago

mbmshafraz commented 3 years ago

I am trying to build this in MacOS 11.2.3 npn version 6.14.11 node version v12.22.0/v15.13.0 (Tried in both)

It compiles up to 99% and fails at last moment Following is the error log

[ 99%] Building CXX object platform/node/CMakeFiles/mbgl-node.abi-88.dir/src/node_expression.cpp.o
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:6:
In file included from /Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan.h:202:
In file included from /Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan_converters.h:67:
/Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan_converters_43_inl.h:22:1: error: no viable conversion from 'Local<v8::Context>' to 'v8::Isolate *'
X(Boolean)
^~~~~~~~~~
/Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan_converters_43_inl.h:18:23: note: expanded from macro 'X'
      val->To ## TYPE(isolate->GetCurrentContext())                            \
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:2894:37: note: passing argument to parameter 'isolate' here
  Local<Boolean> ToBoolean(Isolate* isolate) const;
                                    ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:6:
In file included from /Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan.h:202:
In file included from /Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan_converters.h:67:
/Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan_converters_43_inl.h:40:1: error: no viable conversion from 'Local<v8::Context>' to 'v8::Isolate *'
X(bool, Boolean)
^~~~~~~~~~~~~~~~
/Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan_converters_43_inl.h:37:29: note: expanded from macro 'X'
  return val->NAME ## Value(isolate->GetCurrentContext());                     \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:2904:30: note: passing argument to parameter 'isolate' here
  bool BooleanValue(Isolate* isolate) const;
                             ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:6:
In file included from /Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan.h:203:
In file included from /Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan_new.h:189:
/Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan_implementation_12_inl.h:103:42: error: no viable conversion from 'v8::Isolate *' to 'Local<v8::Context>'
  return scope.Escape(v8::Function::New( isolate
                                         ^~~~~~~
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:194:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::Isolate *' to
      'const v8::Local<v8::Context> &' for 1st argument
class Local {
      ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:194:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::Isolate *' to
      'v8::Local<v8::Context> &&' for 1st argument
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:198:13: note: candidate template ignored: could not match 'Local<type-parameter-0-0>' against 'v8::Isolate *'
  V8_INLINE Local(Local<S> that)
            ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:4492:22: note: passing argument to parameter 'context' here
      Local<Context> context, FunctionCallback callback,
                     ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:6:
In file included from /Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan.h:203:
In file included from /Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan_new.h:189:
/Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan_implementation_12_inl.h:337:37: error: too few arguments to function call, expected 2, have 1
  return v8::StringObject::New(value).As<v8::StringObject>();
         ~~~~~~~~~~~~~~~~~~~~~      ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:5900:3: note: 'New' declared here
  static Local<Value> New(Isolate* isolate, Local<String> value);
  ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:6:
/Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan.h:1034:53: error: too few arguments to function call, single argument 'context' was not specified
      v8::Local<v8::String> string = from->ToString();
                                     ~~~~~~~~~~~~~~ ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:2856:3: note: 'ToString' declared here
  V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
  ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8config.h:431:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:6:
/Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan.h:1044:37: error: cannot initialize a parameter of type 'v8::Isolate *' with an lvalue of type 'char *'
        length_ = string->WriteUtf8(str_, static_cast<int>(len), 0, flags);
                                    ^~~~
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:3083:26: note: passing argument to parameter 'isolate' here
  int WriteUtf8(Isolate* isolate, char* buffer, int length = -1,
                         ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:6:
/Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan.h:1818:28: error: no matching member function for call to 'Set'
    New(persistentHandle)->Set(New(key).ToLocalChecked(), value);
    ~~~~~~~~~~~~~~~~~~~~~~~^~~
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:3716:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:3719:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:6:
/Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan.h:1824:28: error: no matching member function for call to 'Set'
    New(persistentHandle)->Set(key, value);
    ~~~~~~~~~~~~~~~~~~~~~~~^~~
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:3716:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:3719:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:6:
/Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan.h:1830:28: error: no matching member function for call to 'Set'
    New(persistentHandle)->Set(index, value);
    ~~~~~~~~~~~~~~~~~~~~~~~^~~
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:3716:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:3719:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:6:
/Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan.h:1836:32: error: no matching member function for call to 'Get'
        New(persistentHandle)->Get(New(key).ToLocalChecked()));
        ~~~~~~~~~~~~~~~~~~~~~~~^~~
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:3763:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                          ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:3766:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                          ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:6:
/Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan.h:1842:48: error: no matching member function for call to 'Get'
    return scope.Escape(New(persistentHandle)->Get(key));
                        ~~~~~~~~~~~~~~~~~~~~~~~^~~
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:3763:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                          ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:3766:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                          ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:6:
/Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan.h:1847:48: error: no matching member function for call to 'Get'
    return scope.Escape(New(persistentHandle)->Get(index));
                        ~~~~~~~~~~~~~~~~~~~~~~~^~~
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:3763:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                          ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:3766:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                          ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:6:
In file included from /Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan.h:2657:
/Volumes/Data/RnD/mapbox-gl-native/build/headers/nan/2.10.0/nan_object_wrap.h:67:18: error: no member named 'MarkIndependent' in 'Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >'
    persistent().MarkIndependent();
    ~~~~~~~~~~~~ ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
/Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:82:36: error: too few arguments to function call, single argument 'isolate' was not specified
        return value->BooleanValue();
               ~~~~~~~~~~~~~~~~~~~ ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:2904:3: note: 'BooleanValue' declared here
  bool BooleanValue(Isolate* isolate) const;
  ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
/Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:90:35: error: too few arguments to function call, single argument 'context' was not specified
        return value->NumberValue();
               ~~~~~~~~~~~~~~~~~~ ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:2907:3: note: 'NumberValue' declared here
  V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
  ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8config.h:431:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
/Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:98:35: error: too few arguments to function call, single argument 'context' was not specified
        return value->NumberValue();
               ~~~~~~~~~~~~~~~~~~ ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:2907:3: note: 'NumberValue' declared here
  V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
  ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8config.h:431:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
/Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:117:55: error: too few arguments to function call, single argument 'context' was not specified
            return { std::uint64_t(value->Uint32Value()) };
                                   ~~~~~~~~~~~~~~~~~~ ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:2912:3: note: 'Uint32Value' declared here
  V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
  ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8config.h:431:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
/Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:119:53: error: too few arguments to function call, single argument 'context' was not specified
            return { std::int64_t(value->Int32Value()) };
                                  ~~~~~~~~~~~~~~~~~ ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:2915:3: note: 'Int32Value' declared here
  V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
  ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8config.h:431:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
In file included from /Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_expression.cpp:1:
/Volumes/Data/RnD/mapbox-gl-native/platform/node/src/node_conversion.hpp:121:41: error: too few arguments to function call, single argument 'context' was not specified
            return { value->NumberValue() };
                     ~~~~~~~~~~~~~~~~~~ ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8.h:2907:3: note: 'NumberValue' declared here
  V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
  ^
/Volumes/Data/RnD/mapbox-gl-native/build/headers/node/v15.13.0/v8config.h:431:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [platform/node/CMakeFiles/mbgl-node.abi-88.dir/src/node_expression.cpp.o] Error 1
make[1]: *** [platform/node/CMakeFiles/mbgl-node.abi-88.dir/all] Error 2
make: *** [all] Error 2
mnutt commented 3 years ago

I believe only node 10 is supported at the moment.

Dawqss commented 3 years ago

I made it working with node v10.24.1

and small change regarding this post https://github.com/mapbox/mapbox-gl-native/issues/16418#issuecomment-621127219

in file platform/node/CMakeLists.txt

add to EXCLUDE_NODE_ABIS number of abi above 83 that now represent version in my case it was mbgl-node.abi-93.dir so I add 93 to excluded abis

add_node_module(
    mbgl-node
    INSTALL_PATH ${PROJECT_SOURCE_DIR}/lib/{node_abi}/mbgl.node
    NAN_VERSION 2.10.0
    EXCLUDE_NODE_ABIS
        46
        47
        48
        51
        59
        67
        72
        79
        83
        93 <-- new
)

but I see there is a forked package with binaries for node 10+ check it!

https://github.com/mapbox/mapbox-gl-native/issues/16418#issuecomment-706800136