VRM4U icon indicating copy to clipboard operation
VRM4U copied to clipboard

Failed to create libassimp.a in MacOS

Open Johnastc2002 opened this issue 1 year ago • 19 comments

I was following the installation guide to install VRM4U on my M1 Mac, however, when I am trying to build the libassimp.a file using make as mentioned, there is an error:

Screenshot 2023-09-20 at 10 40 55 PM

Seems the deprecation of vsprintf leads to the problem. Would you mind please help? Thank you very much.

UnrealEngine Version: UE_5.3 OS: MacOS 13.4

Johnastc2002 avatar Sep 20 '23 21:09 Johnastc2002

Hi @Johnastc2002 . You can use the following flag to resolve this issue and create your libassimp.a file.

-DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations"

However, I'm facing crashes in the engine on dragging and dropping the vrm file into content browser after pasting the libassimp.a file according to the instructions. I've also tried the same in 5.3 as well. Kindly let me know if you get successful in importing vrm into m1 mac

ApoorvHesta avatar Sep 21 '23 06:09 ApoorvHesta

Hi @Johnastc2002, did you manage to import vrm files into unreal successfully?

ApoorvHesta avatar Sep 25 '23 05:09 ApoorvHesta

Hi @ApoorvHesta , thank you for your advice, I do can create the libassimp.a file based on your method, but the .a file seems corrupted and crashed after putting it to the /Plugins folder inside the project. Therefore I did not send you the update here.

Johnastc2002 avatar Sep 25 '23 09:09 Johnastc2002

Hi @Johnastc2002 . You need to place it inside a specified directory as below:

/Plugins/VRM4U/ThirdParty/assimp/lib/Mac

ApoorvHesta avatar Sep 25 '23 09:09 ApoorvHesta

Yea I did this as you mentioned, but still facing crash when running the project. As I am new to UE, maybe it is easier to trace the problem by showing you my steps for the whole procedure:

  1. I clone the assimp by git clone https://github.com/ruyo/assimp and save it to desktop

  2. Then I use CMake (downloaded from here) to open the assimp project. According to the Mac tutorial from ruyo (source), I set the source code as the project root directory, and build the binaries path as build2 like what ruyo did in the tutorial: Screenshot 2023-09-25 at 11 12 15 AM

  3. I keep the output as Unix Makefiles format in order to run make command later, and keep using native compilers. Screenshot 2023-09-25 at 11 12 23 AM

  4. I applied the settings according to the ruyo's tutorial and change the following:

  • MACOSX_DEPLOYMENT_TARGET to 13.4 <-- In the tutorial as mentioned, it recommends for 10.14 but in my knowledge it seems does not matter for the deployment target, therefore I use my current computer OS version, which is 13.4 . I tried 10.14 and 13.4, both of them showing the same error.
  • BUILD_SHARED_LIBS turn off

Also, in ruyo's tutorial, he mentioned:

If you're on an M1 Mac, you'll need to explicitly build it as x86_64. In the example above, we start the terminal and cmake-gui using Rosetta and follow the steps.

Because I am using a M1 Mac, I additionally updated the CMAKE_OSX_ARCHITECTURES as x86_64 , which I don't know whether it is correct or not.

Screenshot 2023-09-25 at 11 25 00 AM
  1. Due to the problem why I open this issue, I implemented @ApoorvHesta solution in CMakeLists.txt, by adding this line of code in line 342: SET(CMAKE_CXX_FLAGS "-Wno-deprecated-declarations")

  2. Back to CMake and press the Generate button

  3. cd to build2 folder in termainal, run make command and generated libassimp.a file in build2/lib.

  4. As I am using UE 5.3, I downloaded VRM4U_5_3_20230922.zip file in this link, unzip it and drag and drop the generated libassimp.a file to Plugins/VRM4U/ThirdParty/assimp/lib/Mac

  5. I drag and drop the whole Plugins folder to the current UE project root directory (which means MyProject/Plugins/VRM4U........)

  6. I run the UE, open the project, and import the plugin as follows, then press Restart Now
    Screenshot 2023-09-25 at 11 45 07 AM

  7. After restart, a dialog shown, I pressed Yes for rebuild the plugin like in the tutorial Screenshot 2023-09-25 at 11 45 21 AM

  8. Then another dialog shown and said MyProject could not be compiled Screenshot 2023-09-25 at 11 47 54 AM

