Created attachment 201820 [details] Disables -Werror,-Wbuiltin-requires-header on powerpc64 I'm trying to cross compile "base" to powerpc64 using both ports/llm-devel (SNAPDATE=20190122) and llvm from git (revision f324f6dcfba71ede8dd213096ec3b2f1b57ded86) and build breaks with the following error: /usr/local/bin/clang -fuse-ld=/usr/local/bin/ld.lld -target powerpc64-unknown-freebsd13.0-elfv2 -mabi=elfv2 --sysroot=/usr/obj/usr/src/powerpc.powerpc64/tmp -B/dev/null -O2 -pipe -DNO__SCCSID -DNO__RCSID -I/usr/src/lib/libc/include -I/usr/src/include -I/usr/src/lib/libc/powerpc64 -DNLS -D__DBINTERFACE_PRIVATE -I/usr/src/contrib/gdtoa -I/usr/src/contrib/libc-vis -DINET6 -I/usr/obj/usr/src/powerpc.powerpc64/lib/libc -I/usr/src/lib/libc/resolv -D_ACL_PRIVATE -DPOSIX_MISTAKE -I/usr/src/lib/libmd -I/usr/src/contrib/jemalloc/include -I/usr/src/contrib/tzcode/stdtime -I/usr/src/lib/libc/stdtime -I/usr/src/lib/libc/locale -DBROKEN_DES -DPORTMAP -DDES_BUILTIN -I/usr/src/lib/libc/rpc -DYP -DNS_CACHING -DSYMBOL_VERSIONING -g -MD -MF.depend.__pthread_mutex_init_calloc_cb_stub.o -MT__pthread_mutex_init_calloc_cb_stub.o -std=gnu99 -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Qunused-arguments -I/usr/src/lib/libutil -I/usr/src/lib/msun/powerpc -I/usr/src/lib/msun/src -c /usr/src/lib/libc/gen/__pthread_mutex_init_calloc_cb_stub.c -o __pthread_mutex_init_calloc_cb_stub.o In file included from /usr/src/lib/libc/gen/__pthread_mutex_init_calloc_cb_stub.c:36: /usr/src/include/pthread.h:212:6: error: declaration of built-in function 'pthread_create' requires inclusion of the header <pthread.h> [-Werror,-Wbuiltin-requires-header] int pthread_create(pthread_t * __restrict, ^ 1 error generated. *** Error code 1 Stop. make[2]: stopped in /usr/src/lib/libc # It appears that clang is getting confused about having to include Clang's built-in "pthread.h" while it's trying to compile FreeBSD "pthread.h" itself. I found similar issue here: https://lkml.org/lkml/2019/1/11/718 The error repeats mentioning "pthread_create" on many other places. As workaround I created the patch attached. Please let me know your thoughts.
I confirmed this affects other platforms, so a new patch was added to: https://reviews.freebsd.org/D19236