Search Issue Tracker

By Design

Votes

0

Found in

6000.0.56f1

6000.2.1f1

6000.3.0a5

Issue ID

UUM-114706

Regression

No

"Failed to load il2cpp" error when running a standalone build that uses static libraries

-

How to reproduce:
1. Open the project “IN-112335_StaticLibIssue”
2. File → Build and Run
3. Observe the result

Expected result: The standalone build opens without any errors
Actual result: Error window appears with the message “Failed to load il2cpp”

Reproducible with: 2023.1.0a1, 6000.0.56f1, 6000.2.1f1, 6000.3.0a5 (36d7e9fd6645)

Reproducible on: Windows 11
Not reproducible on: No other environments tested

Notes:

* The project builds without errors, but the error appears when the standalone build is launched
* No Player.log is created
* The project uses --linker-flags-file for some static libraries
* Prerequisites:
** In the Unity project, Edit → Project Settings → Player → Other Settings → Configuration
** Scripting Backend → IL2CPP
** C++ Compiler Configuration → Release
** Under Script Compilation → Scripting Define Symbols → add “EADPUNITY_USE_STATIC_LIB”
* The issue also reproduces when running the solution file (.sln), to run the file in Visual Studio 2022:
** File → Build Profiles → Create Visual Studio Solution
** Click Build
** Open Visual Studio 2022 → Open a project or solution → select the .sln file in the build directory
** Build the project with the x64 configuration

  1. Resolution Note:

    This particular user project actually links a dynamic library to the player's game library, but does not have logic to copy the dynamic library to the built player folder. Without the dynamic library dependency satisfied, the game library can not be loaded at startup and the player process exits immediately. For IL2CPP builds the simplest solution is to copy the required dlls to the root folder of the player.

    One way to see the dll dependencies if to run the following command...

    dumpbin.exe /dependents GameAssembly.dll

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.