Skip to content

Failure to compile with Android NDK due to missing include in cpu.c

x264-master.tar.bz2 downloaded from web site at the date of this report fails to compile with the Android NDK:

common/cpu.c:442:12: warning: implicit declaration of function 'sysconf' is invalid in C99 [-Wimplicit-function-declaration]
    return sysconf( _SC_NPROCESSORS_CONF );
           ^
common/cpu.c:442:21: error: use of undeclared identifier '_SC_NPROCESSORS_CONF'
    return sysconf( _SC_NPROCESSORS_CONF );

It worked in a snapshot from a few months ago.

After investigation, this is caused by cpu.c missing #include <unistd.h> if compiling for Android.

Edited by Michael Pujos
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information