snowkit / snow

A low level cross platform framework for Haxe. Mac, Windows, Linux, Android, iOS, WebGL.
http://snowkit.org/snow
MIT License
133 stars 35 forks source link

Cannot build on OS X 'linc_glew.h' file not found #94

Closed samw3 closed 8 years ago

samw3 commented 8 years ago

This is my first time setting up flow/snow.

I first installed flow:

haxelib git flow https://github.com/underscorediscovery/flow.git
cat > /usr/local/bin/flow <<EOF
#!/bin/sh
haxelib run flow \$@
EOF
chmod +x /usr/local/bin/flow

I then installed snow:

haxelib install snowfall
haxelib run snowfall update snow

I have a very simple Main.hx

import snow.Snow;
import snow.types.Types;
import snow.api.Debug.*;

typedef UserConfig = {
}

class Main extends snow.App {
    function new() {}
    override function config( config:AppConfig ) {
        return config;
    } //config

    override function ready() {
        log('ready');
    } //ready
} //Main

And a pretty much vanilla project.flow

{
  snow : {
    config: {
      config_path: 'config.json',
      log: 1
    }
  },

  project : {
    name : 'first',
    version : '1.0.0',
    author : 'p1xl',

    app : {
      name : 'first',
      package : 'com.p1xl.first',
    },

    build : {
      defines:[],
      dependencies : {
        snow : '*',
        // snowhxt : '*',
      }
    },

    files : {
      config : 'config.json'
    }
  }
}

When I flow run mac it compiles for a bit and then errors with:

g++ -Iinclude -I/usr/local/lib/haxe/lib/linc_ogg/git//lib/ -I/usr/local/lib/haxe/lib/linc_ogg/git//linc/ -I/usr/local/lib/haxe/lib/linc_ogg/git//lib//ogg/include/ -I/usr/local/lib/haxe/lib/linc_ogg/git//lib//vorbis/include/ -I/usr/local/lib/haxe/lib/linc_ogg/git//lib//theora/include/ -DNATIVE_TOOLKIT_OGG -DNATIVE_TOOLKIT_VORBIS -DNATIVE_TOOLKIT_THEORA -DLINC_OPENAL -I/usr/local/lib/haxe/lib/linc_openal/git//linc/ -DLINC_SDL -I/usr/local/lib/haxe/lib/linc_sdl/git//linc/ -I/usr/local/lib/haxe/lib/linc_sdl/git//lib/sdl/include/ -I/usr/local/lib/haxe/lib/linc_sdl/git//lib/sdl/include/configs/mac/ -DHAVE_LIBC -DNATIVE_TOOLKIT_SDL -I/usr/local/lib/haxe/lib/linc_stb/git//lib/ -I/usr/local/lib/haxe/lib/linc_stb/git//linc/ -I/usr/local/lib/haxe/lib/linc_timestamp/git//linc/ -c -fvisibility=hidden -stdlib=libstdc++ -O2 -I/usr/local/lib/haxe/lib/hxcpp/3,2,205/include -DHX_MACOS -m64 -Wno-parentheses -Wno-unused-value -Wno-format-extra-args -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=321 -x c++ -frtti -Wno-invalid-offsetof ./src/snow/modules/openal/ALStream.cpp -o/Users/samw3/ws/games/px/bin/mac64.build/cpp/obj/darwin64/afea0a1a_ALStream.o
Error: ./src/snow/modules/sdl/Runtime.cpp:4:10: fatal error: 'linc_glew.h' file not found
#include "linc_glew.h"
         ^
1 error generated.
flow / 
 build - stopping because of errors in hxcpp compile, while building arch 64 

I noticed that linc_glew wasn't installed, so I ran haxelib git linc_glew https://github.com/snowkit/linc_glew.git but the error persists.

Any ideas?

ntrf commented 8 years ago

There is a problem with precompiled headers support. See here: https://github.com/underscorediscovery/luxe/issues/385

ruby0x1 commented 8 years ago

Seems related to the dependencies. Someone else recently had a similar error, @samw3 can you elaborate on what os/distro/etc you're testing?

btw linc_glew isn't used, it's referencing the header inside of linc_opengl.

ntrf commented 8 years ago

Yes. This is actually an linc_opengl issue. It's trivial to fix - just make sure #include <hxcpp.h> in linc_opengl.cpp goes first. But it then you'll get some more errors of the same kind in linc_ogg and linc_sdl.

ruby0x1 commented 8 years ago

I saw you said flow run mac and the title mentions it so that answers what OS already. The other issue specific error was different actually, I misread that one anyway so ignore that too.

The exact error above is specifically that it can't find the include path to linc_opengl somehow. I don't see how this can come from the include order of hxcpp.

If you look at the compilation line given (though it is not the file it is erroring from - it would be best to see the g++ line that mentions Runtime.o at the end), you can see that it doesn't include the linc_opengl path - therefore it will fail to find it.

Here below I split the command up for clarity - you can see there is no reference to linc_opengl to the compiler, which means it's not getting as far as hxcpp complaints - and the version listed of hxcpp is 3,2,205 which is known to be compatible and doesn't break trying to heavy handedly use precompiled headers.

It should be working, but it appears to be some form of configuration issue.

