puerts icon indicating copy to clipboard operation
puerts copied to clipboard

[UE] building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format

Open flyyfyan opened this issue 1 year ago • 19 comments

前置阅读 | Pre-reading

Puer的版本 | Puer Version

Unreal_v1.0.3

UE的版本 | UE Version

4.26.2

发生在哪个平台 | Platform

Editor(mac)

错误信息 | Error Message

1.MacOS 系统版本13.4 2.架构 X86 3.xcode 14.3.1 4. c++17标准

错误信息: ld: warning: ignoring file /Users/h/Desktop/XVerseStudio/Plugins/Marketplace/Puerts/Source/ThirdParty/v8/Lib/macOSdylib/libchrome_zlib.dylib, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F ) ld: warning: ignoring file /Users/h/Desktop/XVerseStudio/Plugins/Marketplace/Puerts/Source/ThirdParty/v8/Lib/macOSdylib/libv8_libplatform.dylib, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F ) ld: warning: ignoring file /Users/h/Desktop/XVerseStudio/Plugins/Marketplace/Puerts/Source/ThirdParty/v8/Lib/macOSdylib/libv8.dylib, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F ) ld: warning: ignoring file /Users/h/Desktop/XVerseStudio/Plugins/Marketplace/Puerts/Source/ThirdParty/v8/Lib/macOSdylib/libv8_libbase.dylib, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F ) Undefined symbols for architecture x86_64: "v8_inspector::V8Inspector::create(v8::Isolate*, v8_inspector::V8InspectorClient*)", referenced from:

问题重现 | Bug reproduce

在上诉环境,编译连接时报错

flyyfyan avatar Jul 06 '23 02:07 flyyfyan

有没试过? cd Plugins/Puerts/ThirdParty find . -name "*.dylib" | xargs sudo xattr -r -d com.apple.quarantine

chexiongsheng avatar Jul 06 '23 02:07 chexiongsheng

试过,报一样的错误

flyyfyan avatar Jul 06 '23 02:07 flyyfyan

那没碰到过了。 看你提交的信息的话,似乎xcode版本相对于UE版本过新了。

chexiongsheng avatar Jul 06 '23 03:07 chexiongsheng

ChatGPT的答复,我觉得可以参考:

如果libv8.dylib在其他macOS-x86_64机器上是可用的,那么问题可能出在你的开发环境上。以下是一些可能的原因和解决方案:

  • 链接器版本不同:你的链接器可能比其他机器上的版本旧,或者不支持libv8.dylib的格式。你可以尝试更新你的链接器,或者安装和其他机器相同的版本。

  • 环境路径问题:可能是你的环境变量或者链接器的路径设置有问题,导致链接器无法正确找到或者识别libv8.dylib。你可以检查你的环境变量和链接器的路径设置,确保它们是正确的。

  • 权限问题:可能是你的用户账户没有足够的权限来访问或者链接libv8.dylib。你可以尝试使用管理员权限来运行你的构建命令,或者修改libv8.dylib的权限。

  • 文件损坏:虽然这个文件在其他机器上可以工作,但是在你的机器上的副本可能已经损坏。你可以尝试重新从其他机器上复制这个文件,或者从源头重新下载。

chexiongsheng avatar Jul 06 '23 03:07 chexiongsheng

xcode的版本是比较高,如果我想自己编译v8库,只用替换库,那么是否用下面连接的源码就可以了呢? https://github.com/puerts/backend-v8/releases/tag/V8_8.4.371.19_0323

flyyfyan avatar Jul 06 '23 03:07 flyyfyan

xcode的版本是比较高,如果我想自己编译v8库,只用替换库,那么是否用下面连接的源码就可以了呢? https://github.com/puerts/backend-v8/releases/tag/V8_8.4.371.19_0323

这些是github虚拟机上跑的自动化脚本,你本地跑可能会有些环境变量找不到

chexiongsheng avatar Jul 06 '23 06:07 chexiongsheng

你试试用这个版本:https://github.com/chexiongsheng/backend-v8/releases/tag/V8_9.4.146.24_230706 这个是在Xcode_14.3.1下编译的

chexiongsheng avatar Jul 06 '23 12:07 chexiongsheng

你试试用这个版本:https://github.com/chexiongsheng/backend-v8/releases/tag/V8_9.4.146.24_230706 这个是在Xcode_14.3.1下编译的

现在连接不报之前上面的错误了,但是又有几个函数未定义导致连接不上 Copying RadioEffectUnit.component to app bundle Undefined symbols for architecture x86_64: "v8::ArrayBuffer::GetContents()", referenced from: puerts::FArrayBufferPropertyTranslator::UEToJs(v8::Isolate*, v8::Localv8::Context&, void const*, bool) const in Module.JsEnv.3_of_3.cpp.o puerts::FArrayBufferPropertyTranslator::JsToUE(v8::Isolate*, v8::Localv8::Context&, v8::Localv8::Value const&, void*, bool) const in Module.JsEnv.3_of_3.cpp.o "v8::ArrayBuffer::New(v8::Isolate*, void*, unsigned long, v8::ArrayBufferCreationMode)", referenced from: puerts::FArrayBufferPropertyTranslator::UEToJs(v8::Isolate*, v8::Localv8::Context&, void const*, bool) const in Module.JsEnv.3_of_3.cpp.o "v8::FunctionTemplate::New(v8::Isolate*, void ()(v8::FunctionCallbackInfov8::Value const&), v8::Localv8::Value, v8::Localv8::Signature, int, v8::ConstructorBehavior, v8::SideEffectType, v8::CFunction const)", referenced from: puerts::FScriptArrayWrapper::ToFunctionTemplate(v8::Isolate*) in Module.JsEnv.1_of_3.cpp.o puerts::FScriptSetWrapper::ToFunctionTemplate(v8::Isolate*) in Module.JsEnv.1_of_3.cpp.o puerts::FScriptMapWrapper::ToFunctionTemplate(v8::Isolate*) in Module.JsEnv.1_of_3.cpp.o puerts::FFixSizeArrayWrapper::ToFunctionTemplate(v8::Isolate*) in Module.JsEnv.1_of_3.cpp.o puerts::FCppObjectMapper::GetTemplateOfClass(v8::Isolate*, puerts::JSClassDefinition const*) in Module.JsEnv.1_of_3.cpp.o puerts::FCppObjectMapper::Initialize(v8::Isolate*, v8::Localv8::Context) in Module.JsEnv.1_of_3.cpp.o puerts::FDelegateWrapper::ToFunctionTemplate(v8::Isolate*) in Module.JsEnv.1_of_3.cpp.o ... "v8::Module::SetSyntheticModuleExport(v8::Localv8::String, v8::Localv8::Value)", referenced from: puerts::FJsEnvImpl::FetchCJSModuleAsESModule(v8::Localv8::Context, FString const&)::$_2::__invoke(v8::Localv8::Context, v8::Localv8::Module) in Module.JsEnv.2_of_3.cpp.o "v8::Object::InternalFieldCount()", referenced from: puerts::FContainerWrapper<FScriptArray>::Num(v8::FunctionCallbackInfov8::Value const&) in Module.JsEnv.1_of_3.cpp.o puerts::FScriptArrayWrapper::Add(v8::FunctionCallbackInfov8::Value const&) in Module.JsEnv.1_of_3.cpp.o puerts::FScriptArrayWrapper::Get(v8::FunctionCallbackInfov8::Value const&) in Module.JsEnv.1_of_3.cpp.o puerts::FScriptArrayWrapper::GetRef(v8::FunctionCallbackInfov8::Value const&) in Module.JsEnv.1_of_3.cpp.o puerts::FScriptArrayWrapper::Set(v8::FunctionCallbackInfov8::Value const&) in Module.JsEnv.1_of_3.cpp.o puerts::FScriptArrayWrapper::RemoveAt(v8::FunctionCallbackInfov8::Value const&) in Module.JsEnv.1_of_3.cpp.o puerts::FScriptArrayWrapper::IsValidIndex(v8::FunctionCallbackInfov8::Value const&) in Module.JsEnv.1_of_3.cpp.o

flyyfyan avatar Jul 06 '23 13:07 flyyfyan

clean一下

chexiongsheng avatar Jul 07 '23 01:07 chexiongsheng

clean一下

也可能是你puerts的版本低,不支持v8 9.4,可以升级下puerts

chexiongsheng avatar Jul 07 '23 01:07 chexiongsheng

clean一下

也可能是你puerts的版本低,不支持v8 9.4,可以升级下puerts

我们这里用的v8版本看头文件是下面的,麻烦帮忙确认下是否和这里新提供的版本是否一致 image

flyyfyan avatar Jul 07 '23 02:07 flyyfyan

不一致

chexiongsheng avatar Jul 07 '23 03:07 chexiongsheng

你下载解压不是能看到么?

chexiongsheng avatar Jul 07 '23 03:07 chexiongsheng

你试试用这个版本:https://github.com/chexiongsheng/backend-v8/releases/tag/V8_9.4.146.24_230706 这个是在Xcode_14.3.1下编译的

使用的方式:删了原来的ThirdParty下的v8目录,这个解压后是v8_9.4,重命名为v8后,放入ThirdParty

chexiongsheng avatar Jul 07 '23 03:07 chexiongsheng

你试试用这个版本:https://github.com/chexiongsheng/backend-v8/releases/tag/V8_9.4.146.24_230706 这个是在Xcode_14.3.1下编译的

使用的方式:删了原来的ThirdParty下的v8目录,这个解压后是v8_9.4,重命名为v8后,放入ThirdParty

这个对应的是哪个分支的,在我们的系统上,现在会报下面的错误 企业微信截图_8b87a0aa-d02c-426b-8e34-ead8a71e4d89

flyyfyan avatar Jul 07 '23 10:07 flyyfyan

你试试用这个版本:https://github.com/chexiongsheng/backend-v8/releases/tag/V8_9.4.146.24_230706 这个是在Xcode_14.3.1下编译的

使用的方式:删了原来的ThirdParty下的v8目录,这个解压后是v8_9.4,重命名为v8后,放入ThirdParty

这个对应的是哪个分支的,在我们的系统上,现在会报下面的错误 企业微信截图_8b87a0aa-d02c-426b-8e34-ead8a71e4d89

能否提供一个下面版本的库呢? image

flyyfyan avatar Jul 07 '23 11:07 flyyfyan

8.4可能不支持新版xcode。 9.4你报那错误是puerts版本太低,升级下puerts。

chexiongsheng avatar Jul 10 '23 02:07 chexiongsheng

加载的地址是macOSdylib(里面的架构是x86_64), 修改路径或拷贝对应文件覆盖对上就可以正常链接了 image image

ChenRenault avatar Aug 19 '23 01:08 ChenRenault

头文件也需要注意路径,不然启动会在初始化时崩溃 image image

ChenRenault avatar Aug 19 '23 08:08 ChenRenault