Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLM_FORCE_CXX98 on Android #213

Closed
blitz-research opened this issue Jun 16, 2014 · 5 comments
Closed

GLM_FORCE_CXX98 on Android #213

blitz-research opened this issue Jun 16, 2014 · 5 comments
Assignees
Labels
Milestone

Comments

@blitz-research
Copy link

Not sure if this is a 'bug' or even worth worrying about, but I'm having to #define GLM_FORCE_CXX98 on Android, or I get a bunch of 'nextafter is not a member of std' errors when building for Android.

My application.mk file includes:

APP_STL := gnustl_static
NDK_TOOLCHAIN_VERSION :=4.8

...which appear to be required by C++11, which I use via CFLAGS in android.mk

Feel free to ignore, just a bit weird and I thought it might be worth mentioning...

@Groovounet
Copy link
Member

Hi,

If you #define GLM_MESSAGES before including <glm.glm.hpp> what does GLM says at compilation time?

Android is quite annoying to support with all the toolchains / lib / options and quite depends on GLM users feedback. I think it's worth to try to resolve.

Thanks,
Christophe

@Groovounet Groovounet added the bug label Jun 20, 2014
@Groovounet Groovounet added this to the GLM 0.9.5 milestone Jun 20, 2014
@Groovounet Groovounet self-assigned this Jun 20, 2014
@Groovounet
Copy link
Member

I have added a tentative fix in GLM 0.9.5 branch for GLM 0.9.5.4 release.

Let me know if you have any issue with it.

Thanks,
Christophe

@blitz-research
Copy link
Author

Ok, now I get _nextafter not found instead.

With GLM_MESSAGES defined, output of ndk-build is:

[armeabi-v7a] Compile++ thumb: main <= app.cpp
In file included from /defender/glm/glm/detail/type_int.hpp:32:0,
                 from /defender/glm/glm/fwd.hpp:32,
                 from /defender/glm/glm/glm.hpp:88,
                 from /defender/defender/std.h:59,
                 from /defender/defender/app.cpp:2:
/defender/glm/glm/detail/setup.hpp:95:51: note: #pragma message: GLM: Android platform detected
 #  pragma message("GLM: Android platform detected")
                                                   ^
/defender/glm/glm/detail/setup.hpp:342:48: note: #pragma message: GLM: GCC compiler detected
 #   pragma message("GLM: GCC compiler detected")
                                                ^
/defender/glm/glm/detail/setup.hpp:373:39: note: #pragma message: GLM: 32 bits model
 #  pragma message("GLM: 32 bits model")
                                       ^
/defender/glm/glm/detail/setup.hpp:472:31: note: #pragma message: GLM: C++11
 #  pragma message("GLM: C++11")
                               ^
In file included from /defender/glm/glm/detail/type_int.hpp:32:0,
                 from /defender/glm/glm/fwd.hpp:32,
                 from /defender/glm/glm/glm.hpp:88,
                 from /defender/defender/std.h:59,
                 from /defender/defender/app.cpp:2:
/defender/glm/glm/detail/setup.hpp:482:154: note: #pragma message: GLM: #define GLM_FORCE_CXX98, GLM_FORCE_CXX03, GLM_LA
NG_CXX11 or GLM_FORCE_CXX1Y to force using a specific version of the C++ language
 # pragma message("GLM: #define GLM_FORCE_CXX98, GLM_FORCE_CXX03, GLM_LANG_CXX11 or GLM_FORCE_CXX1Y to force using a spe
cific version of the C++ language")

                                  ^
/defender/glm/glm/detail/setup.hpp:635:51: note: #pragma message: GLM: Platform independent code
 #  pragma message("GLM: Platform independent code")
                                                   ^
/defender/glm/glm/detail/setup.hpp:647:97: note: #pragma message: GLM: #define GLM_FORCE_PURE to avoid using platform sp
ecific instruction sets
 # pragma message("GLM: #define GLM_FORCE_PURE to avoid using platform specific instruction sets")
                                                                                                 ^
/defender/glm/glm/detail/setup.hpp:715:103: note: #pragma message: GLM: Swizzling operators disabled, #define GLM_SWIZZL
E to enable swizzle operators
 #  pragma message("GLM: Swizzling operators disabled, #define GLM_SWIZZLE to enable swizzle operators")
                                                                                                       ^
/defender/glm/glm/detail/setup.hpp:738:108: note: #pragma message: GLM: .length() returns glm::length_t, a typedef of in
t following the GLSL specification
 #  pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
                                                                                                            ^
/defender/glm/glm/detail/setup.hpp:739:95: note: #pragma message: GLM: #define GLM_FORCE_SIZE_T_LENGTH for .length() to
return a std::size_t
 #  pragma message("GLM: #define GLM_FORCE_SIZE_T_LENGTH for .length() to return a std::size_t")
                                                                                               ^
In file included from /defender/defender/std.h:59:0,
                 from /defender/defender/app.cpp:2:
/defender/glm/glm/glm.hpp:92:46: note: #pragma message: GLM: Core library included
 # pragma message("GLM: Core library included")
                                              ^
In file included from /defender/defender/std.h:60:0,
                 from /defender/defender/app.cpp:2:
/defender/glm/glm/ext.hpp:63:66: note: #pragma message: GLM: All extensions included (not recommanded)
 # pragma message("GLM: All extensions included (not recommanded)")
                                                                  ^
In file included from /defender/glm/glm/./gtc/ulp.hpp:89:0,
                 from /defender/glm/glm/ext.hpp:79,
                 from /defender/defender/std.h:60,
                 from /defender/defender/app.cpp:2:
/defender/glm/glm/./gtc/ulp.inl: In function 'double glm::prev_float(const double&)':
/defender/glm/glm/./gtc/ulp.inl:248:32: error: '_nextafter' was not declared in this scope
    return _nextafter(x, DBL_MIN);
                                ^
In file included from /defender/glm/glm/ext.hpp:98:0,
                 from /defender/defender/std.h:60,
                 from /defender/defender/app.cpp:2:
/defender/glm/glm/./gtx/int_10_10_10_2.hpp: At global scope:
/defender/glm/glm/./gtx/int_10_10_10_2.hpp:32:126: note: #pragma message: GLM: GLM_GTX_int_10_10_10_2 extension is depre
cated, include GLM_GTC_packing (glm/gtc/packing.hpp) instead
 # pragma message("GLM: GLM_GTX_int_10_10_10_2 extension is deprecated, include GLM_GTC_packing (glm/gtc/packing.hpp) in
stead")

      ^
In file included from /defender/defender/std.h:61:0,
                 from /defender/defender/app.cpp:2:
/defender/glm/glm/gtx/random.hpp:25:95: note: #pragma message: GLM: GLM_GTX_random extension is deprecated, include GLM_
GTC_random instead
 # pragma message("GLM: GLM_GTX_random extension is deprecated, include GLM_GTC_random instead")
                                                                                               ^
make.exe: *** [obj/local/armeabi-v7a/objs/main//defender/defender/app.o] Error 1

@blitz-research
Copy link
Author

Ok, I had a closer look at this and have a potential fix:

Change the single instance of _nextafter in ulp.inl to detail::nextafter, and it compiles fine on Android.

I'll attempt to create a 'pull request', but I kinda suck at git - it's wanting to 'push' first for some reason...

@UnTraDe
Copy link

UnTraDe commented Jul 15, 2014

I tried to replace to file with the new commited one, (I have version 0.9.5.4) and it still failed to compile on android ndk. I changed every line the compiler complained about to detail::nextafter instead of _nextafter and now it compilers both on windows and android. I'm not really familiar with the usage of prev_float and next_float functions within the glm code, so I don't know what long term effect my changes might cause. If someone more knowledgeable than I do managed to solve this, please provide the solution. Thanks in advanced.

EDIT:
I uploaded the file to pastebin, http://pastebin.com/kff1Jw6L.
This currently works and compiles with both Android NDK and Windows with Visual Studio 2013.

EDIT2:
I forgot to mention my Application.mk settings.
I use the same as OP.

APP_STL := gnustl_static
NDK_TOOLCHAIN_VERSION :=4.8

Cyphall added a commit to Cyphall/Cyph3D that referenced this issue May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants