itfrombit / osx_handmade

OS X port of Handmade Hero
152 stars 18 forks source link

Unable to load renderer. #9

Closed JimmyDeemo closed 4 years ago

JimmyDeemo commented 4 years ago

I wondered if someone could help me get this compiling. When I run make full I get the following output:

▶ make full
rm -rf *.o *.dylib libhandmade.dylib libhandmade_opengl.dylib handmade test_png hhaedit HandmadeTabView HandmadeRendererTest Contents Handmade.app HandmadeTabView.app HandmadeRendererTest.app osx_hhfont *.dSYM
rm -f libhandmade.dylib
clang -O2 -Wall -DOSX_HANDMADE_USE_METAL=0 -DHANDMADE_USE_VSYNC=0 -DHANDMADE_PROFILE=1 -DHANDMADE_INTERNAL=1 -DHANDMADE_SLOW=1 -DHANDMADE_OSX=1 -fno-exceptions -fno-rtti -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-variable -Wno-c++11-narrowing -Wno-missing-braces -Wno-logical-not-parentheses -Wno-switch -Wno-write-strings -Wno-c++11-compat-deprecated-writable-strings -Wno-tautological-compare -Wno-missing-braces -Wno-null-dereference -Wno-writable-strings -std=c++11 -stdlib=libc++ -ggdb -dynamiclib -o libhandmade.dylib ../cpp/code/handmade.cpp
In file included from ../cpp/code/handmade.cpp:33:
../cpp/code/handmade_world_mode.cpp:537:30: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
    if(Input->FKeyPressed[9] || 1)
                             ^  ~
../cpp/code/handmade_world_mode.cpp:537:30: note: use '|' for a bitwise operation
    if(Input->FKeyPressed[9] || 1)
                             ^~
                             |
1 warning generated.
rm -f ./handmade
clang -O2 -Wall -DOSX_HANDMADE_USE_METAL=0 -DHANDMADE_USE_VSYNC=0 -DHANDMADE_PROFILE=1 -DHANDMADE_INTERNAL=1 -DHANDMADE_SLOW=1 -DHANDMADE_OSX=1 -std=c++11 -stdlib=libc++ -ggdb -I../cpp/code -fno-exceptions -fno-rtti -Wno-writable-strings -Wno-deprecated-declarations -Wno-null-dereference -Wno-c++11-compat-deprecated-writable-strings -Wno-unused-function -Wno-unused-variable -Wno-missing-braces -lstdc++ -framework Cocoa -framework IOKit -framework AudioUnit -o handmade osx_main.mm
In file included from osx_main.mm:41:
In file included from ../cpp/code/handmade_platform.h:29:
../cpp/code/handmade_types.h:104:9: warning: 'U64Max' macro redefined [-Wmacro-redefined]
#define U64Max ((u64)-1)
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Math64.h:715:13: note: 
      previous definition is here
    #define U64Max() (0xffffffffffffffffULL)
            ^
1 warning generated.
# The 'local' bundle for convenient debugging with lldb
mkdir -p ./Contents/MacOS
mkdir -p ./Contents/Resources
mkdir -p ./Contents/Resources/data
mkdir -p ./Contents/Resources/debug
cp -R ../tags ./Contents/Resources
cp -R ../sources ./Contents/Resources
# Uncomment the following 4 lines to use our own generated fonts
# cp osx_fonts/liberation_mono* ./Contents/Resources/sources/base_game/fonts
# mkdir -p ./Contents/Resources/tags/fonts
# cp LiberationMono.hht ./Contents/Resources/tags/fonts/
#cp Monaco.hht ./Contents/Resources/tags/fonts/
#
#cp /testfonts_v2.hha ./Contents/Resources/data/testfonts_v2.hha
#cp /intro_art_v2.hha ./Contents/Resources/data/intro_art_v2.hha
#cp ../art/*.png ./Contents/Resources/art
cp libhandmade.dylib ./Contents/MacOS/libhandmade.dylib
cp libhandmade_opengl.dylib ./Contents/MacOS/libhandmade_opengl.dylib
cp: libhandmade_opengl.dylib: No such file or directory
make: *** [package] Error 1

Which implies that there is a problem with an OpenGl file. When I run the game (./handmade as suggested) then I get the following error.

image

Here is what I have done;

Following this, calls to make without arguments complain about a lock.tmp file. I am able to run make libhandmade_opengl.dylib without issue, but it doesn't seem to help. I can also make HandmadeRendererTest which will run but the graphics are all a bit messed up.

I'm on a Macbook Pro with with Catalina 10.15.6 (19G2021), my version of Clang is 11.0.3 (clang-1103.0.32.62). Any help with what I might be doing wrong would be much appreciated.

itfrombit commented 4 years ago

Sorry about the error!

I was refactoring the Makefile when I started working on the Metal port and I accidentally checked in a half-cooked version. I just committed an update to the Makefile that should fix the problem.

Let me know if you have any more issues and thanks for the detailed bug report!

-Jeff

JimmyDeemo commented 4 years ago

make full works just fine now, so thanks for the fix.

No worries about the report; I always appreciate a good log when fixing something. Thank you for taking the time to do the OSX port. I've only just started on the handmade journey but this will be incredibly helpful. 👍