'double-conversion/double-conversion.h' file not found

本文解决了一个React Native在iOS环境下使用特定版本时遇到的兼容性错误,详细描述了如何通过调整Podfile中use_frameworks!配置来解决'double-conversion/double-conversion.h’文件未找到的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

react native 在ios上运行时报错
double-conversion/double-conversion.h’ file not found

环境是
xcode 10.1
“react-native”: “0.60.5”,
swift 4.2

在stackoverflow 上找到答案

You are using the RN version (0.60.4) which does not work with use_frameworks!. I suggest removing use_frameworks! from your Podfile or using the lastest RN from master.

Note that we are aware of a compatability issue with use_frameworks!, and we’re tracking an issue with workarounds and a future patch.

您正在使用RN版本(0.60.4),该版本不适用于use_frameworks!。我建议删除use_frameworks!从您的Podfile或使用master的最新RN。

请注意,我们知道use_frameworks!的兼容性问题,并且我们正在跟踪解决方法和将来的补丁程序问题。

亲测去掉后, 确实可用. 希望早日跟新插件吧

stackoverflow原文

安装 报错npm WARN deprecated npmlog@4.1.2: This package is no longer supported. npm WARN deprecated are-we-there-yet@1.1.7: This package is no longer supported. npm WARN deprecated gauge@2.7.4: This package is no longer supported. npm ERR! code 1 npm ERR! path /Users/yangjia/workspace/company/dkYun/SDK2.0/node_modules/microtime npm ERR! command failed npm ERR! command sh -c prebuild-install || node-gyp rebuild npm ERR! CXX(target) Release/obj.target/microtime/src/microtime.o npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@8.4.1 npm ERR! gyp info using node@16.14.0 | darwin | arm64 npm ERR! gyp info find Python using Python version 3.12.1 found at "/Library/Frameworks/Python.framework/Versions/3.12/bin/python3" npm ERR! gyp info spawn /Library/Frameworks/Python.framework/Versions/3.12/bin/python3 npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py', npm ERR! gyp info spawn args 'binding.gyp', npm ERR! gyp info spawn args '-f', npm ERR! gyp info spawn args 'make', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/Users/yangjia/workspace/company/dkYun/SDK2.0/node_modules/microtime/build/config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/Users/yangjia/Library/Caches/node-gyp/16.14.0/include/node/common.gypi', npm ERR! gyp info spawn args '-Dlibrary=shared_library', npm ERR! gyp info spawn args '-Dvisibility=default', npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/yangjia/Library/Caches/node-gyp/16.14.0', npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/yangjia/Library/Caches/node-gyp/16.14.0/<(target_arch)/node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/yangjia/workspace/company/dkYun/SDK2.0/node_modules/microtime', npm ERR! gyp info spawn args '-Dnode_engine=v8', npm ERR! gyp info spawn args '--depth=.', npm ERR! gyp info spawn args '--no-parallel', npm ERR! gyp info spawn args '--generator-output', npm ERR! gyp info spawn args 'build', npm ERR! gyp info spawn args '-Goutput_dir=.' npm ERR! gyp info spawn args ] npm ERR! gyp info spawn make npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] npm ERR! In file included from ../src/microtime.cc:9: npm ERR! In file included from ../../nan/nan.h:222: npm ERR! In file included from ../../nan/nan_converters.h:67: npm ERR! ../../nan/nan_converters_43_inl.h:22:1: error: no viable conversion from 'Local<v8::Context>' to 'v8::Isolate *' npm ERR! X(Boolean) npm ERR! ^~~~~~~~~~ npm ERR! ../../nan/nan_converters_43_inl.h:18:23: note: expanded from macro 'X' npm ERR! val->To ## TYPE(isolate->GetCurrentContext()) \ npm ERR! ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ npm ERR! /Users/yangjia/Library/Caches/node-gyp/16.14.0/include/node/v8.h:3086:37: note: passing argument to parameter 'isolate' here npm ERR! Local<Boolean> ToBoolean(Isolate* isolate) const; npm ERR! ^ npm ERR! In file included from ../src/microtime.cc:9: npm ERR! In file included from ../../nan/nan.h:222: npm ERR! In file included from ../../nan/nan_converters.h:67: npm ERR! ../../nan/nan_converters_43_inl.h:22:1: error: no member named 'FromMaybe' in 'v8::Local<v8::Boolean>' npm ERR! X(Boolean) npm ERR! ^~~~~~~~~~ npm ERR! ../../nan/nan_converters_43_inl.h:19:12: note: expanded from macro 'X' npm ERR! .FromMaybe(v8::Local<v8::TYPE>())); \ npm ERR! ^ npm ERR! ../../nan/nan_converters_43_inl.h:40:1: error: no viable conversion from 'Local<v8::Context>' to 'v8::Isolate *' npm ERR! X(bool, Boolean) npm ERR! ^~~~~~~~~~~~~~~~ npm ERR! ../../nan/nan_converters_43_inl.h:37:29: note: expanded from macro 'X' npm ERR! return val->NAME ## Value(isolate->GetCurrentContext()); \ npm ERR! ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ npm ERR! /Users/yangjia/Library/Caches/node-gyp/16.14.0/include/node/v8.h:3096:30: note: passing argument to parameter 'isolate' here npm ERR! bool BooleanValue(Isolate* isolate) const; npm ERR! ^ npm ERR! In file included from ../src/microtime.cc:9: npm ERR! In file included from ../../nan/nan.h:222: npm ERR! In file included from ../../nan/nan_converters.h:67: npm ERR! ../../nan/nan_converters_43_inl.h:40:1: error: no viable conversion from returned value of type 'bool' to function return type 'imp::ToFactory<bool>::return_t' (aka 'Maybe<bool>') npm ERR! X(bool, Boolean) npm ERR! ^~~~~~~~~~~~~~~~ npm ERR! ../../nan/nan_converters_43_inl.h:37:10: note: expanded from macro 'X' npm ERR! return val->NAME ## Value(isolate->GetCurrentContext()); \ npm ERR! ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ npm ERR! /Users/yangjia/Library/Caches/node-gyp/16.14.0/include/node/v8.h:10437:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'bool' to 'const v8::Maybe<bool> &' for 1st argument npm ERR! class Maybe { npm ERR! ^ npm ERR! /Users/yangjia/Library/Caches/node-gyp/16.14.0/include/node/v8.h:10437:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'bool' to 'v8::Maybe<bool> &&' for 1st argument npm ERR! /Users/yangjia/Library/Caches/node-gyp/16.14.0/include/node/v8.h:10492:12: note: explicit constructor is not a candidate npm ERR! explicit Maybe(const T& t) : has_value_(true), value_(t) {} npm ERR! ^ npm ERR! In file included from ../src/microtime.cc:9: npm ERR! In file included from ../../nan/nan.h:223: npm ERR! In file included from ../../nan/nan_new.h:189: npm ERR! ../../nan/nan_implementation_12_inl.h:356:37: error: too few arguments to function call, expected 2, have 1 npm ERR! return v8::StringObject::New(value).As<v8::StringObject>(); npm ERR! ~~~~~~~~~~~~~~~~~~~~~ ^ npm ERR! /Users/yangjia/Library/Caches/node-gyp/16.14.0/include/node/v8.h:6196:23: note: 'New' declared here npm ERR! static Local<Value> New(Isolate* isolate, Local<String> value); npm ERR! ^ npm ERR! In file included from ../src/microtime.cc:9: npm ERR! In file included from ../../nan/nan.h:2722: npm ERR! ../../nan/nan_object_wrap.h:24:25: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object>' npm ERR! assert(persistent().IsNearDeath()); npm ERR! ~~~~~~~~~~~~ ^ npm ERR! /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/assert.h:99:25: note: expanded from macro 'assert' npm ERR! (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __ASSERT_FILE_NAME, __LINE__, #e) : (void)0) npm ERR! ^ npm ERR! In file included from ../src/microtime.cc:9: npm ERR! In file included from ../../nan/nan.h:2722: npm ERR! ../../nan/nan_object_wrap.h:127:26: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object>' npm ERR! assert(wrap->handle_.IsNearDeath()); npm ERR! ~~~~~~~~~~~~~ ^ npm ERR! /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/assert.h:99:25: note: expanded from macro 'assert' npm ERR! (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __ASSERT_FILE_NAME, __LINE__, #e) : (void)0) npm ERR! ^ npm ERR! In file included from ../src/microtime.cc:9: npm ERR! In file included from ../../nan/nan.h:2818: npm ERR! ../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations] npm ERR! data = static_cast<char*>(buffer->GetContents().Data()) + byte_offset; npm ERR! ^ npm ERR! /Users/yangjia/Library/Caches/node-gyp/16.14.0/include/node/v8.h:5614:3: note: 'GetContents' has been explicitly marked deprecated here npm ERR! V8_DEPRECATED("Use GetBackingStore. See http://crbug.com/v8/9908.") npm ERR! ^ npm ERR! /Users/yangjia/Library/Caches/node-gyp/16.14.0/include/node/v8config.h:454:35: note: expanded from macro 'V8_DEPRECATED' npm ERR! # define V8_DEPRECATED(message) [[deprecated(message)]] npm ERR! ^ npm ERR! ../src/microtime.cc:75:10: error: no matching member function for call to 'Set' npm ERR! array->Set(Nan::New<v8::Integer>(0), Nan::New<v8::Number>((double)t.tv_sec)); npm ERR! ~~~~~~~^~~ npm ERR! /Users/yangjia/Library/Caches/node-gyp/16.14.0/include/node/v8.h:3961:37: note: candidate function not viable: requires 3 arguments, but 2 were provided npm ERR! V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, npm ERR! ^ npm ERR! /Users/yangjia/Library/Caches/node-gyp/16.14.0/include/node/v8.h:3964:37: note: candidate function not viable: requires 3 arguments, but 2 were provided npm ERR! V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index, npm ERR! ^ npm ERR! ../src/microtime.cc:76:10: error: no matching member function for call to 'Set' npm ERR! array->Set(Nan::New<v8::Integer>(1), Nan::New<v8::Number>((double)t.tv_usec)); npm ERR! ~~~~~~~^~~ npm ERR! /Users/yangjia/Library/Caches/node-gyp/16.14.0/include/node/v8.h:3961:37: note: candidate function not viable: requires 3 arguments, but 2 were provided npm ERR! V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, npm ERR! ^ npm ERR! /Users/yangjia/Library/Caches/node-gyp/16.14.0/include/node/v8.h:3964:37: note: candidate function not viable: requires 3 arguments, but 2 were provided npm ERR! V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index, npm ERR! ^ npm ERR! 1 warning and 9 errors generated. npm ERR! make: *** [Release/obj.target/microtime/src/microtime.o] Error 1 npm ERR! gyp ERR! build error npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2 npm ERR! gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:520:28) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12) npm ERR! gyp ERR! System Darwin 22.6.0 npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd /Users/yangjia/workspace/company/dkYun/SDK2.0/node_modules/microtime npm ERR! gyp ERR! node -v v16.14.0 npm ERR! gyp ERR! node-gyp -v v8.4.1 npm ERR! gyp ERR! not ok npm ERR! A complete log of this run can be found in: npm ERR! /Users/yangjia/.npm/_logs/2025-06-30T06_40_09_765Z-debug-0.log
最新发布
07-01
ubuntu@ubuntu:~$ mmconvert -sf caffe -iw model.caffemodel -in deploy.prototxt -df onnx -om output.onnx Traceback (most recent call last): File "/home/ubuntu/.local/bin/mmconvert", line 8, in <module> sys.exit(_main()) File "/home/ubuntu/.local/lib/python3.10/site-packages/mmdnn/conversion/_script/convert.py", line 102, in _main ret = convertToIR._convert(ir_args) File "/home/ubuntu/.local/lib/python3.10/site-packages/mmdnn/conversion/_script/convertToIR.py", line 15, in _convert from mmdnn.conversion.caffe.transformer import CaffeTransformer File "/home/ubuntu/.local/lib/python3.10/site-packages/mmdnn/conversion/caffe/transformer.py", line 4, in <module> from mmdnn.conversion.caffe.graph import GraphBuilder, NodeKind, LAYER_IN_TRAIN_PROTO File "/home/ubuntu/.local/lib/python3.10/site-packages/mmdnn/conversion/caffe/graph.py", line 9, in <module> from mmdnn.conversion.caffe.mapper import get_handler_name File "/home/ubuntu/.local/lib/python3.10/site-packages/mmdnn/conversion/caffe/mapper.py", line 6, in <module> from mmdnn.conversion.caffe.common_graph import Node File "/home/ubuntu/.local/lib/python3.10/site-packages/mmdnn/conversion/caffe/common_graph.py", line 9, in <module> from mmdnn.conversion.common.IR.graph_pb2 import GraphDef, NodeDef, TensorShape File "/home/ubuntu/.local/lib/python3.10/site-packages/mmdnn/conversion/common/IR/graph_pb2.py", line 32, in <module> _descriptor.EnumValueDescriptor( File "/home/ubuntu/.local/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 920, in __new__ _message.Message._CheckCalledFromGeneratedFile() TypeError: Descriptors cannot be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. If you cannot immediately regenerate your protos, some other possible workarounds are: 1. Downgrade the protobuf package to 3.20.x or lower. 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=p
03-14
<think>好的,我现在需要解决用户在使用mmconvert命令时遇到的“Descriptors cannot be created directly”错误。用户提到错误信息,还提到了protobuf版本和protoc的问题。根据之前处理类似问题的经验,这个错误通常是由于protobuf库的版本不兼容导致的。 首先,我需要回忆一下用户提供的引用内容。引用[2]指出,当生成的文件过时或者protobuf版本过高时,会出现这个错误。解决方法包括降级protobuf到3.20.x或更低版本,或者设置环境变量。引用[3]也提到安装特定版本的protobuf可以解决问题,例如3.20.1。此外,引用[4]提到了更换镜像源可能有助于安装过程中的超时问题。 接下来,我需要将这些信息整合到解决方案中。可能的步骤包括:检查protobuf的当前版本,卸载现有版本,安装指定版本的protobuf,确保protoc的版本兼容,以及可能的其他解决方法如设置环境变量。此外,如果用户在安装过程中遇到网络问题,可以建议更换镜像源。 需要验证这些步骤的正确性。例如,安装protobuf==3.20.1是否确实能解决该错误。另外,用户是否安装了protoc工具,是否需要升级或降级protoc以匹配protobuf库的版本?根据错误提示,可能需要使用protoc >=3.19.0重新生成_pb2.py文件,但用户可能无法立即重新生成,所以降级protobuf更为实际。 另外,用户可能同时使用TensorFlow或其他库,这些库可能有自己的protobuf依赖,需要确保版本兼容。如果用户的环境中有多个版本冲突,可能需要更彻底的清理和重新安装。 最后,生成相关问题时要围绕protobuf版本问题、mmconvert的兼容性、protoc工具的使用,以及环境配置等方面展开,帮助用户进一步排查可能的问题。</think>### 解决方案:解决`mmconvert`的“Descriptors cannot be created directly”错误 此错误通常由**protobuf库版本不兼容**导致,具体原因和解决方法如下: --- #### **1. 降级protobuf版本** 根据错误提示,protobuf版本过高会导致生成的代码与当前库不兼容。解决步骤如下: 1. **卸载当前protobuf**: ```bash pip uninstall protobuf ``` 2. **安装指定版本(推荐3.20.x)**: ```bash pip install protobuf==3.20.1 ``` 若安装失败(如网络超时),可尝试**更换国内镜像源**: ```bash pip install protobuf==3.20.1 -i https://pypi.tuna.tsinghua.edu.cn/simple ``` 引用[^1][^2][^3] --- #### **2. 检查protoc编译器版本** protobuf库需要与`protoc`编译器版本匹配。若需重新生成协议文件(如`_pb2.py`): 1. **下载并安装protoc >=3.19.0**: - 从[Protobuf GitHub Release](https://github.com/protocolbuffers/protobuf/releases)下载对应系统的编译器。 - 解压后,将`bin/protoc`添加到系统环境变量。 2. **重新生成协议文件**: ```bash protoc --python_out=. your_proto_file.proto ``` > 注意:此步骤需源码支持,若无法操作则优先降级protobuf。 --- #### **3. 临时环境变量设置(备用方案)** 若无法降级protobuf,可设置环境变量强制使用纯Python解析(性能较低): ```bash export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python ``` 或在代码中添加: ```python import os os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] = "python" ``` 引用 --- #### **4. 验证环境一致性** 若使用Anaconda或虚拟环境,需确保: 1. 所有依赖库(如TensorFlow/PyTorch)的protobuf版本与当前安装的protobuf==3.20.1兼容。 2. 彻底清理残留库: ```bash pip uninstall protobuf google-protobuf pip cache purge ``` ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值