[Bug 235583] clang error builtin-requires-header on pthread_create on powerpc64

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Feb 7 18:30:04 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235583

            Bug ID: 235583
           Summary: clang error builtin-requires-header on pthread_create
                    on powerpc64
           Product: Base System
           Version: CURRENT
          Hardware: powerpc
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: threads
          Assignee: threads at FreeBSD.org
          Reporter: alfredo.junior at eldorado.org.br

Created attachment 201820
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=201820&action=edit
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-threads mailing list