Segfault when building via cmd line with -nographics parameter

In 2018.1.2f1, I get a segfault when trying to build via the following command. If the -nographics flag is removed, it succeeds (but that causes the gui’s splash screen to appear which interferes with automated builds).

The stack trace is included below. Notice that calls are made into X libs, which shouldn’t be happening when -batchmode is provided as a parameter or when -nographics is provided as a parameter. And both are provided in this case.

$ unity-editor -quit -batchmode -nographics -projectPath $HOME/game -buildLinux64Player /tmp/game/out -logFile /dev/stdout

#0 0x00007ffff5b872a4 in XAddExtension () from /usr/lib64/libX11.so.6
#1 0x00007ffff5953211 in _XcursorGetDisplayInfo () from /usr/lib64/libXcursor.so.1
#2 0x00007ffff5953709 in XcursorSupportsARGB () from /usr/lib64/libXcursor.so.1
#3 0x00007ffff5951ed4 in XcursorImageLoadCursor () from /usr/lib64/libXcursor.so.1
#4 0x0000000002b8df64 in GenerateCursor ()
#5 0x0000000002b8e1f7 in Cursors::InitializeCursors ()
#6 0x0000000000ab932a in PlayerSettings::InitDefaultCursors ()
#7 0x0000000000604553 in TypeManager::CallPostInitializeTypes ()
#8 0x0000000000a78642 in InitializeEngineGraphics ()
#9 0x00000000019a0a53 in Application::InitializeProject ()
#10 0x0000000001b50748 in InitializeUnity ()
#11 0x00000000005381b5 in main ()

Also getting this error on Ubuntu 18.04 Unity 2018.3.0f2

==11500== Process terminating with default action of signal 11 (SIGSEGV)
==11500==  Access not within mapped region at address 0x968
==11500==    at 0x9A04FF4: XAddExtension (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==11500==    by 0x9D189D0: _XcursorGetDisplayInfo (in /usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2)
==11500==    by 0x9D18F28: XcursorSupportsARGB (in /usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2)
==11500==    by 0x9D17723: XcursorImageLoadCursor (in /usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2)
==11500==    by 0x2D88C75: Cursors::GenerateCursor(Texture2D*, Vector2f, CursorMode) (in /opt/Unity-2018.3.0f2/Editor/Unity)
==11500==    by 0x2D88E06: Cursors::InitializeCursors(Texture2D*, Vector2f) (in /opt/Unity-2018.3.0f2/Editor/Unity)
==11500==    by 0xA62E0F: PlayerSettings::InitDefaultCursors() (in /opt/Unity-2018.3.0f2/Editor/Unity)
==11500==    by 0xA62EEE: PlayerSettings::PostInitializeClass() (in /opt/Unity-2018.3.0f2/Editor/Unity)
==11500==    by 0x6168C2: TypeManager::CallPostInitializeTypes() (in /opt/Unity-2018.3.0f2/Editor/Unity)
==11500==    by 0xAEAD0C: InitializeEngineGraphics(bool) (in /opt/Unity-2018.3.0f2/Editor/Unity)
==11500==    by 0x1911EE3: Application::InitializeProject() (in /opt/Unity-2018.3.0f2/Editor/Unity)
==11500==    by 0x1A8C3AB: InitializeUnity(void*) (in /opt/Unity-2018.3.0f2/Editor/Unity)

also receiving a segfault

Initialize engine version: 2018.3.0f2 (6e9a27477296)
Forcing GfxDevice: Null
NullGfxDevice:
Version: NULL 1.0 [1.0]
Renderer: Null Device
Vendor: Unity Technologies
[EnlightenBakeManager] m_Clear = false;
WARNING: Shader Unsupported: ‘Hidden/FrameDebuggerRenderTargetDisplay’ - Pass ‘’ has no vertex shader
Initialize mono
Mono path[0] = ‘/opt/Unity/Editor/Data/Managed’
Mono path[1] = ‘/opt/Unity/Editor/Data/MonoBleedingEdge/lib/mono/unityjit’
Mono config path = ‘/opt/Unity/Editor/Data/MonoBleedingEdge/etc’
Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,server=y,suspend=n,address=0.0.0.0:56032
Begin MonoManager ReloadAssembly
Initializing Unity.PackageManager (PackageManager) v2018.3.0 for Unity v2018.3.0f2
Registering precompiled unity dll’s …
Register platform support module: /opt/Unity/Editor/Data/PlaybackEngines/LinuxStandaloneSupport/UnityEditor.LinuxStandalone.Extensions.dll
Registered in 0.001604 seconds.
Registering platform support modules:
Registered platform support modules in: 0.16079s.
Native extension for LinuxStandalone target not found
Refreshing native plugins compatible for Editor in 1.73 ms, found 1 plugins.
Preloading 1 native plugins for Editor in 14.48 ms.
Mono: successfully reloaded assembly

  • Completed reload, in 2.869 seconds
    Registering precompiled user dll’s …
    Registered in 0.149299 seconds.
    Platform modules already initialized, skipping
    Assertion failed on expression: ‘klass != NULL’
    (Filename: /home/builduser/buildslave/unity/build/Editor/Src/ScriptCompilation/ScriptCompilationPipeline.cpp Line: 1292)
    Receiving unhandled NULL exception
    Segmentation fault (core dumped)

If you have a repro project, please submit a bug with it.

Is there any news on this issue? I can still reproduce this on two different machines with Unity 2021.1.11f …

Currently preventing --nographics builds for our project after adding a custom mouse cursor via Player Settings, Unity 2021.1.12f1.

In a

I’m waiting for a Unity dev to come and tell us that this is “by design”.

Hey, don’t be snappy :stuck_out_tongue:

From the logs it looks like it breaks at the point where, after removing the cursor again, it displays the progress bar (DisplayProgressbar: Building Player), probably because it would at this point initialize the cursor, which it can’t without the GPU. @PixelJ I can’t spare the time to set up a repro project right now, but still poking you because maybe those details are helpful.

five years passed, It still happends in 2022.2.

Yep, having the same issue in 2023.1.12f1.

would you mind to help filing a bug here? thanks!