OpenNI / OpenNI2

OpenNI2
Apache License 2.0
432 stars 892 forks source link

GCC 4.8 fails due to -Werror and XN_COMPILER_ASSERT() #45

Closed mjbshaw closed 11 years ago

mjbshaw commented 11 years ago

Making results in this error:

$ make
make -C ThirdParty/PSCommon/XnLib/Source
make[1]: Entering directory `/home/pixio/OpenNI2/ThirdParty/PSCommon/XnLib/Source'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/pixio/OpenNI2/ThirdParty/PSCommon/XnLib/Source'
make -C Source/Core
make[1]: Entering directory `/home/pixio/OpenNI2/Source/Core'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/pixio/OpenNI2/Source/Core'
make -C Source/DepthUtils
make[1]: Entering directory `/home/pixio/OpenNI2/Source/DepthUtils'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/pixio/OpenNI2/Source/DepthUtils'
make -C Source/Drivers/DummyDevice
make[1]: Entering directory `/home/pixio/OpenNI2/Source/Drivers/DummyDevice'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/pixio/OpenNI2/Source/Drivers/DummyDevice'
make -C Source/Drivers/PS1080
make[1]: Entering directory `/home/pixio/OpenNI2/Source/Drivers/PS1080'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/pixio/OpenNI2/Source/Drivers/PS1080'
make -C Source/Drivers/PSLink
make[1]: Entering directory `/home/pixio/OpenNI2/Source/Drivers/PSLink'
g++ -MD -MP -MT "./../../../Bin/Intermediate/x64-Release/libPSLink.so/XnLinkControlEndpoint.d ../../../Bin/Intermediate/x64-Release/libPSLink.so/XnLinkControlEndpoint.o" -c -msse3 -Wall -O2 -DNDEBUG -I../../../Include -I../../../ThirdParty/PSCommon/XnLib/Include -I. -IProtocols/XnLinkProto -ILinkProtoLib  -fPIC -fvisibility=hidden -Werror -o ../../../Bin/Intermediate/x64-Release/libPSLink.so/XnLinkControlEndpoint.o LinkProtoLib/XnLinkControlEndpoint.cpp
In file included from LinkProtoLib/XnLinkMsgEncoder.h:6:0,
                 from LinkProtoLib/XnLinkControlEndpoint.h:5,
                 from LinkProtoLib/XnLinkControlEndpoint.cpp:1:
LinkProtoLib/XnLinkControlEndpoint.cpp: In member function ‘XnStatus xn::LinkControlEndpoint::EnumerateStreams(xnl::Array<XnFwStreamInfo>&)’:
LinkProtoLib/XnLinkProtoUtils.h:18:43: error: typedef ‘compileAssert’ locally defined but not used [-Werror=unused-local-typedefs]
 #define XN_COMPILER_ASSERT(x) typedef int compileAssert[x ? 1 : -1]
                                           ^
LinkProtoLib/XnLinkControlEndpoint.cpp:1174:3: note: in expansion of macro ‘XN_COMPILER_ASSERT’
   XN_COMPILER_ASSERT(sizeof(aStreamInfos[i].creationInfo) >= sizeof(pEnumerateNodesResponse->m_streamInfos[i].m_strCreationInfo));
   ^
cc1plus: all warnings being treated as errors
make[1]: *** [../../../Bin/Intermediate/x64-Release/libPSLink.so/XnLinkControlEndpoint.o] Error 1
make[1]: Leaving directory `/home/pixio/OpenNI2/Source/Drivers/PSLink'
make: *** [Source/Drivers/PSLink] Error 2

It's complaining about XN_COMPILER_ASSERT()'s expansion and that compileAssert is not used (though it is defined locally). GCC 4.8 warns about typedefs (due to -Wunused-local-typedefs) that are locally defined but not used, and since -Werror is specified this results in a failed compilation.

Adding -Wno-unused-local-typedefs to the compilation options fixes the issue.

$ g++ --version
g++ (Ubuntu/Linaro 4.8.1-10ubuntu6) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ uname -a
Linux photonn 3.11.0-11-generic #17-Ubuntu SMP Tue Oct 1 19:42:04 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
eddiecohen commented 11 years ago

Fixed on 261a5bdab323566098d43436a38578856083c308.

Staberinde commented 10 years ago

I'm still having this problem using 4.8.1 and the current development build