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

localtime is defined in the header, but has no implementation #20

Closed
zhuowei opened this issue Apr 20, 2019 · 3 comments
Closed

localtime is defined in the header, but has no implementation #20

zhuowei opened this issue Apr 20, 2019 · 3 comments

Comments

@zhuowei
Copy link

zhuowei commented Apr 20, 2019

the localtime function is present in wasi-sysroot's headers, but not in the actual libc library, so programs calling localtime fails during linking:

#include <time.h>

int main() {
	time_t a;
	localtime(&a);
}
zhuowei@zhuowei-laptop:~/wasi-sdk/bin$ ./clang-8 localtime.c 
wasm-ld: error: /tmp/localtime-230b9c.o: undefined symbol: localtime
clang-8: error: lld command failed with exit code 1 (use -v to see invocation)

Either the localtime function should be removed from the header, or an implementation should be added to the libc.

@ericsink
Copy link

I bumped into this problem too. Just to add more information:

The implementation does seem to be present:

libc-top-half/musl/src/time/localtime.c

So I'm guessing this is some kind of (possibly simple) problem with the build.

@kubkon
Copy link
Contributor

kubkon commented Apr 21, 2019

As @ericsink rightly pointed out, the implementation is there, but the symbol is missing from the build as can be seen in defined-symbols.txt (or rather the lack of localtime).

@kubkon
Copy link
Contributor

kubkon commented Apr 21, 2019

Fixed in #22.

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

3 participants