Zylann / godot_voxel

Voxel module for Godot Engine
MIT License
2.59k stars 244 forks source link

MacOS build of Godot master + Voxel master: Fails while Linux and Windows ones do not because of a number type decrepancy #372

Closed duchainer closed 2 years ago

duchainer commented 2 years ago

I'm currently building some custom Editor builds of:

But the Mac OS version of those is failing on a "size_t is not the same size as uint64_t on Mac OS" it seems, so I'm currently investigating if I can submit a workaround for it today or tomorrow morning: https://github.com/duchainer/godot_voxel It is the exact same godot commit as your latest build: 6184c6a3389feffe52a5ab90c6d58e43f9a1a292 (I took that from here )

Console output $ scons -j4 platform=osx CXX=clang++ osxcross_sdk=darwin20.4 scons: Reading SConscript files ... Building for macOS 10.12+, platform x86_64. Note: Building a debug binary (which will run slowly). Use `target=release_debug` to build an optimized release binary. Checking for C header file mntent.h... (cached) no scons: done reading SConscript files. scons: Building targets ... [ 2%] Compiling platform/osx/os_osx.mm ... [ 2%] Compiling platform/osx/godot_application.mm ... [ 2%] Compiling platform/osx/godot_application_delegate.mm ... [ 2%] Compiling platform/osx/crash_handler_osx.mm ... [ 2%] Compiling platform/osx/osx_terminal_logger.mm ... [ 3%] Building GLES3 GLSL header: "drivers/gles3/shaders/canvas.glsl.gen.h" [ 4%] Building RD_GLSL header: "servers/rendering/renderer_rd/shaders/canvas.glsl.gen.h" [ 6%] Compiling platform/osx/display_server_osx.mm ... [ 6%] Compiling platform/osx/godot_content_view.mm ... [ 6%] Compiling platform/osx/godot_window_delegate.mm ... [ 6%] Compiling platform/osx/godot_window.mm ... [ 6%] Compiling platform/osx/godot_main_osx.mm ... [ 6%] Compiling platform/osx/dir_access_osx.mm ... [ 6%] Compiling platform/osx/joypad_osx.cpp ... [ 6%] Compiling platform/osx/vulkan_context_osx.mm ... [ 6%] Compiling platform/osx/gl_manager_osx_legacy.mm ... [ 9%] Compiling main/main.cpp ... [ 9%] Compiling main/main_timer_sync.cpp ... [ 9%] Compiling main/performance.cpp ... [ 10%] Compiling modules/xatlas_unwrap/register_types.cpp ... [ 10%] Compiling modules/webxr/register_types.cpp ... [ 11%] Linking Static Library modules/libmodule_xatlas_unwrap.osx.tools.64.a ... Ranlib Library modules/libmodule_xatlas_unwrap.osx.tools.64.a ... [ 11%] Compiling modules/webxr/webxr_interface.cpp ... [ 11%] Compiling modules/webxr/webxr_interface_js.cpp ... [ 11%] Compiling modules/websocket/emws_client.cpp ... [ 11%] Compiling modules/websocket/emws_peer.cpp ... [ 11%] Compiling modules/websocket/emws_server.cpp ... [ 11%] Compiling modules/websocket/register_types.cpp ... [ 11%] Compiling modules/websocket/remote_debugger_peer_websocket.cpp ... [ 11%] Linking Static Library modules/libmodule_webxr.osx.tools.64.a ... /mirror/mirror-docker-container/build-tools/osxcross/target/bin/x86_64-apple-darwin20.4-ranlib: file: modules/libmodule_webxr.osx.tools.64.a(webxr_interface_js.osx.tools.64.o) has no symbols Ranlib Library modules/libmodule_webxr.osx.tools.64.a ... /mirror/mirror-docker-container/build-tools/osxcross/target/bin/x86_64-apple-darwin20.4-ranlib: file: modules/libmodule_webxr.osx.tools.64.a(webxr_interface_js.osx.tools.64.o) has no symbols [ 11%] Compiling modules/websocket/websocket_client.cpp ... [ 11%] Linking Static Library main/libmain.osx.tools.64.a ... Ranlib Library main/libmain.osx.tools.64.a ... [ 11%] Compiling modules/websocket/websocket_multiplayer_peer.cpp ... [ 12%] Compiling modules/websocket/websocket_peer.cpp ... [ 12%] Compiling modules/websocket/websocket_server.cpp ... [ 12%] Compiling modules/websocket/wsl_client.cpp ... [ 12%] Compiling modules/websocket/wsl_peer.cpp ... [ 12%] Compiling modules/websocket/wsl_server.cpp ... [ 12%] Compiling modules/websocket/editor/editor_debugger_server_websocket.cpp ... [ 12%] Compiling modules/webrtc/register_types.cpp ... [ 12%] Compiling modules/webrtc/webrtc_data_channel.cpp ... [ 12%] Compiling modules/webrtc/webrtc_data_channel_extension.cpp ... [ 12%] Compiling modules/webrtc/webrtc_data_channel_js.cpp ... [ 12%] Compiling modules/webrtc/webrtc_multiplayer_peer.cpp ... [ 12%] Compiling modules/webrtc/webrtc_peer_connection.cpp ... [ 12%] Compiling modules/webrtc/webrtc_peer_connection_extension.cpp ... [ 12%] Compiling modules/webrtc/webrtc_peer_connection_js.cpp ... [ 17%] Compiling modules/webp/image_loader_webp.cpp ... [ 17%] Compiling modules/webp/register_types.cpp ... [ 17%] Linking Static Library modules/libmodule_webrtc.osx.tools.64.a ... /mirror/mirror-docker-container/build-tools/osxcross/target/bin/x86_64-apple-darwin20.4-ranlib: file: modules/libmodule_webrtc.osx.tools.64.a(webrtc_data_channel_js.osx.tools.64.o) has no symbols /mirror/mirror-docker-container/build-tools/osxcross/target/bin/x86_64-apple-darwin20.4-ranlib: file: modules/libmodule_webrtc.osx.tools.64.a(webrtc_peer_connection_js.osx.tools.64.o) has no symbols Ranlib Library modules/libmodule_webrtc.osx.tools.64.a ... /mirror/mirror-docker-container/build-tools/osxcross/target/bin/x86_64-apple-darwin20.4-ranlib: file: modules/libmodule_webrtc.osx.tools.64.a(webrtc_data_channel_js.osx.tools.64.o) has no symbols /mirror/mirror-docker-container/build-tools/osxcross/target/bin/x86_64-apple-darwin20.4-ranlib: file: modules/libmodule_webrtc.osx.tools.64.a(webrtc_peer_connection_js.osx.tools.64.o) has no symbols [ 20%] Compiling modules/voxel/register_types.cpp ... [ 21%] Linking Static Library modules/libmodule_websocket.osx.tools.64.a ... /mirror/mirror-docker-container/build-tools/osxcross/target/bin/x86_64-apple-darwin20.4-ranlib: file: modules/libmodule_websocket.osx.tools.64.a(emws_client.osx.tools.64.o) has no symbols /mirror/mirror-docker-container/build-tools/osxcross/target/bin/x86_64-apple-darwin20.4-ranlib: file: modules/libmodule_websocket.osx.tools.64.a(emws_peer.osx.tools.64.o) has no symbols /mirror/mirror-docker-container/build-tools/osxcross/target/bin/x86_64-apple-darwin20.4-ranlib: file: modules/libmodule_websocket.osx.tools.64.a(emws_server.osx.tools.64.o) has no symbols Ranlib Library modules/libmodule_websocket.osx.tools.64.a ... /mirror/mirror-docker-container/build-tools/osxcross/target/bin/x86_64-apple-darwin20.4-ranlib: file: modules/libmodule_websocket.osx.tools.64.a(emws_client.osx.tools.64.o) has no symbols /mirror/mirror-docker-container/build-tools/osxcross/target/bin/x86_64-apple-darwin20.4-ranlib: file: modules/libmodule_websocket.osx.tools.64.a(emws_peer.osx.tools.64.o) has no symbols /mirror/mirror-docker-container/build-tools/osxcross/target/bin/x86_64-apple-darwin20.4-ranlib: file: modules/libmodule_websocket.osx.tools.64.a(emws_server.osx.tools.64.o) has no symbols [ 21%] Compiling modules/voxel/constants/cube_tables.cpp ... [ 21%] Compiling modules/voxel/constants/voxel_string_names.cpp ... [ 21%] Linking Static Library modules/libmodule_webp.osx.tools.64.a ... Ranlib Library modules/libmodule_webp.osx.tools.64.a ... [ 21%] Compiling modules/voxel/meshers/blocky/voxel_blocky_library.cpp ... [ 21%] Compiling modules/voxel/meshers/blocky/voxel_blocky_model.cpp ... [ 21%] Compiling modules/voxel/meshers/blocky/voxel_mesher_blocky.cpp ... [ 21%] Compiling modules/voxel/meshers/transvoxel/transvoxel.cpp ... [ 21%] Compiling modules/voxel/meshers/transvoxel/voxel_mesher_transvoxel.cpp ... [ 21%] Compiling modules/voxel/meshers/dmc/mesh_builder.cpp ... [ 21%] Compiling modules/voxel/meshers/dmc/voxel_mesher_dmc.cpp ... [ 21%] Compiling modules/voxel/meshers/cubes/voxel_color_palette.cpp ... [ 21%] Compiling modules/voxel/meshers/cubes/voxel_mesher_cubes.cpp ... [ 21%] Compiling modules/voxel/meshers/voxel_mesher.cpp ... [ 21%] Compiling modules/voxel/streams/file_utils.cpp ... [ 21%] Compiling modules/voxel/streams/instance_data.cpp ... [ 21%] Compiling modules/voxel/streams/vox_data.cpp ... [ 21%] Compiling modules/voxel/streams/vox_loader.cpp ... [ 21%] Compiling modules/voxel/streams/voxel_block_serializer.cpp ... [ 21%] Compiling modules/voxel/streams/voxel_block_serializer_gd.cpp ... [ 21%] Compiling modules/voxel/streams/voxel_stream.cpp ... modules/voxel/streams/voxel_block_serializer.cpp:183:65: error: non-const lvalue reference to type 'uint64_t' (aka 'unsigned long long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned long') ZN_ASSERT_RETURN_V(custom->deserialize(mr.data.sub(mr.pos), read_size), false); ^~~~~~~~~ modules/voxel/streams/../storage/../util/math/../errors.h:56:65: note: expanded from macro 'ZN_ASSERT_RETURN_V' #define ZN_ASSERT_RETURN_V(cond, retval) ZN_INTERNAL_ASSERT_ACT(cond, return retval, "") ^~~~ modules/voxel/streams/../storage/../util/math/../errors.h:48:20: note: expanded from macro 'ZN_INTERNAL_ASSERT_ACT' if (ZN_UNLIKELY(!(cond))) { \ ^~~~ modules/voxel/streams/../storage/../util/math/../errors.h:10:44: note: expanded from macro 'ZN_UNLIKELY' #define ZN_UNLIKELY(x) __builtin_expect(!!(x), 0) ^ modules/voxel/streams/../storage/voxel_metadata.h:30:62: note: passing argument to parameter 'out_read_size' here virtual bool deserialize(Span src, uint64_t &out_read_size) = 0; ^ 1 error generated. scons: *** [modules/voxel/streams/voxel_block_serializer.osx.tools.64.o] Error 1 scons: building terminated because of errors. [Time elapsed: 00:00:57.388]
Zylann commented 2 years ago

Are you doing a 32-bit build? It's not really supported. But otherwise this error has been a curse for a while, as almost everytime there is no problem in passing a size_t to a uint64_t... especially when doing a 64-bit build (the only one really supported) where the types are basically identical, more pedantic you die :(

type 'uint64_t' (aka 'unsigned long long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned long')

I'm puzzled. But the passing by reference seems to be the problem, since the types are "different", in principle. These choices of integer types are confusing.

duchainer commented 2 years ago

I'm doing a 64-bit build, but changing the type of read_size to uint64_t seems to fix it, :crossed_fingers: Currently trying again the Mac build, but it continued past the 21% mark (currently at 72%)

duchainer commented 2 years ago

If that fixes it completely and both my Linux and Windows build work regardless, I'll be submitting a PR. ^^

duchainer commented 2 years ago

What surprises me the most is that it was the only issue I've come across since. I don't think that this is the only usage of size_t in the code but haven't had any more warning in the logs yet.

EDIT: 205 references to uint64_t VS 1139 references to size_t but a single implicit casting, that's a good surprise in that case :+1: image image

duchainer commented 2 years ago

Ok that fixes the mac issue at least until the linking step (seems I was missing some additional flags for that specific step :sweat_smile: )