Search Unity

objcopy fails on build if there is a space in executable name

Discussion in 'Linux' started by SarperS, Dec 3, 2021.

  1. SarperS

    SarperS

    Joined:
    Mar 10, 2009
    Posts:
    824
    "Last_Bastion" builds fine but if I name the binary "Last Bastion" I get the below error log.

    failed to generate symbol file:
    exit code=1:
    stdout:
    stderr:
    Usage: E:\app\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\objcopy.exe [option(s)] in-file [out-file]
    Copies a binary file, possibly transforming it in the process
    The options are:
    -I --input-target <bfdname> Assume input file is in format <bfdname>
    -O --output-target <bfdname> Create an output file in format <bfdname>
    -B --binary-architecture <arch> Set output arch, when input is arch-less
    -F --target <bfdname> Set both input and output format to <bfdname>
    --debugging Convert debugging information, if possible
    -p --preserve-dates Copy modified/access timestamps to the output
    -D --enable-deterministic-archives
    Produce deterministic output when stripping archives
    -U --disable-deterministic-archives
    Disable -D behavior (default)
    -j --only-section <name> Only copy section <name> into the output
    --add-gnu-debuglink=<file> Add section .gnu_debuglink linking to <file>
    -R --remove-section <name> Remove section <name> from the output
    --remove-relocations <name> Remove relocations from section <name>
    -S --strip-all Remove all symbol and relocation information
    -g --strip-debug Remove all debugging symbols & sections
    --strip-dwo Remove all DWO sections
    --strip-unneeded Remove all symbols not needed by relocations
    -N --strip-symbol <name> Do not copy symbol <name>
    --strip-unneeded-symbol <name>
    Do not copy symbol <name> unless needed by
    relocations
    --only-keep-debug Strip everything but the debug information
    --extract-dwo Copy only DWO sections
    --extract-symbol Remove section contents but keep symbols
    -K --keep-symbol <name> Do not strip symbol <name>
    --keep-file-symbols Do not strip file symbol(s)
    --localize-hidden Turn all ELF hidden symbols into locals
    -L --localize-symbol <name> Force symbol <name> to be marked as a local
    --globalize-symbol <name> Force symbol <name> to be marked as a global
    -G --keep-global-symbol <name> Localize all symbols except <name>
    -W --weaken-symbol <name> Force symbol <name> to be marked as a weak
    --weaken Force all global symbols to be marked as weak
    -w --wildcard Permit wildcard in symbol comparison
    -x --discard-all Remove all non-global symbols
    -X --discard-locals Remove any compiler-generated symbols
    -i --interleave[=<number>] Only copy N out of every <number> bytes
    --interleave-width <number> Set N for --interleave
    -b --byte <num> Select byte <num> in every interleaved block
    --gap-fill <val> Fill gaps between sections with <val>
    --pad-to <addr> Pad the last section up to address <addr>
    --set-start <addr> Set the start address to <addr>
    {--change-start|--adjust-start} <incr>
    Add <incr> to the start address
    {--change-addresses|--adjust-vma} <incr>
    Add <incr> to LMA, VMA and start addresses
    {--change-section-address|--adjust-section-vma} <name>{=|+|-}<val>
    Change LMA and VMA of section <name> by <val>
    --change-section-lma <name>{=|+|-}<val>
    Change the LMA of section <name> by <val>
    --change-section-vma <name>{=|+|-}<val>
    Change the VMA of section <name> by <val>
    {--[no-]change-warnings|--[no-]adjust-warnings}
    Warn if a named section does not exist
    --set-section-flags <name>=<flags>
    Set section <name>'s properties to <flags>
    --add-section <name>=<file> Add section <name> found in <file> to output
    --update-section <name>=<file>
    Update contents of section <name> with
    contents found in <file>
    --dump-section <name>=<file> Dump the contents of section <name> into <file>
    --rename-section <old>=<new>[,<flags>] Rename section <old> to <new>
    --long-section-names {enable|disable|keep}
    Handle long section names in Coff objects.
    --change-leading-char Force output format's leading character style
    --remove-leading-char Remove leading character from global symbols
    --reverse-bytes=<num> Reverse <num> bytes at a time, in output sections with content
    --redefine-sym <old>=<new> Redefine symbol name <old> to <new>
    --redefine-syms <file> --redefine-sym for all symbol pairs
    listed in <file>
    --srec-len <number> Restrict the length of generated Srecords
    --srec-forceS3 Restrict the type of generated Srecords to S3
    --strip-symbols <file> -N for all symbols listed in <file>
    --strip-unneeded-symbols <file>
    --strip-unneeded-symbol for all symbols listed
    in <file>
    --keep-symbols <file> -K for all symbols listed in <file>
    --localize-symbols <file> -L for all symbols listed in <file>
    --globalize-symbols <file> --globalize-symbol for all in <file>
    --keep-global-symbols <file> -G for all symbols listed in <file>
    --weaken-symbols <file> -W for all symbols listed in <file>
    --add-symbol <name>=[<section>:]<value>[,<flags>] Add a symbol
    --alt-machine-code <index> Use the target's <index>'th alternative machine
    --writable-text Mark the output text as writable
    --readonly-text Make the output text write protected
    --pure Mark the output file as demand paged
    --impure Mark the output file as impure
    --prefix-symbols <prefix> Add <prefix> to start of every symbol name
    --prefix-sections <prefix> Add <prefix> to start of every section name
    --prefix-alloc-sections <prefix>
    Add <prefix> to start of every allocatable
    section name
    --file-alignment <num> Set PE file alignment to <num>
    --heap <reserve>[,<commit>] Set PE reserve/commit heap to <reserve>/
    <commit>
    --image-base <address> Set PE image base to <address>
    --section-alignment <num> Set PE section alignment to <num>
    --stack <reserve>[,<commit>] Set PE reserve/commit stack to <reserve>/
    <commit>
    --subsystem <name>[:<version>]
    Set PE subsystem to <name> [& <version>]
    --compress-debug-sections[={none|zlib|zlib-gnu|zlib-gabi}]
    Compress DWARF debug sections using zlib
    --decompress-debug-sections Decompress DWARF debug sections using zlib
    --elf-stt-common=[yes|no] Generate ELF common symbols with STT_COMMON
    type
    -M --merge-notes Remove redundant entries in note sections
    --no-merge-notes Do not attempt to remove redundant notes (default)
    -v --verbose List all object files modified
    @<file> Read options from <file>
    -V --version Display this program's version number
    -h --help Display this output
    --info List object formats & architectures supported
    E:\app\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\objcopy.exe: supported targets: pe-x86-64 pei-x86-64 pe-bigobj-x86-64 elf64-x86-64 elf64-l1om elf64-k1om pe-i386 pei-i386 elf32-i386 elf32-iamcu elf64-little elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex
    UnityEditor.LinuxStandalone.LinuxDesktopStandalonePostProcessor:processPlatformSpecificIL2CPPOutput (UnityEditor.Modules.BuildPostProcessArgs)
    DesktopStandalonePostProcessor:processIl2CppOutputForBinary (UnityEditor.Modules.BuildPostProcessArgs)
    DesktopStandalonePostProcessor:SetupStagingArea (UnityEditor.Modules.BuildPostProcessArgs,System.Collections.Generic.HashSet`1<string>)
    DesktopStandalonePostProcessor:postProcess (UnityEditor.Modules.BuildPostProcessArgs)
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

    and this followed by above:

    failed to add debug info link:
    exit code=1:
    stdout:
    stderr:
    E:\app\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\objcopy.exe: 'Bastion_BackUpThisFolder_ButDontShipItWithYourGame\GameAssembly.debug': No such file

    UnityEditor.LinuxStandalone.LinuxDesktopStandalonePostProcessor:processPlatformSpecificIL2CPPOutput (UnityEditor.Modules.BuildPostProcessArgs)
    DesktopStandalonePostProcessor:processIl2CppOutputForBinary (UnityEditor.Modules.BuildPostProcessArgs)
    DesktopStandalonePostProcessor:SetupStagingArea (UnityEditor.Modules.BuildPostProcessArgs,System.Collections.Generic.HashSet`1<string>)
    DesktopStandalonePostProcessor:postProcess (UnityEditor.Modules.BuildPostProcessArgs)
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)
     
  2. SarperS

    SarperS

    Joined:
    Mar 10, 2009
    Posts:
    824
    Okay, so it was using the objcopy from my mingw installation because it was in the path. Upon renaming the mingw objcopy to something else temporarily, it built fine with a space in the binary name.
     
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Can you report this as a bug? We shouldn't be invoking random tools in your %PATH%.
     
  4. SarperS

    SarperS

    Joined:
    Mar 10, 2009
    Posts:
    824
    Sure, Case 1385726
     
  5. huulong

    huulong

    Joined:
    Jul 1, 2013
    Posts:
    224
    Well, I just got the same error with /usr/bin/objcopy on Linux. But this one seems legit?

    Also, the build succeeded, so I'm not sure what's wrong. Maybe just not be able to generate the DontShip folder or the debugging symbols, but the build itself is fine?
     
  6. SarperS

    SarperS

    Joined:
    Mar 10, 2009
    Posts:
    824
    Build always report success after the objcopy error log, but the resulting files are way smaller than a normal build and they don't work correctly. I still get the error while using Unity's copy of objcopy by the way, but not every time. Not having any spaces in the build path fixes the problem.
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Thanks!
     
  8. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,343
    Sorry for bumping this one.
    Just wanted to let people know that this still happens in 2020.3.30f1 LTS if you build on a windows machine. In my case it was an old install of Strawberry Perl in the env PATH.

    I can see that the objcopy is part of the Toolchain package (com.unity.toolchain.win-x86_64-linux-x86_64). But the build still seems to just pick the first it find in the %PATH%. Is there any way to configure this manually?

    The funny things is. If I remove my global objcopy from the environment then it seems to pick the right objcopy (C:\Users\geo\AppData\Local\unity3d\cache\sysroots\windows-x86_64-linux-x86_64\llvm-9.0.0-1\bin\objcopy.exe in my case).

    Still get an error though:
    Code (csharp):
    1.  
    2. failed to generate symbol file:
    3. exit code=1:
    4.  stdout:
    5. stderr:
    6. C:\Users\geo\AppData\Local\unity3d\cache\sysroots\windows-x86_64-linux-x86_64\llvm-9.0.0-1\bin\objcopy.exe: error: too many positional arguments
    7.  
    8. 0x00007ff62432bdec (Unity)
    9. 0x00007ff6243331e9 (Unity)
    10. 0x00007ff62509d74c (Unity)
    11. 0x00007ff625aea5e3 (Unity)
    12. 0x00007ff6244bd846 (Unity)
    13. 0x0000026a3268183b (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
    14. 0x0000026a3268176b (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    15. 0x0000026a326814b0 (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object)
    16. 0x0000026a3b6cd645 (Mono JIT Code) UnityEngine.Debug:LogError (object)
    17. 0x0000026a3b6cd403 (Mono JIT Code) [LinuxDesktopStandalonePostProcessor.cs:165] UnityEditor.LinuxStandalone.LinuxDesktopStandalonePostProcessor:RunCommand (string,string,string)
    18. 0x0000026a3b6cd15b (Mono JIT Code) [LinuxDesktopStandalonePostProcessor.cs:179] UnityEditor.LinuxStandalone.LinuxDesktopStandalonePostProcessor:ProcessPlatformSpecificIL2CPPOutput (UnityEditor.Modules.BuildPostProcessArgs)
    19. 0x0000026a3b6cc631 (Mono JIT Code) DesktopStandalonePostProcessor:ProcessIl2CppOutputForBinary (UnityEditor.Modules.BuildPostProcessArgs)
    20. 0x0000026a393e3c53 (Mono JIT Code) DesktopStandalonePostProcessor:SetupStagingArea (UnityEditor.Modules.BuildPostProcessArgs,System.Collections.Generic.HashSet`1<string>)
    21. 0x0000026a393e2a73 (Mono JIT Code) DesktopStandalonePostProcessor:PostProcess (UnityEditor.Modules.BuildPostProcessArgs)
    22. 0x0000026a393e27eb (Mono JIT Code) UnityEditor.Modules.DefaultBuildPostprocessor:PostProcess (UnityEditor.Modules.BuildPostProcessArgs,UnityEditor.BuildProperties&)
    23. 0x0000026a393e210a (Mono JIT Code) UnityEditor.PostprocessBuildPlayer:Postprocess (UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,string,string,string,int,int,UnityEditor.BuildOptions,UnityEditor.RuntimeClassRegistry,UnityEditor.Build.Reporting.BuildReport)
    24. 0x0000026a393e2439 (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_int_int_object_object_object_int_int_int_object_object (object,intptr,intptr,intptr)
    25. 0x00007ffeb72df1e0 (mono-2.0-bdwgc) mono_get_runtime_build_info
    26. 0x00007ffeb7262ac2 (mono-2.0-bdwgc) mono_perfcounters_init
    27. 0x00007ffeb726bb1f (mono-2.0-bdwgc) mono_runtime_invoke
    28. 0x00007ff62426fa44 (Unity)
    29. 0x00007ff62426ad21 (Unity)
    30. 0x00007ff625d3457d (Unity)
    31. 0x00007ff625d3b441 (Unity)
    32. 0x00007ff625d36d9d (Unity)
    33. 0x00007ff625d35680 (Unity)
    34. 0x00007ff625d2a70f (Unity)
    35. 0x00007ff6256adf2f (Unity)
    36. 0x00007ff625447aaa (Unity)
    37. 0x0000026af388264a (Mono JIT Code) (wrapper managed-to-native) UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,UnityEditor.BuildOptions,string[],bool)
    38. 0x0000026af3881dfb (Mono JIT Code) UnityEditor.BuildPlayerWindow/DefaultBuildMethods:BuildPlayer (UnityEditor.BuildPlayerOptions)
    39. 0x00000269da08f08b (Mono JIT Code) UnityEditor.BuildPlayerWindow:CallBuildMethods (bool,UnityEditor.BuildOptions)
    40. 0x0000026a3708ae63 (Mono JIT Code) UnityEditor.BuildPlayerWindow:GUIBuildButtons (UnityEditor.Modules.IBuildWindowExtension,bool,bool,bool,UnityEditor.Build.BuildPlatform)
    41. 0x0000026a37082303 (Mono JIT Code) UnityEditor.BuildPlayerWindow:ShowBuildTargetSettings ()
    42. 0x0000026a37075c13 (Mono JIT Code) UnityEditor.BuildPlayerWindow:OnGUI ()
    43. 0x0000026a34a1f9d3 (Mono JIT Code) UnityEditor.HostView:InvokeOnGUI (UnityEngine.Rect,UnityEngine.Rect)
    44. 0x0000026a34a1f743 (Mono JIT Code) UnityEditor.DockArea:DrawView (UnityEngine.Rect,UnityEngine.Rect)
    45. 0x0000026a34a15243 (Mono JIT Code) UnityEditor.DockArea:OldOnGUI ()
    46. 0x0000026a3275dee0 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:DoOnGUI (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,bool,UnityEngine.Rect,System.Action,bool)
    47. 0x0000026a3275ceeb (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,System.Action,bool)
    48. 0x0000026a36fab84b (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (UnityEngine.Event,System.Action,bool)
    49. 0x0000026a36fab6b3 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (UnityEngine.Event,bool)
    50. 0x0000026a370d23bb (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase,bool,bool)
    51. 0x0000026a370cfb43 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:SendEventToIMGUI (UnityEngine.UIElements.EventBase,bool,bool)
    52. 0x0000026a324957bb (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:HandleEvent (UnityEngine.UIElements.EventBase)
    53. 0x0000026a32481e28 (Mono JIT Code) UnityEngine.UIElements.CallbackEventHandler:HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase)
    54. 0x0000026a370cd303 (Mono JIT Code) UnityEngine.UIElements.MouseCaptureDispatchingStrategy:DispatchEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel)
    55. 0x0000026a324800ae (Mono JIT Code) UnityEngine.UIElements.EventDispatcher:ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel,bool)
    56. 0x0000026a3247f9d3 (Mono JIT Code) UnityEngine.UIElements.EventDispatcher:ProcessEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel)
    57. 0x0000026a32485573 (Mono JIT Code) UnityEngine.UIElements.EventDispatcher:ProcessEventQueue ()
    58. 0x0000026a32483b63 (Mono JIT Code) UnityEngine.UIElements.EventDispatcher:OpenGate ()
    59. 0x0000026a32483aab (Mono JIT Code) UnityEngine.UIElements.EventDispatcherGate:Dispose ()
    60. 0x0000026a3247fc63 (Mono JIT Code) UnityEngine.UIElements.EventDispatcher:ProcessEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel)
    61. 0x0000026a3247f3a3 (Mono JIT Code) UnityEngine.UIElements.EventDispatcher:Dispatch (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel,UnityEngine.UIElements.DispatchMode)
    62. 0x0000026a3247f21b (Mono JIT Code) UnityEngine.UIElements.BaseVisualElementPanel:SendEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.DispatchMode)
    63. 0x0000026a3270e19b (Mono JIT Code) UnityEngine.UIElements.UIElementsUtility:DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel)
    64. 0x0000026a3270d8bb (Mono JIT Code) UnityEngine.UIElements.UIElementsUtility:UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (int,intptr,bool&)
    65. 0x0000026a3270d4bf (Mono JIT Code) UnityEngine.UIElements.UIEventRegistration:ProcessEvent (int,intptr)
    66. 0x0000026a3270d26b (Mono JIT Code) UnityEngine.UIElements.UIEventRegistration/<>c:<.cctor>b__1_2 (int,intptr)
    67. 0x0000026a3270cf9d (Mono JIT Code) UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    68. 0x0000026a3270d14e (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_int_intptr_intptr& (object,intptr,intptr,intptr)
    69. 0x00007ffeb72df1e0 (mono-2.0-bdwgc) mono_get_runtime_build_info
    70. 0x00007ffeb7262ac2 (mono-2.0-bdwgc) mono_perfcounters_init
    71. 0x00007ffeb726bb1f (mono-2.0-bdwgc) mono_runtime_invoke
    72. 0x00007ff62426fa44 (Unity)
    73. 0x00007ff62426ad21 (Unity)
    74. 0x00007ff624264b15 (Unity)
    75. 0x00007ff623535aaa (Unity)
    76. 0x00007ff624b87ec6 (Unity)
    77. 0x00007ff6250d3492 (Unity)
    78. 0x00007ff624b87db8 (Unity)
    79. 0x00007ff6250d4637 (Unity)
    80. 0x00007ff6250ce213 (Unity)
    81. 0x00007fff56fbe858 (USER32) CallWindowProcW
    82. 0x00007fff56fbe299 (USER32) DispatchMessageW
    83. 0x00007ff6250a3da6 (Unity)
    84. 0x00007ff6250a7f41 (Unity)
    85. 0x00007ff62673944e (Unity)
    86. 0x00007fff56357034 (KERNEL32) BaseThreadInitThunk
    87. 0x00007fff57c82651 (ntdll) RtlUserThreadStart
    88.  

    Is there a way to observe the progress on this issue?
    I can't find it on https://unity3d.com/unity/qa/bug-reporting and https://fogbugz.unity3d.com/ requires a ticket in addition to the case id.
     
    Last edited: Mar 25, 2022
  9. SarperS

    SarperS

    Joined:
    Mar 10, 2009
    Posts:
    824
    The issue was closed a couple weeks ago due to Unity engineers not being able to reproduce it :/
     
  10. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,343
    Oh :-(
    Thanks for letting me know.
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    If you have concrete steps in order to reproduce it, please file another bug report. The QA tried adding MingW to the path but either they did it incorrectly, or something else was the reason behind it happening.
     
  12. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,343
    Thanks for your reply.
    I am in the middle of upgrading to 2021 at the moment. I will try to make a repro project and submit a bug later. Though given that it might depend on the local environment setup I am not entirely sure if this can be reproduced easily.

    The other error I had seemed to come from the space in the Binary Name as @SarperS mentioned before, thx btw..
    Still, the linux build seems somehow broken. It works fine at first boot but at second+ boot I only get a black screen. Thus I have paused development on it for now.
     
  13. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,343
    Am happy to report that with 2021.17f1 everything works like a charm :)