HaxeFoundation / hxcpp

Runtime files for c++ backend for haxe
Other
298 stars 191 forks source link

Error when building snow example #468

Closed thealgebraist closed 7 years ago

thealgebraist commented 8 years ago

Hi

I am trying to compile this snow example:

emptysample

With the newest git version of haxe and hxcpp.

When running:

flow build mac

I get the following error when compiling:


Error: While running :g++ -I/Users/dev/projects/haxelib/snow/git/samples/empty/bin/mac64.build/cpp/obj/darwin64/__pch/haxe -Iinclude -I/Users/dev/projects/haxelib/linc_ogg/git//lib/ -I/Users/dev/projects/haxelib/linc_ogg/git//linc/ -I/Users/dev/projects/haxelib/linc_ogg/git//lib//ogg/include/ -I/Users/dev/projects/haxelib/linc_ogg/git//lib//vorbis/include/ -I/Users/dev/projects/haxelib/linc_ogg/git//lib//theora/include/ -DNATIVE_TOOLKIT_OGG -DNATIVE_TOOLKIT_VORBIS -DNATIVE_TOOLKIT_THEORA -DLINC_OPENAL -I/Users/dev/projects/haxelib/linc_openal/git//linc/ -I/Users/dev/projects/haxelib/linc_opengl/git//linc/ -I/Users/dev/projects/haxelib/linc_opengl/git//lib/glew/include/ -DLINC_OPENGL_GLEW -DGLEW_STATIC -DLINC_SDL -I/Users/dev/projects/haxelib/linc_sdl/git//linc/ -I/Users/dev/projects/haxelib/linc_sdl/git//lib/sdl/include/ -I/Users/dev/projects/haxelib/linc_sdl/git//lib/sdl/include/configs/mac/ -DHAVE_LIBC -DNATIVE_TOOLKIT_SDL -I/Users/dev/projects/haxelib/linc_stb/git//lib/ -I/Users/dev/projects/haxelib/linc_stb/git//linc/ -I/Users/dev/projects/haxelib/linc_timestamp/git//linc/ -c -fvisibility=hidden -stdlib=libstdc++ -O2 -I/Users/dev/projects/haxelib/hxcpp/git/include -DHX_MACOS -m64 -Wno-parentheses -Wno-unused-value -Wno-format-extra-args -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=330 -x c++ -frtti -Wno-invalid-offsetof ./src/snow/modules/sdl/Runtime.cpp -o/Users/dev/projects/haxelib/snow/git/samples/empty/bin/mac64.build/cpp/obj/darwin64/475ff0c0_Runtime.o
./src/snow/modules/sdl/Runtime.cpp:525:16: error: no matching function for call to 'SDL_GL_SetAttribute'
HXDLIN( 380)                    SDL_GL_SetAttribute(_hx_tmp,value);
                                ^~~~~~~~~~~~~~~~~~~
/Users/dev/projects/haxelib/linc_sdl/git//lib/sdl/include/SDL_video.h:999:29: note: candidate function not viable: no known conversion from 'Int' (aka 'int') to 'SDL_GLattr' for 1st argument
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
                            ^
./src/snow/modules/sdl/Runtime.cpp:530:16: error: no matching function for call to 'SDL_GL_SetAttribute'
HXDLIN( 381)                    SDL_GL_SetAttribute(_hx_tmp1,value1);
                                ^~~~~~~~~~~~~~~~~~~
/Users/dev/projects/haxelib/linc_sdl/git//lib/sdl/include/SDL_video.h:999:29: note: candidate function not viable: no known conversion from 'Int' (aka 'int') to 'SDL_GLattr' for 1st argument
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
                            ^
...

Do you have an idea what is causing this ?

hughsando commented 8 years ago

This is caused by passing an int where an enum is expected. It looks like the haxe compiler has created a tmp variable, which may have disrupted some of the wrapping logic. We will need to sort out a more robust "best practice" here.

