Exception with libMonoPosixHelper.dylib on MAC Build

Hello,

I’m working again on an old project that used to build and work fine with Unity 2018.3

I’ve installed Unity 2019.3.0f3.

I can build without issue (unless I’ve missed something in a log somewhere?).

I have the following function:

public static string CompressString(string text)
        {
            try
            {
                if (text == null || text.Length == 0) return String.Empty;

                using (var memoryStream = new MemoryStream())
                {
                    byte[] buffer = Encoding.UTF8.GetBytes(text);
                    using (var gZipStream = new GZipStream(memoryStream, CompressionMode.Compress, true))
                    {
                        gZipStream.Write(buffer, 0, buffer.Length);
                    }

                    memoryStream.Position = 0;

                    var compressedData = new byte[memoryStream.Length];
                    memoryStream.Read(compressedData, 0, compressedData.Length);

                    var gZipBuffer = new byte[compressedData.Length + 4];
                    Buffer.BlockCopy(compressedData, 0, gZipBuffer, 4, compressedData.Length);
                    Buffer.BlockCopy(BitConverter.GetBytes(buffer.Length), 0, gZipBuffer, 0, 4);

                    return Convert.ToBase64String(gZipBuffer);
                }
            }
            catch (Exception erreur)
            {
                return text;
            }
        }

Which works fine on windows.

When I try on my mac I get the following exception:

Am I missing something?

Same issue. work fine on unity 2019.2 and only happen with mac build in 2019.3.2f
P/S: not happen when using il2cpp

Same here, also work fine on previous versions… stopped working on 2019.3.0f

Same here. Something changed in 2019.3 that broke mono linking to libMonoPosixHelper

I’ve found a work around:

  1. Open the package contents of your built mac app
  2. Go into the frameworks folder
  3. Create (inside the frameworks folder) the following directories:

MonoBleedingEdge/MonoEmbedRuntime/osx

  1. move libMonoPosixHelper.dylib from the frameworks folder to the osx folder.

libMonoPosixHelper.dylib should be found now in the build when you run it.

Feels like a Unity bug?

2 Likes