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

Added NDK Unified headers support https://android.googlesource.com/pl… #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ivanarh
Copy link

@ivanarh ivanarh commented May 2, 2018

The script doesn't work with modern NDK version. My commit fixes it.
See https://android.googlesource.com/platform/ndk/+/ndk-release-r16/docs/UnifiedHeaders.md

@Khang-NT
Copy link
Owner

Khang-NT commented May 3, 2018

Seem like we also need to change $SYSROOT:

The compile time sysroot is now $NDK/sysroot

And:

At link time, change nothing. All link time build behavior should match the deprecated headers behavior. --sysroot should still point to $NDK/platforms/android-$API/arch-$ARCH/

How we can change sysroot only at compile time?
Does the new script build success in your machine?
Or maybe we will consider to update NDK version to r15:

In r15 unified headers are used by default. In r16, the old headers have been removed.

Copy link
Owner

@Khang-NT Khang-NT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix build error

@ivanarh
Copy link
Author

ivanarh commented May 3, 2018

Script is successfully run on my machine with MacOS X Sierra, Android NDK r16b, all architectures.
But i ran only "full" build and missed a check for "lite" build. Unfortunately it fails due to problems with mmap system call:

/opt/android-sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc -I. -I./ --sysroot=/opt/android-sdk/ndk-bundle/platforms/android-16/arch-arm/ -isystem /opt/android-sdk/ndk-bundle/sysroot/usr/include -isystem /opt/android-sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=16  --sysroot=/opt/android-sdk/ndk-bundle/platforms/android-16/arch-arm/ -isysroot /opt/android-sdk/ndk-bundle/platforms/android-16/arch-arm/ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Dstrtod=avpriv_strtod -DPIC -DZLIB_CONST -DHAVE_AV_CONFIG_H -mfloat-abi=softfp -marm -march=armv7-a -Os -O3   -I/Users/user/src/openshot/ffmpeg-binary-android/build_scripts/build_dir/include --sysroot=/opt/android-sdk/ndk-bundle/platforms/android-16/arch-arm/ -fPIE -isystem /opt/android-sdk/ndk-bundle/sysroot/usr/include -isystem /opt/android-sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=16    -march=armv7-a -std=c11 -fomit-frame-pointer -fPIC -marm -pthread -I/Users/user/src/openshot/ffmpeg-binary-android/build_scripts/build_dir/include/opus -I/Users/user/src/openshot/ffmpeg-binary-android/build_scripts/build_dir/include -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -Os -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat -fdiagnostics-color=auto -Wno-maybe-uninitialized  -MMD -MF libavdevice/dv1394.d -MT libavdevice/dv1394.o -c -o libavdevice/dv1394.o libavdevice/dv1394.c
libavdevice/dv1394.c: In function 'dv1394_read_header':
libavdevice/dv1394.c:103:16: error: call to 'mmap' declared with attribute error: mmap is not available with _FILE_OFFSET_BITS=64 when using GCC until android-21. Either raise your minSdkVersion, disable _FILE_OFFSET_BITS=64, or switch to Clang.
     dv->ring = mmap(NULL, DV1394_PAL_FRAME_SIZE * DV1394_RING_FRAMES,
                ^
make: *** [libavdevice/dv1394.o] Error 1

It requires either switching to clang or discarding 16 API level support. I would prefer the first variant, do you mind?

@ivanarh
Copy link
Author

ivanarh commented May 3, 2018

How we can change sysroot only at compile time?

It's quite tricky and, i think, it doesn't make sense at all. Adding -isystem flag with sysroot/include path is absolutely sufficient.

Or maybe we will consider to update NDK version to r15:

May be you mean downgrade?

@Khang-NT
Copy link
Owner

Khang-NT commented May 4, 2018

+1 It's cool if we migrate to Clang and NDK r16.

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

Successfully merging this pull request may close these issues.

None yet

2 participants