4ian / GDevelop

🎮 Open-source, cross-platform 2D/3D/multiplayer game engine designed for everyone.
https://gdevelop.io
Other
11.32k stars 871 forks source link

Desktop app fails to build on arm macbook air M1 #5894

Open popey opened 1 year ago

popey commented 1 year ago

Is there an existing issue for this?

Describe the bug

Related to #5893 - I thought I'd try building the desktop app from source. So I cloned the repo and followed the instructions at https://github.com/4ian/GDevelop/blob/master/newIDE/README.md

The build fails with a memory error. The laptop has 16GB of RAM, and 16GB swap, which doesn't run out, nor even close.

Steps to reproduce

On a Mac with an Apple Silicon CPU running Ubuntu Asahi Linux.

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

✅ src/Version/VersionMetadata.js properly generated.
Creating an optimized production build...

<--- Last few GCs --->

[918027:0x30bd1490]    66890 ms: Scavenge 2017.0 (2071.6) -> 2016.6 (2082.1) MB, 3.2 / 0.0 ms  (average mu = 0.537, current mu = 0.331) allocation failure; 
[918027:0x30bd1490]    66899 ms: Scavenge 2024.4 (2082.3) -> 2023.9 (2084.3) MB, 3.2 / 0.0 ms  (average mu = 0.537, current mu = 0.331) allocation failure; 
[918027:0x30bd1490]    67287 ms: Scavenge 2025.7 (2084.3) -> 2024.8 (2105.3) MB, 387.3 / 0.0 ms  (average mu = 0.537, current mu = 0.331) allocation failure; 

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb675b4 node::Abort() [/usr/local/lib/node_modules/node/bin/node]
 2: 0xa8afbc void node::FPrintF<>(_IO_FILE*, char const*) [/usr/local/lib/node_modules/node/bin/node]
 3: 0xd3ac00 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/lib/node_modules/node/bin/node]
 4: 0xd3add0 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/lib/node_modules/node/bin/node]
 5: 0xf1935c  [/usr/local/lib/node_modules/node/bin/node]
 6: 0xf2b2fc v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/lib/node_modules/node/bin/node]
 7: 0xf07470 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/lib/node_modules/node/bin/node]
 8: 0xf08448 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/lib/node_modules/node/bin/node]
 9: 0xeeb0d8 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/lib/node_modules/node/bin/node]
10: 0x12913ac v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/lib/node_modules/node/bin/node]
11: 0x1675f8c  [/usr/local/lib/node_modules/node/bin/node]
❌ App build failed with code 1.

GDevelop platform

Desktop

GDevelop version

Git master

Platform info

*OS (e.g. Windows, Linux, macOS, Android, iOS)* > Asahi Ubuntu linux *OS Version (e.g. Windows 10, macOS 10.15)* > 23.10 *Browser(For Web) (e.g. Chrome, Firefox, Safari)* > *Device(For Mobile) (e.g. iPhone 12, Samsung Galaxy S21)* >

Additional context

No response

4ian commented 1 year ago

Indeed on the CI we had to force Node to use more memory: https://github.com/4ian/GDevelop/blob/7229406cfbdbf79624b6a64dbdb6d93fb53cdfa6/.circleci/config.yml#L68

Try something like:

export NODE_OPTIONS="--max-old-space-size=7168" && npm run build

and let us know if it works better? If yes, we might want to put this in the README (or hopefully one day migrate from create-react-app to Vite or a tooling that uses less memory)

popey commented 1 year ago

Thanks for the prompt response. Yes, that helped. But it now fails further along. Looks like it's trying to build or run x86 binaries on my arm64 device?

  • building        target=AppImage arch=x64 file=dist/GDevelop 5-5.3.180.AppImage                                                                                 
  • building        target=zip arch=x64 file=dist/gdevelop-5.3.180.zip                                                                                             
  • packaging       platform=linux arch=arm64 electron=18.2.2 appOutDir=dist/linux-arm64-unpacked                                                                    • downloading     url=https://github.com/electron-userland/electron-builder-binaries/releases/download/appimage-12.0.1/appimage-12.0.1.7z size=1.6 MB parts=1    
  • downloading     url=https://github.com/electron/electron/releases/download/v18.2.2/electron-v18.2.2-linux-arm64.zip size=89 MB parts=8                         
  • downloaded      url=https://github.com/electron-userland/electron-builder-binaries/releases/download/appimage-12.0.1/appimage-12.0.1.7z duration=1.132s        
  • downloaded      url=https://github.com/electron/electron/releases/download/v18.2.2/electron-v18.2.2-linux-arm64.zip duration=7.072s                            
  • file source doesn't exist  from=/home/alan/Source/4ian/GDevelop/newIDE/app/resources/in-app-tutorials                                                          
  • building        target=AppImage arch=arm64 file=dist/GDevelop 5-5.3.180-arm64.AppImage                                                                         
  • building        target=zip arch=arm64 file=dist/gdevelop-5.3.180-arm64.zip                                                                                     
  • building        target=deb arch=x64 file=dist/gdevelop_5.3.180_amd64.deb                                                                                       
  ⨯ cannot execute  cause=exit status 1                                                                                                                            
                    errorOut=/home/alan/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/alan/.cache/electron-builder/fpm/fpm