Because I am new to UE and almost no knowledge in CMake, some of my steps may be wrong. Would you mind please check if you can reproduce the problem? Thank you so much for your patience and help.

Johnastc2002 avatar Sep 25 '23 10:09 Johnastc2002

Hi @Johnastc2002 . Open xcode workspace and build from there. If crash occurs, you'll get a log, attach that.

ApoorvHesta avatar Sep 25 '23 10:09 ApoorvHesta

Here is the log after building MyProject (Mac).xcworkspace:

Running Xcodebuild MyProject macosx Development /Users/timmy/Documents/unreal_projects/MyProject/MyProject.uproject Setting up bundled DotNet SDK /Users/timmy/unreal_engines/UE_5.3/Engine/Build/BatchFiles/Mac/../../../Binaries/ThirdParty/DotNet/6.0.302/mac-arm64 Processing build for Target=MyProject Platform=Mac Configuration=Development -architecture=arm64 /Users/timmy/Documents/unreal_projects/MyProject/MyProject.uproject Running dotnet Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.dll MyProject Mac Development /Users/timmy/Documents/unreal_projects/MyProject/MyProject.uproject -architecture=arm64 Log file: /Users/timmy/Library/Application Support/Epic/UnrealBuildTool/Log.txt Creating makefile for MyProject (no existing makefile) Choosing MODERN XCODE based on .ini settings Total execution time: 1.15 seconds Could not find definition for module 'VRM4U', (referenced via MyProject.uproject -> VRM4U.uplugin) Command ExternalBuildToolExecution failed with a nonzero exit code

Johnastc2002 avatar Sep 25 '23 11:09 Johnastc2002

Seems like you haven't downloaded the source. The repo for source is a different one. Kindly go through this thread.

