With simple inclusion of 'uv.h', gcc complains about 'pthread_rwlock_t' type unknown.
In file included from /home/vincent/usr/include/uv.h:62:0,
from /home/vincent/bozCommand/comps/libuv/files/test/helloworld.c:3:
/home/vincent/usr/include/uv-unix.h:137:9: error: unknown type name ‘pthread_rwlock_t’
typedef pthread_rwlock_t uv_rwlock_t;
^~~~
How are you compiling your application? Does libuv (and the test suite) compile?
of course my lib is built and installed.
I used autogen and configure (by default) to install on $HOME/usr prefix.
'make check' succeeded without any issues.
/home/vincent/usr/include/uv.h installed header.
/home/vincent/bozCommand/comps/libuv/files/test/helloworld.c is my file to compile.
my platform is ubuntu x64 16.10 with only native compiler gcc.
Can you paste your example code and how you're compiling it? The test suite uses locks, so the problem must be elsewhere.
int main() {
uv_loop_t *loop = malloc(sizeof(uv_loop_t));
uv_loop_init(loop);
printf("Now quitting.\n");
uv_run(loop, UV_RUN_DEFAULT);
uv_loop_close(loop);
free(loop);
return 0;
}
what is the exact command line you are using to compile?
gcc -Wall -Werror -o test main.c
sorry complete command line is
/usr/bin/cc -I.include/public -I.include -I./comps/fork/files/include -I/usr/include -Wmissing-prototypes -Wbad-function-cast -Wshadow -Wfloat-equal -Wswitch-default -Wno-unused-result -O0 -ggdb -std=c99 -Wall -Wextra -Wmissing-declarations -Wwrite-strings -Wunknown-pragmas -Wformat-security -Wstrict-aliasing -Wreturn-type -Wmissing-noreturn -o comps/fork/files/app/child.c.o -c comps/fork/files/app/child.c
You need to have -lpthread. Or use pkg-config and get the required flags out of the installed pc file.
Closing since it's not a libuv issue.
For future searchers with the same problem:
-std=c99 requests strict POSIX compliance; no extensions like pthread_rwlock_t. Use -std=gnu99 instead.
(Same for -std=c11: use -std=gnu11.)
Most helpful comment
For future searchers with the same problem:
-std=c99requests strict POSIX compliance; no extensions likepthread_rwlock_t. Use-std=gnu99instead.(Same for
-std=c11: use-std=gnu11.)