-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: cannot execute binary file: Exec format error                                                                       
    /home/alan/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/alan/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/li
b/ruby/bin.real/ruby: Success                                                                                                                                      

                    command=/home/alan/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/fpm -s dir --force -t deb -d libgtk-3-0 -d libnotify4 -d libnss3 -d li
bxss1 -d libxtst6 -d xdg-utils -d libatspi2.0-0 -d libuuid1 -d libsecret-1-0 --deb-recommends libappindicator3-1 --deb-compression xz --architecture amd64 --after-
install /tmp/t-ngfEYN/1-after-install --after-remove /tmp/t-ngfEYN/0-after-remove --description '                                                                  
     GDevelop 5 IDE - the open-source, cross-platform game engine designed for everyone' --version 5.3.180 --package /home/alan/Source/4ian/GDevelop/newIDE/electro
n-app/dist/gdevelop_5.3.180_amd64.deb --name gdevelop --maintainer 'GDevelop Team <hello@gdevelop.io>' --url https://gdevelop.io --vendor 'GDevelop Team <hello@gde
velop.io>' --deb-priority optional --license MIT '/home/alan/Source/4ian/GDevelop/newIDE/electron-app/dist/linux-unpacked/=/opt/GDevelop 5' /home/alan/Source/4ian/
GDevelop/newIDE/electron-app/dist/.icon-set/icon_16x16.png=/usr/share/icons/hicolor/16x16/apps/gdevelop.png /home/alan/Source/4ian/GDevelop/newIDE/electron-app/dis
t/.icon-set/icon_32.png=/usr/share/icons/hicolor/32x32/apps/gdevelop.png /home/alan/Source/4ian/GDevelop/newIDE/electron-app/dist/.icon-set/icon_48x48.png=/usr/sha
re/icons/hicolor/48x48/apps/gdevelop.png /home/alan/Source/4ian/GDevelop/newIDE/electron-app/dist/.icon-set/icon_64.png=/usr/share/icons/hicolor/64x64/apps/gdevelo
p.png /home/alan/Source/4ian/GDevelop/newIDE/electron-app/dist/.icon-set/icon_128.png=/usr/share/icons/hicolor/128x128/apps/gdevelop.png /home/alan/Source/4ian/GDe
velop/newIDE/electron-app/dist/.icon-set/icon_256.png=/usr/share/icons/hicolor/256x256/apps/gdevelop.png /home/alan/Source/4ian/GDevelop/newIDE/electron-app/dist/.
icon-set/icon_512.png=/usr/share/icons/hicolor/512x512/apps/gdevelop.png /home/alan/Source/4ian/GDevelop/newIDE/electron-app/dist/.icon-set/icon_1024.png=/usr/shar
e/icons/hicolor/1024x1024/apps/gdevelop.png '/tmp/t-ngfEYN/2-GDevelop 5.desktop=/usr/share/applications/gdevelop.desktop'                                          
                    workingDir=                                                                                                                                    
  • building        target=deb arch=arm64 file=dist/gdevelop_5.3.180_arm64.deb                                                                                     
  ⨯ cannot execute  cause=exit status 1
                    errorOut=/home/alan/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/alan/.cache/electron-builder/fpm/fpm
-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: cannot execute binary file: Exec format error                                                                       
    /home/alan/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/alan/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/li
b/ruby/bin.real/ruby: Success                                                    

                                                                                                                                                          [36/421]
                    command=/home/alan/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/fpm -s dir --force -t deb -d libgtk-3-0 -d libnotify4 -d libnss3 -d li
bxss1 -d libxtst6 -d xdg-utils -d libatspi2.0-0 -d libuuid1 -d libsecret-1-0 --deb-recommends libappindicator3-1 --deb-compression xz --architecture arm64 --after-
install /tmp/t-ngfEYN/1-after-install --after-remove /tmp/t-ngfEYN/0-after-remove --description '                                       
     GDevelop 5 IDE - the open-source, cross-platform game engine designed for everyone' --version 5.3.180 --package /home/alan/Source/4ian/GDevelop/newIDE/electro