[https://github.com/ruyo/VRM4U/issues/130]

ApoorvHesta avatar Sep 25 '23 11:09 ApoorvHesta

Hi @ApoorvHesta , I have added the Source folder, with same date to the binaries, at the same level as Plugins/VRM4U/ThirdParty folder, but even I created a new project MyProject2 as a C++ project with the plugin, the error still shows up. And according to the thread you mentioned, there is a tutorial. (link) In the section Make it to a C++ Project, the link is not valid anymore. Therefore, I am not sure whether I have to create a MyProject2.sln file, or even in mac, do I need to go through this step.

I try to log the error just like the previous comment, but Xcode does not showing the error log anymore. There are no responses when clicking the error Screenshot 2023-09-25 at 2 54 35 PM

Johnastc2002 avatar Sep 25 '23 14:09 Johnastc2002

Try to generate solutions files first. Open terminal and

your_engine_batch_path your_uproject_path -game

ApoorvHesta avatar Sep 25 '23 14:09 ApoorvHesta

Okay seems I figure out how to install the plugin in M1 Mac. But as mentioned, I am new to UE and CMake, I am not sure whether it is truly work or not when using the plugin. (How can I know the plugin that even I cannot get it installed!) Hope this article can help someone struggling to the installation.

Here is my procedure:

My computer: M1 Macbook pro OS version: 13.4.1 UE version: 5.3

You need to deal with three things:

  1. The Binaries
  2. Create the libassimp.a file
  3. The Source folder

The Binaries

  1. Download the binaries in this link. As I am using UE 5.3, I downloaded the file VRM4U_5_3_20230922.zip, which the number 20230922 means the date of the binary (will be used later)
  2. Unzip it and place it somewhere. In this example, I keep it in the desktop (~/Desktop)

Create the libassimp.a file (tutorial from ruyo: link)

  1. open terminal, cd to Desktop, clone the assimp repository by git clone https://github.com/ruyo/assimp (remember this is ruyo's fork of assimp, NOT the one https://github.com/assimp/assimp)

  2. Then I use CMake (downloaded from here) to open the assimp project. According to the ruyo's tutorial above, I set the source code as the project root directory, and build the binaries path as build2: Screenshot 2023-09-25 at 11 12 15 AM

  3. Press Configure , keep the settings default like the thumbnail: Screenshot 2023-09-25 at 11 12 23 AM

  4. Add the value on the keys below:

  • MACOSX_DEPLOYMENT_TARGET to 10.14
  • BUILD_SHARED_LIBS turn off Screenshot 2023-09-25 at 3 35 58 PM
  1. Open the text file CMakeLists.txt in assimp folder, Add the line of code SET(CMAKE_CXX_FLAGS "-Wno-deprecated-declarations") in line 342, to prevent deprecations error suggested by @ApoorvHesta here (I am not sure my implementation is correct or not tho)

  2. back to CMake, press Generate button

  3. A bunch of files will be shown in the folder build2, open terminal, cd to build2, run the command make. After running the command, you should see a libassimp.a file in build2/lib folder

  4. drag the libassimp.a file to the binary folder Plugins/VRM4U/ThirdParty/assimp/lib/Mac. There should be a dummy.txt file inside, FYI.

The Source folder

  1. Link your github account to the epic games installer. (Tutorial can be found here, note that CONNECTED ACCOUNTS is already renamed to APPS AND ACCOUNTS.)

  2. You should received an email of invitation from Epic games, ask you to join EpicGames organisation. Accept it. If you cannot receive the invitation, check here

  3. After joining the organisation, you can go the the package repository here, You will get 404 error if you not yet joined the organisation.

  4. Switch the branch by tags that matches the date of the binary you downloaded (mine is 20230922, which I mentioned in part 1)

  5. Unzip it, put the Source folder to the binary folder Plugins/VRM4U, the folder should be same level as ThirdParty folder Screenshot 2023-09-25 at 3 56 53 PM

Then you create a new project, drag the whole Plugins folder to the root project folder Screenshot 2023-09-25 at 3 59 27 PM

Open the project in UE, choose Plugins, check VRM4U and restart the project Screenshot 2023-09-25 at 4 00 14 PM

After restart the project, in Content Drawer, choose Show Plugin Content Screenshot 2023-09-25 at 4 03 21 PM

Then at least you can see a Vroid girl in Mac. Screenshot 2023-09-25 at 4 06 36 PM

Really appreciate @ApoorvHesta for help and suggestions! 🙏🏿

Johnastc2002 avatar Sep 25 '23 15:09 Johnastc2002

You're welcome @Johnastc2002 . Now try dragging and dropping a new .vrm into the content browser if you are able to do so, kindly update here with the screenshots of the imported .vrm character with it's assets in content browser. If not, screenshots of the crash log would be really helpful.

ApoorvHesta avatar Sep 26 '23 05:09 ApoorvHesta

Hi @ApoorvHesta I finally get what you mean. Here are the logs:

Caught signal

ULoaderBPFunctionLibrary::GetVRMMeta(FString) Address = 0x3172ad9d4 [/Users/timmy/Documents/unreal_projects/MyProject/Plugins/VRM4U/Source/VRM4ULoader/Private/LoaderBPFunctionLibrary.cpp, line 448] [in UnrealEditor-VRM4ULoader.dylib] UVRM4UImporterFactory::FactoryCreateBinary(UClass*, UObject*, FName, EObjectFlags, UObject*, char16_t const*, unsigned char const*&, unsigned char const*, FFeedbackContext*, bool&) Address = 0x30ac8f958 (filename not found) [in UnrealEditor-VRM4UImporter.dylib] UFactory::FactoryCreateFile(UClass*, UObject*, FName, EObjectFlags, FString const&, char16_t const*, FFeedbackContext*, bool&) Address = 0x113fcd150 (filename not found) [in UnrealEditor-UnrealEd.dylib] UFactory::ImportObject(UClass*, UObject*, FName, EObjectFlags, FString const&, char16_t const*, bool&) Address = 0x113fcdc74 (filename not found) [in UnrealEditor-UnrealEd.dylib] UAssetToolsImpl::ImportAssetsInternal(TArray<FString, TSizedDefaultAllocator<32>> const&, FString const&, TArray<TTuple<FString, FString>, TSizedDefaultAllocator<32>>, FAssetImportParams const&) const Address = 0x12ec2d330 (filename not found) [in UnrealEditor-AssetTools.dylib] UAssetToolsImpl::ImportAssets(TArray<FString, TSizedDefaultAllocator<32>> const&, FString const&, UFactory, bool, TArray<TTuple<FString, FString>, TSizedDefaultAllocator<32>>, bool, bool) const Address = 0x12ec37e28 (filename not found) [in UnrealEditor-AssetTools.dylib] FImportFilesByPath::Run() Address = 0x114b64484 (filename not found) [in UnrealEditor-UnrealEd.dylib] UImportSubsystem::HandleNextTick() Address = 0x114b1e508 (filename not found) [in UnrealEditor-UnrealEd.dylib] FTimerUnifiedDelegate::Execute() Address = 0x11b344f68 (filename not found) [in UnrealEditor-Engine.dylib] FTimerManager::Tick(float) Address = 0x11b343cfc (filename not found) [in UnrealEditor-Engine.dylib] UEditorEngine::Tick(float, bool) Address = 0x113da9cac (filename not found) [in UnrealEditor-UnrealEd.dylib] UUnrealEdEngine::Tick(float, bool) Address = 0x114c56748 (filename not found) [in UnrealEditor-UnrealEd.dylib] FEngineLoop::Tick() Address = 0x104796064 (filename not found) [in UnrealEditor] GuardedMain(char16_t const) Address = 0x1047a3394 (filename not found) [in UnrealEditor] -[UEAppDelegate runGameThread:] Address = 0x1047beafc (filename not found) [in UnrealEditor] -[FCocoaGameThread main] Address = 0x1082c20ec (filename not found) [in UnrealEditor-Core.dylib] Unknown() Address = 0x1851d354c (filename not found) [in Foundation] Unknown() Address = 0x184183fa8 (filename not found) [in libsystem_pthread.dylib] Unknown() Address = 0x18417eda0 (filename not found) [in libsystem_pthread.dylib]

Johnastc2002 avatar Sep 26 '23 08:09 Johnastc2002

Did it happen as soon as you dropped the .vrm file?

ApoorvHesta avatar Sep 26 '23 08:09 ApoorvHesta

Yes, right after dropping the .vrm file, the crash is shown.

Johnastc2002 avatar Sep 26 '23 08:09 Johnastc2002

Now you are right where I am. I'm also looking for a solution for it including many others working on M1 Mac. If you get somewhere, do let me know. @ruyo Any updates on this issue as there are more threads like these.

ApoorvHesta avatar Sep 26 '23 08:09 ApoorvHesta

Hi @Johnastc2002 You can take the follow up from here. Seems it has been resolved.

[https://github.com/ruyo/VRM4U/issues/321]

ApoorvHesta avatar Sep 29 '23 07:09 ApoorvHesta

Thanks @ApoorvHesta for reminding! Let me check it out soon 🙏

Johnastc2002 avatar Sep 29 '23 07:09 Johnastc2002

Hi. The latest version fixes a runtime error on Mac. If you would like to try it out, please refer to the new documentation to set it up. https://ruyo-github-io.translate.goog/VRM4U/03_mac/?_x_tr_sl=ja&_x_tr_tl=en&_x_tr_hl=ja Thanks

ruyo avatar Nov 05 '23 23:11 ruyo