Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. The 2022.2 beta is now available for testing. To find out what's new, have a look at our 2022.2 feature highlights.
    Dismiss Notice
  3. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  4. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
Dismiss Notice
Submit bug reports tagged with #Beta2022Win_Unity when you encounter unknown issues while testing the 2022.2 betas for a chance to win a year of Unity Pro. For more information, have a look at our Beta Sweepstakes Announcement.

[SOLVED] ML-Agents break when using IL2CPP as scripting backend

Discussion in 'AI & Navigation Previews' started by rz_0lento, Nov 1, 2018.

  1. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,356
    There are a lot of things going wrong when trying to use IL2CPP for Windows standalone as build option with ML-Agents.

    I recently tried to build Puppo The Corgi demo and got first stuck with protobuffer not finding two internal methods: dlsym and dlopen. Turned out that these were only used on Linux but since they were in Grpc.Core.dll, IL2CPP code tried to link against them, ultimately failing to do so. I manually removed the offending parts as I'm not building for Linux but proper way to handle this would be to ship either ml-agents with platform specific dll for these or have sources there and have platform switches for these.

    After figuring out the protobuffer thing, IL2CPP build actually finishes but once run, it wouldn't work properly. Instead, logs would be full of things like these:

    So, ultimately the question is, will Unity make ML-Agents IL2CPP compatible in the future? Any thoughts from @JoshPeterson?
     
  2. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,356
    Last edited: Dec 5, 2018
  3. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,356
    A small update, I got this building now using IL2CPP.

    the missing part of the puzzle were these fixes for IL2CPP on TensorFlowSharp: https://github.com/lkuich/TensorFlowSharp/commit/16b30948c27fcd4e235711f4d725e92de8337e34

    in addition, if you want to build for windows you need to strip out MacOS and Linux dlsym and dlopen mentions from Grpc.Core. I made the changes this way:
    https://github.com/0lento/grpc/commit/0b61d95b77eb1f31bda18f2c798adc286cf9a511

    for this to work, you need to place whole Grpc.Core folder from the repo somewhere in your project and remove the prebuilt Grpc.Core.dll from ml-agents.
     
    Last edited: Dec 5, 2018
unityunity