voxelgame icon indicating copy to clipboard operation
voxelgame copied to clipboard

OSX build errors (branch deps?)

Open paulicka opened this issue 5 years ago • 9 comments

The README.md and 02_build-voxel-tools.md says to build godot_voxel module with same branch as godot. However, godot master is now 4.0 I believe. I built godot branch 3.2 and ran the executable on some sample projects without problems. All good. I then moved godot_voxel into modules/, renaming to modules/voxel/, and tried to build and get errors:

Christophers-iMac:godot christopherpaulicka$ scons platform=osx arch=x86_64 --jobs=$(sysctl -n hw.logicalcpu)
scons: Reading SConscript files ...
Building for macOS 10.9+, platform x86-64.
Checking for C header file mntent.h... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
[ 33%] Compiling ==> modules/voxel/streams/voxel_block_serializer.cpp
[ 33%] Compiling ==> modules/voxel/generators/graph/voxel_graph_runtime.cpp
[ 33%] Compiling ==> modules/voxel/terrain/voxel_lod_terrain.cpp
[ 33%] Compiling ==> modules/voxel/terrain/voxel_map.cpp
modules/voxel/streams/voxel_block_serializer.cpp:101:21: error: conversion from
      'const size_t' (aka 'const unsigned long') to 'const Variant' is ambiguous
                                        .format(varray(metadata_size, (i...
                                                       ^~~~~~~~~~~~~
./core/error_macros.h:314:115: note: expanded from macro 'CRASH_COND_MSG'
  ..."FATAL: Condition \"" _STR(m_cond) "\" is true.", DEBUG_STR(m_msg)); \
                                                                 ^~~~~
./core/error_macros.h:116:26: note: expanded from macro 'DEBUG_STR'
#define DEBUG_STR(m_msg) m_msg
                         ^~~~~
./core/variant.h:251:2: note: candidate constructor
        Variant(bool p_bool);
        ^
./core/variant.h:252:2: note: candidate constructor
        Variant(signed int p_int); // real one
        ^
./core/variant.h:253:2: note: candidate constructor
        Variant(unsigned int p_int);
        ^
./core/variant.h:259:2: note: candidate constructor
        Variant(signed short p_short); // real one
        ^
./core/variant.h:260:2: note: candidate constructor
        Variant(unsigned short p_short);
        ^
./core/variant.h:261:2: note: candidate constructor
        Variant(signed char p_char); // real one
        ^
./core/variant.h:262:2: note: candidate constructor
        Variant(unsigned char p_char);
        ^
./core/variant.h:263:2: note: candidate constructor
        Variant(int64_t p_int); // real one
        ^
./core/variant.h:264:2: note: candidate constructor
        Variant(uint64_t p_int);
        ^
./core/variant.h:265:2: note: candidate constructor
        Variant(float p_float);
        ^
./core/variant.h:266:2: note: candidate constructor
        Variant(double p_double);
        ^
1 error generated.
scons: *** [modules/voxel/streams/voxel_block_serializer.osx.tools.x86_64.o] Error 1
modules/voxel/generators/graph/voxel_graph_runtime.cpp:477:40: error: 
      conversion from 'unsigned long' to 'const Variant' is ambiguous
  ....format(varray(_program.size() * sizeof(float), _memory.size() * sizeof(...
                    ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
modules/voxel/generators/graph/../../util/macros.h:10:14: note: expanded from
      macro 'PRINT_VERBOSE'
                print_line(msg);                            \
                           ^~~
./core/variant.h:251:2: note: candidate constructor
        Variant(bool p_bool);
        ^
./core/variant.h:252:2: note: candidate constructor
        Variant(signed int p_int); // real one
        ^
./core/variant.h:253:2: note: candidate constructor
        Variant(unsigned int p_int);
        ^
./core/variant.h:259:2: note: candidate constructor
        Variant(signed short p_short); // real one
        ^
./core/variant.h:260:2: note: candidate constructor
        Variant(unsigned short p_short);
        ^
./core/variant.h:261:2: note: candidate constructor
        Variant(signed char p_char); // real one
        ^
./core/variant.h:262:2: note: candidate constructor
        Variant(unsigned char p_char);
        ^
./core/variant.h:263:2: note: candidate constructor
        Variant(int64_t p_int); // real one
        ^
./core/variant.h:264:2: note: candidate constructor
        Variant(uint64_t p_int);
        ^
./core/variant.h:265:2: note: candidate constructor
        Variant(float p_float);
        ^
./core/variant.h:266:2: note: candidate constructor
        Variant(double p_double);
        ^
1 error generated.
scons: *** [modules/voxel/generators/graph/voxel_graph_runtime.osx.tools.x86_64.o] Error 1
scons: building terminated because of errors.

I tried building from godot master, but that didn't work either.

Any thoughts?

paulicka avatar Aug 24 '20 03:08 paulicka

Build only with Godot 3.2. Godot 4 isn't anywhere close to stable or complete, and voxel tools doesn't support it yet.

TokisanGames avatar Aug 24 '20 04:08 TokisanGames

Thanks, @tinmanjuggernaut...I tried that and it didn't work: godot 3.2 and godot_voxel master. I made sure to update to latest XCode, same errors. (Heh...I went to verify on Windows yet can't even get godot 3.2 to build using scoop libraries...)

paulicka avatar Aug 24 '20 08:08 paulicka

I bet you're using clang? People have reported problems several times when trying to pass uint64_t or size_t to Variant on OSX and Javascript builds, it is quite infuriating https://github.com/Zylann/godot_voxel/issues/170

One dumb fix is to cast to int I guess, but it's not clean, I wonder what the correct fix should be.

Zylann avatar Aug 24 '20 11:08 Zylann

My mistake. I misunderstood. Zylann must have introduced code that clang has a problem with. He or you will have to make the casting explicit to build. Or you can try my older osx binaries at tokisan.com.

TokisanGames avatar Aug 24 '20 11:08 TokisanGames

@Zylann I'm not sure if I am using clang...how do I check? I followed the build directions on Compiling for mac OS using 'brew'. Or perhaps, more importantly, how do I use something else that works? ;-)

@tinmanjuggernaut I was building from source because I tried to run blocky_game/blocky_game.tscn and got Invalid call. Nonexistent function 'get_voxel_index_from_name' in base 'VoxelLibrary'. Perhaps you could make a new binary? ;-)

Thanks for the quick feedback.

paulicka avatar Aug 24 '20 16:08 paulicka

@tinmanjuggernaut in case you do make a new build, it's going to be marked as the 3.2.3 version (currently master), as I made a changelog to reflect what's in each version https://github.com/Zylann/godot_voxel/blob/master/CHANGELOG.md#master-godot-323 . I'm going to make a branch to tag it in the Git history as well based on the current last commit

@paulicka I don't know^^" OSX uses clang AFAIK, I wish there was a proper fix than casting all the problematic variant conversions to int

Zylann avatar Aug 24 '20 17:08 Zylann

@Zylann I'm not sure if I am using clang...how do I check? I followed the build directions on Compiling for mac OS using 'brew'.

Brew is a package manager, not a compiler. Read your build log. It will tell you what compiler its using. Or look in your package manager and see what compilers are installed. Clang/llvm is usually the default.

@tinmanjuggernaut I was building from source because I tried to run blocky_game/blocky_game.tscn and got Invalid call. Nonexistent function 'get_voxel_index_from_name' in base 'VoxelLibrary'. Perhaps you could make a new binary? ;-)

You can edit the gdscript to comment out that line. Or use my demos, which work with my build. Seems like a lot of work to avoid a few lines of gdscript in a demo.

TokisanGames avatar Aug 24 '20 17:08 TokisanGames

Okey dokey...3 lines with some casts to int and it builds (and runs blocky game ;-) for me.

@tinmanjuggernaut Do you want the binary?

(I tried adding env.Append(CPPDEFINES = ['NEED_LONG_INT']) to platform/osx/SCsub but that didn't work, so I'm not sure if a) I'm defining the flag incorrectly, or b) NEED_LONG_INT doesn't solve the problem, and c) I couldn't figure out a way to debug that easily)

@Zylann Should I add an addendum to Issue 170 (since it only mentions javascript), and/or keep this open until it's fixed in master?

paulicka avatar Aug 24 '20 18:08 paulicka

@Zylann Should I add an addendum to Issue 170 (since it only mentions javascript), and/or keep this open until it's fixed in master?

Probably. I still haven't got an answer from Godot devs about this...

Zylann avatar Aug 24 '20 19:08 Zylann