n-app/dist/gdevelop_5.3.180_arm64.deb --name gdevelop --maintainer 'GDevelop Team <hello@gdevelop.io>' --url https://gdevelop.io --vendor 'GDevelop Team <hello@gde
velop.io>' --deb-priority optional --license MIT '/home/alan/Source/4ian/GDevelop/newIDE/electron-app/dist/linux-arm64-unpacked/=/opt/GDevelop 5' /home/alan/Source
/4ian/GDevelop/newIDE/electron-app/dist/.icon-set/icon_16x16.png=/usr/share/icons/hicolor/16x16/apps/gdevelop.png /home/alan/Source/4ian/GDevelop/newIDE/electron-a
pp/dist/.icon-set/icon_32.png=/usr/share/icons/hicolor/32x32/apps/gdevelop.png /home/alan/Source/4ian/GDevelop/newIDE/electron-app/dist/.icon-set/icon_48x48.png=/u
sr/share/icons/hicolor/48x48/apps/gdevelop.png /home/alan/Source/4ian/GDevelop/newIDE/electron-app/dist/.icon-set/icon_64.png=/usr/share/icons/hicolor/64x64/apps/g
develop.png /home/alan/Source/4ian/GDevelop/newIDE/electron-app/dist/.icon-set/icon_128.png=/usr/share/icons/hicolor/128x128/apps/gdevelop.png /home/alan/Source/4i
an/GDevelop/newIDE/electron-app/dist/.icon-set/icon_256.png=/usr/share/icons/hicolor/256x256/apps/gdevelop.png /home/alan/Source/4ian/GDevelop/newIDE/electron-app/
dist/.icon-set/icon_512.png=/usr/share/icons/hicolor/512x512/apps/gdevelop.png /home/alan/Source/4ian/GDevelop/newIDE/electron-app/dist/.icon-set/icon_1024.png=/us
r/share/icons/hicolor/1024x1024/apps/gdevelop.png '/tmp/t-ngfEYN/3-GDevelop 5.desktop=/usr/share/applications/gdevelop.desktop'
                    workingDir=
  ⨯ Cannot cleanup: 

Error #1 --------------------------------------------------------------------------------
Error: /home/alan/Source/4ian/GDevelop/newIDE/electron-app/node_modules/app-builder-bin/linux/arm64/app-builder process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
2
    at ChildProcess.<anonymous> (/home/alan/Source/4ian/GDevelop/newIDE/electron-app/node_modules/builder-util/src/util.ts:250:14)
    at Object.onceWrapper (node:events:628:26)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

Error #2 --------------------------------------------------------------------------------
Error: /home/alan/Source/4ian/GDevelop/newIDE/electron-app/node_modules/app-builder-bin/linux/arm64/app-builder process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
2
    at ChildProcess.<anonymous> (/home/alan/Source/4ian/GDevelop/newIDE/electron-app/node_modules/builder-util/src/util.ts:250:14)
    at Object.onceWrapper (node:events:628:26)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)  failedTask=build stackTrace=Error: Cannot cleanup: 

                                                                                                                                       Error #1 -------------------
-------------------------------------------------------------
Error: /home/alan/Source/4ian/GDevelop/newIDE/electron-app/node_modules/app-builder-bin/linux/arm64/app-builder process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
2
    at ChildProcess.<anonymous> (/home/alan/Source/4ian/GDevelop/newIDE/electron-app/node_modules/builder-util/src/util.ts:250:14)
    at Object.onceWrapper (node:events:628:26)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

                                                                                                                                       Error #2 -------------------
-------------------------------------------------------------
Error: /home/alan/Source/4ian/GDevelop/newIDE/electron-app/node_modules/app-builder-bin/linux/arm64/app-builder process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
2
    at ChildProcess.<anonymous> (/home/alan/Source/4ian/GDevelop/newIDE/electron-app/node_modules/builder-util/src/util.ts:250:14)
    at Object.onceWrapper (node:events:628:26)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
    at throwError (/home/alan/Source/4ian/GDevelop/newIDE/electron-app/node_modules/builder-util/src/asyncTaskManager.ts:88:11)
    at checkErrors (/home/alan/Source/4ian/GDevelop/newIDE/electron-app/node_modules/builder-util/src/asyncTaskManager.ts:53:9)
    at AsyncTaskManager.awaitTasks (/home/alan/Source/4ian/GDevelop/newIDE/electron-app/node_modules/builder-util/src/asyncTaskManager.ts:67:7)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Packager.doBuild (/home/alan/Source/4ian/GDevelop/newIDE/electron-app/node_modules/app-builder-lib/src/packager.ts:453:5)
    at Object.executeFinally (/home/alan/Source/4ian/GDevelop/newIDE/electron-app/node_modules/builder-util/src/promise.ts:12:14)
    at Packager._build (/home/alan/Source/4ian/GDevelop/newIDE/electron-app/node_modules/app-builder-lib/src/packager.ts:376:31)
    at Packager.build (/home/alan/Source/4ian/GDevelop/newIDE/electron-app/node_modules/app-builder-lib/src/packager.ts:337:12)
    at Object.executeFinally (/home/alan/Source/4ian/GDevelop/newIDE/electron-app/node_modules/builder-util/src/promise.ts:12:14)
❌ Electron build failed with code 1.