-Iinclude
-I/usr/local/lib/haxe/lib/linc_ogg/git//lib/
-I/usr/local/lib/haxe/lib/linc_ogg/git//linc/
-I/usr/local/lib/haxe/lib/linc_ogg/git//lib//ogg/include/
-I/usr/local/lib/haxe/lib/linc_ogg/git//lib//vorbis/include/
-I/usr/local/lib/haxe/lib/linc_ogg/git//lib//theora/include/
-DNATIVE_TOOLKIT_OGG
-DNATIVE_TOOLKIT_VORBIS
-DNATIVE_TOOLKIT_THEORA
-DLINC_OPENAL
-I/usr/local/lib/haxe/lib/linc_openal/git//linc/
-DLINC_SDL
-I/usr/local/lib/haxe/lib/linc_sdl/git//linc/
-I/usr/local/lib/haxe/lib/linc_sdl/git//lib/sdl/include/
-I/usr/local/lib/haxe/lib/linc_sdl/git//lib/sdl/include/configs/mac/
-DHAVE_LIBC
-DNATIVE_TOOLKIT_SDL
-I/usr/local/lib/haxe/lib/linc_stb/git//lib/
-I/usr/local/lib/haxe/lib/linc_stb/git//linc/
-I/usr/local/lib/haxe/lib/linc_timestamp/git//linc/
-c
-fvisibility=hidden
-stdlib=libstdc++
-O2
-I/usr/local/lib/haxe/lib/hxcpp/3,2,205/include
-DHX_MACOS
-m64
-Wno-parentheses
-Wno-unused-value
-Wno-format-extra-args
-DHXCPP_M64
-DHXCPP_VISIT_ALLOCS
-DHXCPP_API_LEVEL=321
-x
c++
-frtti
-Wno-invalid-offsetof
./src/snow/modules/openal/ALStream.cpp
-o/Users/samw3/ws/games/px/bin/mac64.build/cpp/obj/darwin64/afea0a1a_ALStream.o
samw3 commented 8 years ago

Just to confirm some things and to be thorough, I'm on OS X 10.11.6 (El Capitan), haxe version 3.2.1, hxcpp 3.3.49

@ntrf I ran cdhaxelib path linc_opengl;cd linc;nano linc_opengl.cpp and moved #include <hxcpp.h> as the first include. I also did it for linc_openal, and it doesn't help. Same error.

@underscorediscovery I ran haxelib set hxcpp 3.2.205 and then tried a build again and the problem persists. Here is my g++ compile line for Runtime.cpp:

g++ 
-Iinclude 
-I/usr/local/lib/haxe/lib/linc_ogg/git//lib/ 
-I/usr/local/lib/haxe/lib/linc_ogg/git//linc/ 
-I/usr/local/lib/haxe/lib/linc_ogg/git//lib//ogg/include/ 
-I/usr/local/lib/haxe/lib/linc_ogg/git//lib//vorbis/include/ 
-I/usr/local/lib/haxe/lib/linc_ogg/git//lib//theora/include/ 
-DNATIVE_TOOLKIT_OGG 
-DNATIVE_TOOLKIT_VORBIS 
-DNATIVE_TOOLKIT_THEORA 
-DLINC_OPENAL 
-I/usr/local/lib/haxe/lib/linc_openal/git//linc/ 
-DLINC_SDL 
-I/usr/local/lib/haxe/lib/linc_sdl/git//linc/ 
-I/usr/local/lib/haxe/lib/linc_sdl/git//lib/sdl/include/ 
-I/usr/local/lib/haxe/lib/linc_sdl/git//lib/sdl/include/configs/mac/ 
-DHAVE_LIBC 
-DNATIVE_TOOLKIT_SDL 
-I/usr/local/lib/haxe/lib/linc_stb/git//lib/ 
-I/usr/local/lib/haxe/lib/linc_stb/git//linc/ 
-I/usr/local/lib/haxe/lib/linc_timestamp/git//linc/ 
-c 
-fvisibility=hidden 
-stdlib=libstdc++ 
-O2 
-I/usr/local/lib/haxe/lib/hxcpp/3,2,205/include 
-DHX_MACOS 
-m64 
-Wno
-parentheses 
-Wno
-unused
-value 
-Wno
-format
-extra
-args 
-DHXCPP_M64 
-DHXCPP_VISIT_ALLOCS 
-DHXCPP_API_LEVEL=321 
-x c++ 
-frtti 
-Wno
-invalid
-offsetof ./src/snow/modules/sdl/Runtime.cpp 
-o/Users/samw3/ws/games/px/bin/mac64.build/cpp/obj/darwin64/944f5801_Runtime.o
ruby0x1 commented 8 years ago

So somewhere along the lines it's not getting linc_opengl huh, weird! The hxcpp header includes are related to 3.3 bugs so don't worry about that - haxe 3.2.1 with hxcpp 3.2.205 is the right ones atm.

So let's see, try running flow run mac --log 3 and see if it says anything curious about linc_opengl at all?

samw3 commented 8 years ago

Well, the missing include got me thinking. Maybe it's missing because it's been optimized out...

My simple Main.hx doesn't reference OpenGL at all. So I changed it to this and it compiles and runs!

import snow.Snow;
import snow.types.Types;
import snow.api.Debug.*;
import snow.modules.opengl.GL;

typedef UserConfig = {
}

class Main extends snow.App {
    function new() {}
    override function config( config:AppConfig ) {
        return config;
    } //config

    override function ready() {
        log('ready');
        log("OpenGL reports version " + GL.versionString());
    } //ready
} //Main
ruby0x1 commented 8 years ago

Aha, well that would explain it. I think I can fix that pretty easily and make it consistent. Thanks for digging, and sorry about that!

samw3 commented 8 years ago

No problem! I'm looking forward to using snow.

ruby0x1 commented 8 years ago

linc_opengl has a fixed committed as shown above. If you have any other issues feel free to file them here or on the appropriate repo otherwise!