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

undefined references #48

Closed
ghazel opened this issue Mar 26, 2016 · 9 comments
Closed

undefined references #48

ghazel opened this issue Mar 26, 2016 · 9 comments
Assignees
Labels
Milestone

Comments

@ghazel
Copy link

ghazel commented Mar 26, 2016

library compiled and ran fine with r10e. Now with r11b, my project fails to compile:

     [exec] libevent/evutil.c:2345: error: undefined reference to 'issetugid'
     [exec] libevent/evutil_rand.c:198: error: undefined reference to 'arc4random_addrandom'
     [exec] randutil.c:307: error: undefined reference to 'arc4random_stir'

However:

grep -r issetugid /usr/local/Cellar/android-ndk/r11b/platforms/android-14/arch-arm
/usr/local/Cellar/android-ndk/r11b/platforms/android-14/arch-arm/usr/include/unistd.h:extern int issetugid(void);
Binary file /usr/local/Cellar/android-ndk/r11b/platforms/android-14/arch-arm/usr/lib/libc.a matches

Etc.

@ghazel
Copy link
Author

ghazel commented Mar 26, 2016

Trying to use the libevent-provided implementations doesn't work either, because:

     [exec] libevent/./arc4random.c:466:1: error: static declaration of 'arc4random_addrandom' follows non-static declaration
     [exec] arc4random_addrandom(const unsigned char *dat, int datlen)
     [exec] ^
     [exec] /usr/local/Cellar/android-ndk/r11b/platforms/android-14/arch-arm/usr/include/stdlib.h:117:13: note: previous declaration is here
     [exec] extern void arc4random_addrandom(unsigned char *, int);

@ghazel
Copy link
Author

ghazel commented Mar 26, 2016

Similarly, arc4random_stir has a different return value. Why is it declared in sodlib.h and defined in libc at all, if it's not actually present or linkable?

@DanAlbert
Copy link
Member

See #42 for explanation of why the arc4random ones went away.

issetugid never had a real implementation in Android. I don't remember all the details (I'll update if I manage to track them down), but since it was only ever a stub implementation and it isn't a part of POSIX, we removed it.

Leaving the bug opened and assigning to @jmgao because we should fix the headers, but these won't be put back (they've never been in the LP64 ABIs anyway).

@DanAlbert DanAlbert added this to the r12 milestone Mar 28, 2016
@CicTec
Copy link

CicTec commented Apr 14, 2016

Hello,

I have the same problem, library compiled fine with r10e, with r11c fails to compile:
jni/modules/timers/timers.cpp: 64: error: undefine reference to 'ftime'
jni/modules/timers/timers.cpp: 93: error: undefine reference to 'ftime'

Regards

@DanAlbert DanAlbert modified the milestones: r12, r13 May 12, 2016
@CicTec
Copy link

CicTec commented May 31, 2016

Hello
I see that the r12-beta2 continues to have the same reference issue with some library functions (such as FTIME), you might be able to get the fix for the final r12 ?

Regards.

@DanAlbert
Copy link
Member

Unfortunately it's going to have to be r13. Our grand plan of replacing all the headers with the current ones from aosp requires an update to clang (and update containing a patch that has not been written yet).

@DanAlbert
Copy link
Member

This shouldn't be blocking you though. This bug getting fixed just means you get a compile time failure instead of a link time failure.

@jmgao
Copy link
Contributor

jmgao commented May 31, 2016

@CicTec ftime is obsolete, and was removed in POSIX 2008. You should be using time, gettimeofday, or clock_gettime, depending on the level of precision you need.

@CicTec
Copy link

CicTec commented May 31, 2016

Ok, I'll try with these functions, thanks to both.

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

No branches or pull requests

4 participants