On Fri, Jun 10, 2016 at 11:28 PM, The Algebraist notifications@github.com wrote:

Hi

I am trying to compile this snow example:

emptysample https://github.com/underscorediscovery/snow/tree/master/samples/empty

With the newest git version of haxe and hxcpp.

When running:

flow build mac

I get the following error when compiling:

Error: While running :g++ -I/Users/dev/projects/haxelib/snow/git/samples/empty/bin/mac64.build/cpp/obj/darwin64/__pch/haxe -Iinclude -I/Users/dev/projects/haxelib/linc_ogg/git//lib/ -I/Users/dev/projects/haxelib/linc_ogg/git//linc/ -I/Users/dev/projects/haxelib/linc_ogg/git//lib//ogg/include/ -I/Users/dev/projects/haxelib/linc_ogg/git//lib//vorbis/include/ -I/Users/dev/projects/haxelib/linc_ogg/git//lib//theora/include/ -DNATIVE_TOOLKIT_OGG -DNATIVE_TOOLKIT_VORBIS -DNATIVE_TOOLKIT_THEORA -DLINC_OPENAL -I/Users/dev/projects/haxelib/linc_openal/git//linc/ -I/Users/dev/projects/haxelib/linc_opengl/git//linc/ -I/Users/dev/projects/haxelib/linc_opengl/git//lib/glew/include/ -DLINC_OPENGL_GLEW -DGLEW_STATIC -DLINC_SDL -I/Users/dev/projects/haxelib/linc_sdl/git//linc/ -I/Users/dev/projects/haxelib/linc_sdl/git//lib/sdl/include/ -I/Users/dev/projects/haxelib/linc_sdl/git//lib/sdl/include/configs/mac/ -DHAVE_LIBC -DNATIVE_TOOLKIT_SDL -I/Users/dev/projects/haxelib/linc_stb/git//lib/ -I/Users/d ev/projects/haxelib/linc_stb/git//linc/ -I/Users/dev/projects/haxelib/linc_timestamp/git//linc/ -c -fvisibility=hidden -stdlib=libstdc++ -O2 -I/Users/dev/projects/haxelib/hxcpp/git/include -DHX_MACOS -m64 -Wno-parentheses -Wno-unused-value -Wno-format-extra-args -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=330 -x c++ -frtti -Wno-invalid-offsetof ./src/snow/modules/sdl/Runtime.cpp -o/Users/dev/projects/haxelib/snow/git/samples/empty/bin/mac64.build/cpp/obj/darwin64/475ff0c0_Runtime.o ./src/snow/modules/sdl/Runtime.cpp:525:16: error: no matching function for call to 'SDL_GL_SetAttribute' HXDLIN( 380) SDL_GL_SetAttribute(_hx_tmp,value); ^~~~~~~ /Users/dev/projects/haxelib/linc_sdl/git//lib/sdl/include/SDL_video.h:999:29: note: candidate function not viable: no known conversion from 'Int' (aka 'int') to 'SDL_GLattr' for 1st argument extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); ^ ./src/snow/modules/sdl/Runtime.cpp:530:16: error: no matching function for call to 'SDL_GL_SetAttribute' HXDLIN( 381) SDL_GL_SetAttribute(_hx_tmp1,value1); ^~~~~~~ /Users/dev/projects/haxelib/linc_sdl/git//lib/sdl/include/SDL_video.h:999:29: note: candidate function not viable: no known conversion from 'Int' (aka 'int') to 'SDL_GLattr' for 1st argument extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); ^ ...

Do you have an idea what is causing this ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/HaxeFoundation/hxcpp/issues/468, or mute the thread https://github.com/notifications/unsubscribe/ABlp1rcJF1h4LmTDoEcrWXCepWKqnyHMks5qKYKfgaJpZM4IzD8x .

hughsando commented 8 years ago

I think this is going to need a change go the the linc_sdl code. Instead of basing the SDLGLAttr abstract on "Int", you can base it on something like:

