Skip to content

major() and minor() are undefined with OS_ANDROID #4231

@JMLX42

Description

@JMLX42

Expected behavior

When building for Android, the following build errors are reported:

/builds/aerys/embedb/build/third_party/rocksdb/src/rocksdb/env/env_posix.cc:650:9: error: use of undeclared identifier 'major'
    if (major(statbuf[0].st_dev) != major(statbuf[1].st_dev) ||
        ^
/builds/aerys/embedb/build/third_party/rocksdb/src/rocksdb/env/env_posix.cc:650:37: error: use of undeclared identifier 'major'
    if (major(statbuf[0].st_dev) != major(statbuf[1].st_dev) ||
                                    ^
/builds/aerys/embedb/build/third_party/rocksdb/src/rocksdb/env/env_posix.cc:651:9: error: use of undeclared identifier 'minor'
        minor(statbuf[0].st_dev) != minor(statbuf[1].st_dev) ||
        ^
/builds/aerys/embedb/build/third_party/rocksdb/src/rocksdb/env/env_posix.cc:651:37: error: use of undeclared identifier 'minor'
        minor(statbuf[0].st_dev) != minor(statbuf[1].st_dev) ||
                                    ^
4 errors generated.

Actual behavior

Should build without error for Android.

Steps to reproduce the behavior

Build rocksdb 5.14.2 targetting Android.

The problem comes from this commit:

4708a68

Specifically, this #include should also be made when targeting Android:

https://github.com/facebook/rocksdb/blob/master/env/env_posix.cc#L26

Therefore, this:

#if defined(OS_LINUX) || defined(OS_SOLARIS)
#include <sys/statfs.h>
#include <sys/syscall.h>
#include <sys/sysmacros.h>
#endif

should become this:

#if defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_ANDROID)
#include <sys/statfs.h>
#include <sys/syscall.h>
#include <sys/sysmacros.h>
#endif

Testing and preparing a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions