Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

[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,109
    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,109
    Last edited: Dec 5, 2018
  3. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,109
    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