@:native("cpp::Struct<SDLGLAttr, cpp::EnumHandler>")
extern class SDLGLAttrImpl { }

This should keep it correctly typed the whole way through. See https://github.com/HaxeFoundation/hxcpp/blob/master/test/native/tests/TestNativeEnum.hx for some more examples.

kevinresol commented 8 years ago

I am building a luxe app for android when I got this error:

 - Compile : src/snow/systems/io/IO.cpp
Error: While running :arm-linux-androideabi-g++ -I/Users/kevin/Codes/qanda/bin/android.build/cpp/obj/android-v7/__pch/haxe -Iinclude -I/Users/kevin/Development/haxelib/linc_ogg/git//lib/ -I/Users/kevin/Development/haxelib/linc_ogg/git//linc/ -I/Users/kevin/Development/haxelib/linc_ogg/git//lib//ogg/include/ -I/Users/kevin/Development/haxelib/linc_ogg/git//lib//vorbis/include/ -I/Users/kevin/Development/haxelib/linc_ogg/git//lib//theora/include/ -DNATIVE_TOOLKIT_OGG -DNATIVE_TOOLKIT_VORBIS -DNATIVE_TOOLKIT_THEORA -DLINC_OPENAL -I/Users/kevin/Development/haxelib/linc_openal/git//linc/ -I/Users/kevin/Development/haxelib/linc_opengl/git//linc/ -I/Users/kevin/Development/haxelib/linc_opengl/git//lib/glew/include/ -DLINC_SDL -DLINC_SDL_WITH_SDL_MAIN -I/Users/kevin/Development/haxelib/linc_sdl/git//linc/ -I/Users/kevin/Development/haxelib/linc_sdl/git//lib/sdl/include/ -I/Users/kevin/Development/haxelib/linc_sdl/git//lib/sdl/include/configs/default/ -DHAVE_LIBC -DNATIVE_TOOLKIT_SDL -I/Users/kevin/Development/haxelib/linc_stb/git//lib/ -I/Users/kevin/Development/haxelib/linc_stb/git//linc/ -I/Users/kevin/Development/haxelib/linc_timestamp/git//linc/ --sysroot=/usr/local/Cellar/android-ndk/r11c/platforms/android-24/arch-arm -I/usr/local/Cellar/android-ndk/r11c/sources/cxx-stl/gnu-libstdc++/4.9/include -I/usr/local/Cellar/android-ndk/r11c/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=330 -I/Users/kevin/Development/haxelib/hxcpp/3,3,49/include -Iinclude -fpic -fvisibility=hidden -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums "-D_LINUX_STDDEF_H " -Wno-psabi -DHXCPP_CPP11 -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -fomit-frame-pointer -fexceptions -fno-strict-aliasing -finline-limit=10000 -DANDROID=ANDROID -DHX_ANDROID -DHXCPP_ANDROID_PLATFORM=24 -Wa,--noexecstack -O2 -DNDEBUG -c -x c++ -Wno-invalid-offsetof -frtti -std=c++11 ./src/snow/systems/io/IO.cpp -o/Users/kevin/Codes/qanda/bin/android.build/cpp/obj/android-v7/6547d2c7_IO.obj
In file included from include/snow/core/native/io/IO.h:12:0,
                 from ./src/snow/systems/io/IO.cpp:44:
/Users/kevin/Development/haxelib/linc_sdl/git//linc/linc_sdl.h:6:19: fatal error: /Users/kevin/Codes/qanda/bin/android.build/cpp/obj/android-v7/__pch/haxe/hxcpp.h: No such file or directory
 #include <hxcpp.h>
                   ^
compilation terminated.
flow / 
 build - stopping because of errors in hxcpp compile, while building arch armv7 

I think there is some misconfiguration causing the compiler can't find the header file? (haxe 3.3.0-rc1, hxcpp: 3.3.49)

hughsando commented 8 years ago

This one is to do with pre-compiled headers, see: https://github.com/underscorediscovery/luxe/issues/385