Skip to content

Android arm64 build error #6

@AlexRamallo

Description

@AlexRamallo

When trying to build EAThread using the 64 bit compilers from the NDK, I get the following errors:

In file included from ../../library/eaoss/src/EAThread/eathread.cpp:89:
../../library/eaoss/src/EAThread/android/eathread_fake_atomic_64.cpp:37:26: error: cast from pointer to smaller type 'unsigned int' loses information
        pthread_mutex_t* lock = EAT_SWAP_LOCK(addr);
                                ^~~~~~~~~~~~~~~~~~~
../../library/eaoss/src/EAThread/android/eathread_fake_atomic_64.cpp:31:54: note: expanded from macro 'EAT_SWAP_LOCK'
#define EAT_SWAP_LOCK(addr) &sFakeAtomic64SwapLocks[((unsigned)(void*)(addr) >> 3U) % EAT_FAKE_ATOMIC_SWAP_LOCK_COUNT]
                                                     ^~~~~~~~~~~~~~~~~~~~~~~
../../library/eaoss/src/EAThread/android/eathread_fake_atomic_64.cpp:52:26: error: cast from pointer to smaller type 'unsigned int' loses information
        pthread_mutex_t* lock = EAT_SWAP_LOCK(addr);
                                ^~~~~~~~~~~~~~~~~~~
../../library/eaoss/src/EAThread/android/eathread_fake_atomic_64.cpp:31:54: note: expanded from macro 'EAT_SWAP_LOCK'
#define EAT_SWAP_LOCK(addr) &sFakeAtomic64SwapLocks[((unsigned)(void*)(addr) >> 3U) % EAT_FAKE_ATOMIC_SWAP_LOCK_COUNT]
                                                     ^~~~~~~~~~~~~~~~~~~~~~~
../../library/eaoss/src/EAThread/android/eathread_fake_atomic_64.cpp:73:26: error: cast from pointer to smaller type 'unsigned int' loses information
        pthread_mutex_t* lock = EAT_SWAP_LOCK(addr);
                                ^~~~~~~~~~~~~~~~~~~
../../library/eaoss/src/EAThread/android/eathread_fake_atomic_64.cpp:31:54: note: expanded from macro 'EAT_SWAP_LOCK'
#define EAT_SWAP_LOCK(addr) &sFakeAtomic64SwapLocks[((unsigned)(void*)(addr) >> 3U) % EAT_FAKE_ATOMIC_SWAP_LOCK_COUNT]
                                                     ^~~~~~~~~~~~~~~~~~~~~~~
3 errors generated.

Changing that macro to use unsigned long for 64 bit builds eliminates the error, but I'm not sure if that will break functionality since it's not clear to me what that macro is doing.

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