Polytonic / Glitter

Dead Simple OpenGL
http://polytonic.github.io/Glitter/
2.49k stars 421 forks source link

Build Failure in assimp #37

Closed ryantonini closed 6 years ago

ryantonini commented 7 years ago

When I build the project for the first time on Xcode on OSX, I get an error in the glTFExporter.cpp file from assimp. The error occurs on line 585 and reads: Ordered comparison between pointer and zero ('aiVector3D ' (aka 'aiVector3t ') and 'int')

If anyone could help, I would appreciate it.

Polytonic commented 7 years ago

Hi there! Could you provide some more details on which Mac you're building on, which version of Xcode you're using, and the build output produced when your build fails?

I've been tracking down another assimp related build issue, so you're probably not alone on this one.

ryantonini commented 7 years ago

The mac I'm building on is MacBook Pro Mid-2012 version and I'm running on Xcode 9.1

assimp Group
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/include/assimp/matrix4x4.inl
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/ACLoader.cpp
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/AMFImporter_Postprocess.cpp
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/ASEParser.cpp
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/include/assimp/matrix3x3.inl
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/include/assimp/color4.inl
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/include/assimp/vector3.inl
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/FBXBinaryTokenizer.cpp
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/FBXBinaryTokenizer.cpp:448:19: Unused variable 'padding_0'
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/FBXBinaryTokenizer.cpp:449:19: Unused variable 'padding_1'
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/FBXBinaryTokenizer.cpp:163:10: Unused function 'ReadDoubleWord'
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/LogAux.h
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/MDCLoader.cpp
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/MDLLoader.cpp
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/MDLMaterialLoader.cpp
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/ObjExporter.cpp
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/SIBImporter.cpp
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/include/assimp/vector2.inl
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/glTFAsset.h
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/glTFExporter.cpp
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/glTFExporter.cpp:585:35: Ordered comparison between pointer and zero ('aiVector3D *' (aka 'aiVector3t<float> *') and 'int')

Everything is just warnings apart from the last line.

ryantonini commented 7 years ago

Heres a more detailed summary of the error:

{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf830
{\fonttbl\f0\fnil\fcharset0 Menlo-Bold;\f1\fnil\fcharset0 Menlo-Regular;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li240\fi-240\pardirnatural\partightenfactor0

\f0\b\fs22 \cf0 \
Showing Recent Errors Only\
\
Build target ZERO_CHECK of project Glitter with configuration Debug\
\
\
Build target BulletInverseDynamics of project Glitter with configuration Debug\
\
\
Build target BulletDynamics of project Glitter with configuration Debug\
\
\
Build target Bullet3Geometry of project Glitter with configuration Debug\
\
\
Build target glfw of project Glitter with configuration Debug\
\
\
Build target assimp of project Glitter with configuration Debug\
\

\f1\b0 CompileC Build/Glitter/Vendor/assimp/code/Glitter.build/Debug/assimp.build/Objects-normal/x86_64/glTFExporter.o Glitter/Vendor/assimp/code/glTFExporter.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler\
    cd "/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter"\
    export LANG=en_US.US-ASCII\
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DCMAKE_INTDIR=\\"Debug\\" -DOPENDDL_NO_USE_CPP11 -DASSIMP_BUILD_NO_OWN_ZLIB -DASSIMP_BUILD_NO_C4D_IMPORTER -DASSIMP_BUILD_DLL_EXPORT -DOPENDDLPARSER_BUILD -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -mmacosx-version-min=10.12 -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -index-store-path /Users/ryantonini/Library/Developer/Xcode/DerivedData/Glitter-fwqygqfryogmiwctyxzxxekrhxyn/Index/DataStore -I/Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Build/Glitter/Vendor/assimp/code/Debug/include -I/Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp -I/Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Build/Glitter/Vendor/assimp -I/Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Build/Glitter/Vendor/assimp/include -I/Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/include -I/Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/../contrib/rapidjson/include -I/Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/../contrib -I/Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/../contrib/unzip -I/Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/../contrib/openddlparser/include -I/Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/.. -I/Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Build/Glitter/Vendor/assimp/code/Glitter.build/Debug/assimp.build/DerivedSources/x86_64 -I/Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Build/Glitter/Vendor/assimp/code/Glitter.build/Debug/assimp.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Build/Glitter/Vendor/assimp/code/Debug -fvisibility=hidden -Wall -Wno-long-long -pedantic -std=c++11 -MMD -MT dependencies -MF /Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Build/Glitter/Vendor/assimp/code/Glitter.build/Debug/assimp.build/Objects-normal/x86_64/glTFExporter.d --serialize-diagnostics /Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Build/Glitter/Vendor/assimp/code/Glitter.build/Debug/assimp.build/Objects-normal/x86_64/glTFExporter.dia -c /Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/glTFExporter.cpp -o /Users/ryantonini/Documents/a3\\ 5/raytracer/myProj/Glitter/Build/Glitter/Vendor/assimp/code/Glitter.build/Debug/assimp.build/Objects-normal/x86_64/glTFExporter.o\
\
In file included from /Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/glTFExporter.cpp:62:\
In file included from /Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/glTFAssetWriter.h:51:\
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/glTFAsset.h:612:13: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]\
            struct \{\
            ^\
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/glTFAsset.h:619:13: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]\
            struct \{\
            ^\
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/glTFExporter.cpp:585:35: error: ordered comparison between pointer and zero ('aiVector3D *' (aka 'aiVector3t<float> *') and 'int')\
                if(comp_allow && (aim->mNormals > 0)) idx_srcdata_normal = b->byteLength;// Store index of normals array.\
                                  ~~~~~~~~~~~~~ ^ ~\
In file included from /Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/glTFExporter.cpp:43:\
In file included from /Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/glTFExporter.h:47:\
In file included from /Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/include/assimp/types.h:514:\
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/include/assimp/vector3.inl:149:15: warning: taking address of packed member 'x' of class or structure 'aiVector3t<float>' may result in an unaligned pointer value [-Waddress-of-packed-member]\
    return *(&x + i);\
              ^\
/Users/ryantonini/Documents/a3 5/raytracer/myProj/Glitter/Glitter/Vendor/assimp/code/glTFExporter.cpp:222:63: note: in instantiation of member function 'aiVector3t<float>::operator[]' requested here\
                  valueTmp = static_cast<aiVector3D*>(data)[i][j];\
                                                              ^\
3 warnings and 1 error generated.\
\

\f0\b \
Build target BulletCollision of project Glitter with configuration Debug\
\
\
Build target LinearMath of project Glitter with configuration Debug\
\
\
Build target Bullet3OpenCL_clew of project Glitter with configuration Debug\
\
\
Build target Bullet2FileLoader of project Glitter with configuration Debug\
\
\
Build target Bullet3Dynamics of project Glitter with configuration Debug\
\
\
Build target Bullet3Collision of project Glitter with configuration Debug\
\
\
Build target BulletSoftBody of project Glitter with configuration Debug\
\
\
Build target Bullet3Common of project Glitter with configuration Debug\
\
\
\
Build failed    2017-11-19, 1:39 AM\
}
Polytonic commented 6 years ago

Hey there, sorry for the delay. Holidays here. 🦃

So it looks like assimp is still broken (for me anyway). You could try either updating to the latest submodules git submodule update --remote or you could go back a dependency revision to 7910628 and see if that builds for you.

ryantonini commented 6 years ago

Hey I updated the assimp to version 4.0.1 and the previous issue seems resolved but the new issue was that config.h could not be found. The cmake seems to generate the config.h in ../Glitter/Build/Glitter/Vendor/assimp/include/assimp/config.h, but defs.h cannot find the file. I noticed you submitted a similar issue #1566 on assimp.

For the time being, I just copied the config.h file and added it to ../Glitter/Vendor/assimp/include/assimp/ folder which allows the build to be successful. But I might try to go back to a earlier dependency version, and see if that works.

Polytonic commented 6 years ago

Yeah, I've opened https://github.com/assimp/assimp/issues/1566 and am tracking what I know so far there. Apologies again for the inconvenience.

zhangzj commented 6 years ago

@ryantonini @Polytonic I also build project in OSX by Xcode. Try checkout assimp tag v3.1 maybe help workround this issue. Build Success in my machine.

cd <GlitterFolder>/Glitter/Vendor/assimp
git checkout v3.1
Polytonic commented 6 years ago

@zhangzj I appreciate the pull request -- I'm somewhat hesitant to go back a version though, especially since 3.1 is over a year old, and there's a lot of nice stuff fixed in 4.x.x version. I'll think it over, but for now I'm glad that fixes the problem for you locally!

zhangzj commented 6 years ago

@Polytonic OK, no problem.

stonecauldron commented 6 years ago

I'm having the same problem, any updates on this issue?

simonber commented 6 years ago

You can disable building the GLTF importer if you don't need support for this format:

cd "GlitterFolder"/Build ccmake ..

Scroll down and disable the flag ASSIMP_BUILD_GLTF_IMPORTER.

I was able to compile on OS X without this feature enabled.

stonecauldron commented 6 years ago

I can confirm this works. Thanks for the workaround @simonber !

Polytonic commented 6 years ago

Hmm. Seems like there's no movement on the assimp side of things. I'm open to more permanent workarounds at this point. Will probably go with disabling GLTF Importer for now (as outlined above) unless anyone has alternative suggestions.

urzq commented 6 years ago

Hello there !

I'm working on a rendering engine, and I stole the dependency management of glitter :) (and I'm also following learnopengl.com) I try to integrate assimp, and I'm running in the same issue as several other people: defs.h cannot find config.h, because it's generated in my_project\build\externals\assimp\include\assimp\config.h.. This problem is tagged on this thread, but also here and here. Even if I have full access to your CMakeLists.txt, I cannot figure out how you solved this issue .

I know glitter builds just fine, because somehow you managed to generate the config.h in D:\src\Glitter\Glitter\Vendor\assimp\include\assimp\config.h

Can you please give me some pointer ?

Polytonic commented 6 years ago

First off, I apologize for the delay. I understand the broken behavior of Glitter led to a poor user experience, and going forward, I'll try to do better about promptly closing out these kinds of issues.

Second, while I personally feel the problem is up to assimp maintainers to fix, said fix has yet to materialize after ... months. I've added the above workaround (cherrypick or merge 73275f5) and lettuce wrap this up and never speak of this again. 🤞

For those affected, if it's not too much trouble: would you mind grabbing the above change and trying again? 😬

urzq commented 6 years ago

Hello again !

Thanks for you reply :) You don't need to apologize, everything was working great with Glitter so far, thanks a lot for the time you are putting into it !

My request was: "how the hell the submodule + cmake approach is working on Glitter, but not on my personal project when I try to replicate it ?" (and that question remains without answer).

The good news with you workaround is:

So thank you !

Polytonic commented 6 years ago

My request was: "how the hell the submodule + cmake approach is working on Glitter, but not on my personal project when I try to replicate it ?" (and that question remains without answer).

Hm, without more detail, I'm not sure I can provide much information. Perhaps you need to clone submodules or make sure your paths line up? Those are usually the most frequent user errors I've encountered. I can't really help much more beyond that though.