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

Android arm64 build error #6

Open
AlexRamallo opened this issue Jul 19, 2020 · 1 comment
Open

Android arm64 build error #6

AlexRamallo opened this issue Jul 19, 2020 · 1 comment

Comments

@AlexRamallo
Copy link

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.

@mgood7123
Copy link

according to https://stackoverflow.com/a/27044460 - "I am using size_t here, because it is always having the same size as a pointer, no matter the platform. A long long would not work for 32bit systems and a long would not work for 64 bit Windows (while 64bit Unix and Unix-like systems like OS X use the LP64 data model, in which a long is 64bit, 64bit Windows uses the LLP64 data model, in which a long has a size of 32bit (http://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models))."

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

No branches or pull requests

2 participants