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

Missing library #include <features.h> #688

Closed
gerardogc2378 opened this issue May 5, 2018 · 3 comments
Closed

Missing library #include <features.h> #688

gerardogc2378 opened this issue May 5, 2018 · 3 comments

Comments

@gerardogc2378
Copy link

Compiling urho sharp for Android I have this output:

/home/ggc/android_home/ndk-bundle/sources/cxx-stl/llvm-libc++/include/__config:169:22: fatal error: features.h: No such file or directory
 #include <features.h>

Environment Details

Not all of these will be relevant to every bug, but please provide as much
information as you can.

  • NDK Version: Value from Pkg.Revision in ndk-bundle/source.properties. If not
    the latest version, check there before filing.
  • Build sytem: ndk-build? cmake? standalone toolchain? custom? (if gradle, file
    a bug against studio as specified above)
  • Host OS: ArchLinux
  • Compiler: clang from ndk latest using sdkmanager to install
  • NDK API level: ndk-bundle | 16.1.4479499 | NDK | ndk-bundle
@rprichard
Copy link
Collaborator

The NDK has a sysroot/usr/include/features.h file that would normally be included, so apparently it's not on your include search path. You're probably not specifying the --sysroot option correctly.

The compiler command-line would be useful information to add to this report.

I searched for urho and found a Makefile that hasn't been updated for the NDK's unified headers, so maybe that's the problem.

From https://android.googlesource.com/platform/ndk/+/ndk-release-r16/docs/UnifiedHeaders.md:

The compile time sysroot is now $NDK/sysroot. Previously this was $NDK/platforms/android-$API/arch-$ARCH.

Pass -isystem $NDK/sysroot/usr/include/$TRIPLE when compiling. The triple has the following mapping:

From https://github.com/xamarin/urho/blob/1cb035b0f4d742a340167c21cdeae39b1fb547a6/MakeAndroid:

C_FLAGS=-fexceptions -fPIC --sysroot=$(ANDK_DIR)/platforms/$(ANDROID_API)/arch-$(PLATFORM) -funwind-tables -funswitch-loops -finline-limit=300 -fsigned-char -no-canonical-prefixes -fdata-sections -ffunction-sections -Wa,--noexecstack -fstack-protector -fomit-frame-pointer -fstrict-aliasing -O3 -DNDEBUG -isystem $(ANDK_DIR)/platforms/$(ANDROID_API)/arch-$(PLATFORM)/usr/include -isystem $(ANDK_DIR)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAINS_VER)/include -isystem $(ANDK_DIR)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAINS_VER)/libs/$(ABI)/include -isystem $(ANDK_DIR)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAINS_VER)/include/backward -I$(URHO3D_ANDROID_DIR)/include -I$(URHO3D_ANDROID_DIR)/include/Urho3D/ThirdParty -I$(URHO3D_ANDROID_DIR)/include/Urho3D/ThirdParty/Bullet -I$(URHO3D_SRC_DIR)/Source/Samples

CXX_FLAGS = --sysroot=$(ANDK_DIR)/platforms/$(ANDROID_API)/arch-$(PLATFORM) $(ABI_FLAGS) -fpermissive -fsigned-char -funwind-tables -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -fdata-sections -ffunction-sections -frtti -funswitch-loops -finline-limit=300 -fstack-protector -fomit-frame-pointer -fstrict-aliasing -fexceptions -std=gnu++11 -Wno-invalid-offsetof -O3 -DNDEBUG -fPIC -isystem $(ANDK_DIR)/platforms/$(ANDROID_API)/arch-$(PLATFORM)/usr/include -isystem $(ANDK_DIR)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAINS_VER)/include -isystem $(ANDK_DIR)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAINS_VER)/libs/$(ABI)/include -isystem $(ANDK_DIR)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAINS_VER)/include/backward

The Makefile is also using g++, gnustl, and armeabi (obsolete, use armeabi-v7a instead).

These flags need updating for unified headers:

  • --sysroot=$(ANDK_DIR)/platforms/$(ANDROID_API)/arch-$(PLATFORM)
  • -isystem $(ANDK_DIR)/platforms/$(ANDROID_API)/arch-$(PLATFORM)/usr/include

You'd probably want:

  • --sysroot=$(ANDK_DIR)/sysroot
  • -isystem $(ANDK_DIR)/sysroot/usr/include/arm-linux-androideabi

I doubt there's an NDK bug here.

@gerardogc2378
Copy link
Author

I have the same issue with this file https://github.com/urho3d/Urho3D/blob/master/CMake/Toolchains/Android.cmake (Urho3D Game Engine) maybe it needs some changes like you said, these are obsolete makefiles and need upgrade...

@rprichard
Copy link
Collaborator

As @weitjong said in urho3d/urho3d#2311 (comment), the Urho3D build system needs to be updated for NDK r16. I think this issue can be closed in favor of the Urho3D issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants