godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.14k stars 20.21k forks source link

Master branch fails to link on Mac M1 after commit 0a24f1d #82372

Closed bferguson3 closed 11 months ago

bferguson3 commented 12 months ago

Godot version

Master https://github.com/godotengine/godot/commit/0a24f1d

System information

osx 13.6 / Apple Silicon M1 Macbook Air 2021

Issue description

godot-build-master.txt Sorry for opening another issue but I could not re-open the last one.

This time I saved the entire build process from a clean pull. Note that this line indicates architecture and target are successfully detected, and all actual compilation works: Building for platform "macos", architecture "arm64", target "editor".

I dont know enough about the codebase to research this, but it looks like possibly just a missing file or folder or two in the build scripts.

Steps to reproduce

  1. On an M1 Mac fully updated, pull master
  2. Build with scons

Minimal reproduction project

N/A

bferguson3 commented 12 months ago

Oh, here it is:

ld: warning: ignoring file modules/libmodule_msdfgen.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodules.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file main/libmain.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_ktx.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_basis_universal.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_vorbis.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_astcenc.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_bmp.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_dds.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_theora.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_freetype.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_csg.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_camera.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_etcpak.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_hdr.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_glslang.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_jpg.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_jsonrpc.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_cvtt.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_meshoptimizer.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_mobile_vr.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_enet.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_multiplayer.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_navigation.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_minimp3.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_lightmapper_rd.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_ogg.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_gridmap.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_openxr.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_noise.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_squish.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_regex.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_tga.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_tinyexr.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_upnp.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_svg.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_mbedtls.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_webp.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/libmodule_gdscript.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_vhacd.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_webxr.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_webrtc.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_websocket.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_xatlas_unwrap.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_zip.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_raycast.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_gltf.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file platform/libplatform.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/libmodule_text_server_adv.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/text_server_adv/libharfbuzz_builtin.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file core/libcore.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/text_server_adv/libicu_builtin.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file modules/text_server_adv/libgraphite_builtin.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file drivers/libdrivers.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/msdfgen/libmsdfgen_builtin.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file modules/freetype/libfreetype_builtin.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file scene/libscene.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file servers/libservers.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file editor/libeditor.macos.editor.arm64.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
YuriSizov commented 12 months ago

cc @bruvzg

bruvzg commented 12 months ago

Probably files from the old build before compiler detection fix. Try a cleaning up the build tree.

bferguson3 commented 12 months ago

@bruvzg I think that was directed to me? This was from a clean pull this morning after the fix. I totally deleted the folder.

bferguson3 commented 11 months ago

I have tried to do some more research but keep hitting dead ends.

  1. Fully upgraded everything in homebrew. Reinstalled XCode. Deleted and pulled clean from Github several times.
  2. I noticed that only 'python' is called in the build scripts. By default 'python' is Python 2 and 'python3' is Python 3 on later MacOS. Changing this and adding an alias to 'python3' did not fix the linking issues.
  3. Recently MacOS changed libstdc++ to libc++. Changing this also did not fix the linking issues.

Of note, the linker is identifying the object files correctly and matched, but still won't link. What, too does the -s parameter mean, and why would it be ignored?

alxyng commented 11 months ago

4.1.1-stable and master fail to link on my machine too. I compiled 4.1.1-stable fine just a couple of weeks ago. It could have been an xcode update that caused this. This is the error from a get a clean build (git clean -fdx) that i've run a second time for brevity:

➜  godot git:(4.1.1-stable) scons -j8 platform=macos arch=arm64
scons: Reading SConscript files ...
Building for macOS 11.0+.
MoltenVK found at: /Users/alex/VulkanSDK/1.3.261.1/MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/
Building for platform "macos", architecture "arm64", target "editor".
Checking for C header file mntent.h... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
[ 96%] Linking Program bin/godot.macos.editor.arm64 ...
[ 99%] progress_finish(["progress_finish"], [])
[100%] 0  0x100fe3648  __assert_rtn + 72
1  0x100f0bc5c  ld::Fixup::applyFixup(ld::Atom const*, ld::LayoutLinkedImage const&, unsigned char*) const + 8268
2  0x100f9e7d8  ___ZN2ld16LayoutExecutable27writeContentWithoutLinkEditENSt3__14spanIhLm18446744073709551615EEEy_block_invoke + 332
3  0x18e999950  _dispatch_client_callout2 + 20
4  0x18e9acba0  _dispatch_apply_invoke + 176
5  0x18e999910  _dispatch_client_callout + 20
6  0x18e9ab3cc  _dispatch_root_queue_drain + 864
7  0x18e9aba04  _dispatch_worker_thread2 + 156
8  0x18eb430d8  _pthread_wqthread + 228
ld: Assertion failed: (extras.otherInstrOffset != 0 && "Kind::arm64_adrp_ldr missing extra info"), function applyFixup, file Fixup.cpp, line 793.
clang: error: linker command failed with exit code 1 (use -v to see invocation)
scons: *** [bin/godot.macos.editor.arm64] Error 1
scons: building terminated because of errors.
[Time elapsed: 00:00:14.486]
➜  godot git:(4.1.1-stable) clang -v
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
bferguson3 commented 11 months ago

I have tried to do some more research but keep hitting dead ends.

1. Fully upgraded everything in homebrew. Reinstalled XCode. Deleted and pulled clean from Github several times.

2. I noticed that only 'python' is called in the build scripts. By default 'python' is Python 2 and 'python3' is Python 3 on later MacOS. Changing this and adding an alias to 'python3' did not fix the linking issues.

3. Recently MacOS changed `libstdc++` to `libc++`. Changing this also did not fix the linking issues.

Of note, the linker is identifying the object files correctly and matched, but still won't link. What, too does the -s parameter mean, and why would it be ignored?

@MarioLiebisch Pinging you here in case any of this looks familiar to you. Notably the MacOS/brew change of "python" to "python3" and "libstdc++" to "libc++". I also have quite a few versions of Python installed thanks to all the build systems on this PC.

MarioLiebisch commented 11 months ago

Hm, nope, that sounds really confusing. Have you tried to go through some simple Scons project/tutorial and see if that builds? I don't think this is python/python3 related

Did a quick Google search on building for macOS-arm64 but attempting to link with file built for macOS-arm64 and it seems as there's some incompatibility between Apple's Clang and GCC's ar tool. Do you have binutils installed (through brew)? Can you uninstall them and try again?

I have a MacMini here, but I'd first have to get the last 6-12 months of updates etc. and that will take, plus it's still an Intel. 😉

bruvzg commented 11 months ago

4.1.1-stable and master fail to link on my machine too.

I can't reproduce any issue with the current master. For 4.1.1-stable, this is expected since it does not include a fix for Xcode 15 build.

Notably the MacOS/brew change of "python" to "python3" and "libstdc++" to "libc++".

The only things except Xcode you need are Python 3.6+, SCons and Vulkan SDK.

building for macOS-arm64 but attempting to link with file built for macOS-arm64

I have only seen errors like this when iOS device and simulator object files are mixed up, your build environment might be configured to use C/C++ compiler other than Xcode clang.

bferguson3 commented 11 months ago

@MarioLiebisch @bruvzg Someone else on Discord had the same issue. He recommended trying again this morning. Well, I uninstalled homebrew version of binutils, deleted and cloned again and it worked.

Thanks to both of you for looking into this :)