kometchtech / docker-build

personal docker build for armhf and aarch64
15 stars 5 forks source link

bindをclangでbuildすると失敗する #6

Closed kometchtech closed 4 years ago

kometchtech commented 5 years ago

compilerをclangに変更すると以下のようなエラーになる

#11 53.60 socket.c:1201:11: warning: comparison of integers of different signs: 'unsigned long' and 'long' [-Wsign-compare]
#11 53.60                 cmsgp = CMSG_NXTHDR(msg, cmsgp);
#11 53.60                         ^~~~~~~~~~~~~~~~~~~~~~~
#11 53.60 /usr/include/sys/socket.h:299:44: note: expanded from macro 'CMSG_NXTHDR'
#11 53.60         __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
#11 53.60         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#11 53.64 socket.c:1904:2: error: address argument to atomic operation must be a pointer to _Atomic type ('isc_refcount_t *' (aka 'unsigned int *') invalid)
#11 53.64         isc_refcount_init(&sock->references, 0);
#11 53.64         ^                 ~~~~~~~~~~~~~~~~~
#11 53.64 ../include/isc/refcount.h:44:2: note: expanded from macro 'isc_refcount_init'
#11 53.64         atomic_init(target, value)
#11 53.64         ^           ~~~~~~
#11 53.64 ../include/isc/stdatomic.h:79:2: note: expanded from macro 'atomic_init'
#11 53.64         __c11_atomic_init(obj, desired)
#11 53.64         ^                 ~~~
#11 53.64 socket.c:1957:9: error: address argument to atomic operation must be a pointer to _Atomic type ('isc_refcount_t *' (aka 'unsigned int *') invalid)
#11 53.64         INSIST(isc_refcount_current(&sock->references) == 0);
#11 53.64                ^                    ~~~~~~~~~~~~~~~~~
#11 53.64 ../include/isc/refcount.h:56:17: note: expanded from macro 'isc_refcount_current'
#11 53.64         (uint_fast32_t)atomic_load_explicit(target, memory_order_acquire)
#11 53.64                        ^                    ~~~~~~
#11 53.64 ../include/isc/stdatomic.h:81:2: note: expanded from macro 'atomic_load_explicit'
#11 53.64         __c11_atomic_load(obj, order)
#11 53.64         ^                 ~~~
#11 53.64 ../include/isc/util.h:240:32: note: expanded from macro 'INSIST'
#11 53.64 #define INSIST(e)                       ISC_INSIST(e)
#11 53.64                                                    ^
#11 53.64 ../include/isc/assertions.h:98:22: note: expanded from macro 'ISC_INSIST'
#11 53.64         ((void) (ISC_LIKELY(cond) || \
#11 53.64                             ^~~~
#11 53.64 ../include/isc/likely.h:19:54: note: expanded from macro 'ISC_LIKELY'
#11 53.64 #define ISC_LIKELY(x)            __builtin_expect(!!(x), 1)
#11 53.64                                                      ^
#11 53.67 socket.c:2599:2: error: address argument to atomic operation must be a pointer to _Atomic type ('isc_refcount_t *' (aka 'unsigned int *') invalid)
#11 53.67         isc_refcount_init(&sock->references, 1);
#11 53.67         ^                 ~~~~~~~~~~~~~~~~~
#11 53.67 ../include/isc/refcount.h:44:2: note: expanded from macro 'isc_refcount_init'
#11 53.67         atomic_init(target, value)
#11 53.67         ^           ~~~~~~
#11 53.67 ../include/isc/stdatomic.h:79:2: note: expanded from macro 'atomic_init'
#11 53.67         __c11_atomic_init(obj, desired)
#11 53.67         ^                 ~~~
#11 53.68 libtool: compile:  clang -I/tmp/build -I../../.. -I./include -I./../pthreads/include -I../include -I./../include -I./.. -I/usr/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -pthread -pipe -fPIC -fPIC -FORTIFY_SOURCE=2 -Qunused-arguments -pthread -I/usr/include/libxml2 -fPIC -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing -c stdtime.c  -fPIC -DPIC -o .libs/stdtime.o
#11 53.68 socket.c:2673:10: error: address argument to atomic operation must be a pointer to _Atomic type ('isc_refcount_t *' (aka 'unsigned int *') invalid)
#11 53.68         REQUIRE(isc_refcount_current(&sock->references) == 1);
#11 53.68                 ^                    ~~~~~~~~~~~~~~~~~
#11 53.68 ../include/isc/refcount.h:56:17: note: expanded from macro 'isc_refcount_current'
#11 53.68         (uint_fast32_t)atomic_load_explicit(target, memory_order_acquire)
#11 53.68                        ^                    ~~~~~~
#11 53.68 ../include/isc/stdatomic.h:81:2: note: expanded from macro 'atomic_load_explicit'
#11 53.68         __c11_atomic_load(obj, order)
#11 53.68         ^                 ~~~
#11 53.68 ../include/isc/util.h:236:34: note: expanded from macro 'REQUIRE'
#11 53.68 #define REQUIRE(e)                      ISC_REQUIRE(e)
#11 53.68                                                     ^
#11 53.68 ../include/isc/assertions.h:78:22: note: expanded from macro 'ISC_REQUIRE'
#11 53.68         ((void) (ISC_LIKELY(cond) || \
#11 53.68                             ^~~~
#11 53.68 ../include/isc/likely.h:19:54: note: expanded from macro 'ISC_LIKELY'
#11 53.68 #define ISC_LIKELY(x)            __builtin_expect(!!(x), 1)
#11 53.68                                                      ^
#11 53.68 socket.c:2723:17: error: address argument to atomic operation must be a pointer to _Atomic type ('isc_refcount_t *' (aka 'unsigned int *') invalid)
#11 53.68         int old_refs = isc_refcount_increment(&sock->references);
#11 53.68                        ^                      ~~~~~~~~~~~~~~~~~
#11 53.69 ../include/isc/refcount.h:80:2: note: expanded from macro 'isc_refcount_increment'
#11 53.69         atomic_fetch_add_explicit(target, 1, memory_order_relaxed)
#11 53.69         ^                         ~~~~~~
#11 53.69 ../include/isc/stdatomic.h:85:2: note: expanded from macro 'atomic_fetch_add_explicit'
#11 53.69         __c11_atomic_fetch_add(obj, arg, order)
#11 53.69         ^                      ~~~
#11 53.69 socket.c:2741:6: error: address argument to atomic operation must be a pointer to _Atomic type ('isc_refcount_t *' (aka 'unsigned int *') invalid)
#11 53.69         if (isc_refcount_decrement(&sock->references) == 1) {
#11 53.69             ^                      ~~~~~~~~~~~~~~~~~
#11 53.69 ../include/isc/refcount.h:88:2: note: expanded from macro 'isc_refcount_decrement'
#11 53.69         atomic_fetch_sub_explicit(target, 1, memory_order_release)
#11 53.69         ^                         ~~~~~~
#11 53.69 ../include/isc/stdatomic.h:87:2: note: expanded from macro 'atomic_fetch_sub_explicit'
#11 53.69         __c11_atomic_fetch_sub(obj, arg, order)
#11 53.69         ^                      ~~~
#11 53.71 libtool: compile:  clang -I/tmp/build -I../../.. -I./include -I./../pthreads/include -I../include -I./../include -I./.. -I/usr/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -pthread -pipe -fPIC -fPIC -FORTIFY_SOURCE=2 -Qunused-arguments -pthread -I/usr/include/libxml2 -fPIC -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing -c time.c  -fPIC -DPIC -o .libs/time.o
#11 53.73 libtool: compile:  clang -I/tmp/build -I../../.. -I./include -I./../pthreads/include -I../include -I./../include -I./.. -I/usr/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -pthread -pipe -fPIC -fPIC -FORTIFY_SOURCE=2 -Qunused-arguments -pthread -I/usr/include/libxml2 -fPIC -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -fno-strict-aliasing -c syslog.c  -fPIC -DPIC -o .libs/syslog.o
#11 53.73 socket.c:3255:6: error: address argument to atomic operation must be a pointer to _Atomic type ('isc_refcount_t *' (aka 'unsigned int *') invalid)
#11 53.73         if (isc_refcount_increment(&sock->references) == 0) {
#11 53.73             ^                      ~~~~~~~~~~~~~~~~~
#11 53.73 ../include/isc/refcount.h:80:2: note: expanded from macro 'isc_refcount_increment'
#11 53.73         atomic_fetch_add_explicit(target, 1, memory_order_relaxed)
#11 53.73         ^                         ~~~~~~
#11 53.73 ../include/isc/stdatomic.h:85:2: note: expanded from macro 'atomic_fetch_add_explicit'
#11 53.73         __c11_atomic_fetch_add(obj, arg, order)
#11 53.73         ^                      ~~~
#11 53.73 socket.c:3259:3: error: address argument to atomic operation must be a pointer to _Atomic type ('isc_refcount_t *' (aka 'unsigned int *') invalid)
#11 53.73                 isc_refcount_decrement(&sock->references);
#11 53.73                 ^                      ~~~~~~~~~~~~~~~~~
#11 53.73 ../include/isc/refcount.h:88:2: note: expanded from macro 'isc_refcount_decrement'
#11 53.73         atomic_fetch_sub_explicit(target, 1, memory_order_release)
#11 53.73         ^                         ~~~~~~
#11 53.73 ../include/isc/stdatomic.h:87:2: note: expanded from macro 'atomic_fetch_sub_explicit'
#11 53.73         __c11_atomic_fetch_sub(obj, arg, order)
#11 53.73         ^                      ~~~
#11 53.73 socket.c:3281:6: error: address argument to atomic operation must be a pointer to _Atomic type ('isc_refcount_t *' (aka 'unsigned int *') invalid)
#11 53.73         if (isc_refcount_decrement(&sock->references) == 1) {
#11 53.73             ^                      ~~~~~~~~~~~~~~~~~
#11 53.73 ../include/isc/refcount.h:88:2: note: expanded from macro 'isc_refcount_decrement'
#11 53.73         atomic_fetch_sub_explicit(target, 1, memory_order_release)
#11 53.73         ^                         ~~~~~~
#11 53.73 ../include/isc/stdatomic.h:87:2: note: expanded from macro 'atomic_fetch_sub_explicit'
#11 53.73         __c11_atomic_fetch_sub(obj, arg, order)
#11 53.73         ^                      ~~~
#11 53.82 socket.c:4820:2: error: address argument to atomic operation must be a pointer to _Atomic type ('isc_refcount_t *' (aka 'unsigned int *') invalid)
#11 53.82         isc_refcount_increment(&nsock->references);
#11 53.82         ^                      ~~~~~~~~~~~~~~~~~~
#11 53.82 ../include/isc/refcount.h:80:2: note: expanded from macro 'isc_refcount_increment'
#11 53.82         atomic_fetch_add_explicit(target, 1, memory_order_relaxed)
#11 53.82         ^                         ~~~~~~
#11 53.82 ../include/isc/stdatomic.h:85:2: note: expanded from macro 'atomic_fetch_add_explicit'
#11 53.82         __c11_atomic_fetch_add(obj, arg, order)
#11 53.82         ^                      ~~~
#11 53.87 socket.c:5535:16: error: address argument to atomic operation must be a pointer to _Atomic type ('isc_refcount_t *' (aka 'unsigned int *') invalid)
#11 53.87                                (int)isc_refcount_current(&sock->references)));
#11 53.87                                     ^                    ~~~~~~~~~~~~~~~~~
#11 53.87 ../include/isc/refcount.h:56:17: note: expanded from macro 'isc_refcount_current'
#11 53.87         (uint_fast32_t)atomic_load_explicit(target, memory_order_acquire)
#11 53.87                        ^                    ~~~~~~
#11 53.87 ../include/isc/stdatomic.h:81:2: note: expanded from macro 'atomic_load_explicit'
#11 53.87         __c11_atomic_load(obj, order)
#11 53.87         ^                 ~~~
#11 53.87 socket.c:5502:31: note: expanded from macro 'TRY0'
#11 53.87 #define TRY0(a) do { xmlrc = (a); if (xmlrc < 0) goto error; } while(0)
#11 53.87                               ^
#11 53.88 socket.c:5638:12: error: address argument to atomic operation must be a pointer to _Atomic type ('isc_refcount_t *' (aka 'unsigned int *') invalid)
#11 53.88                                   (int)isc_refcount_current(&sock->references));
#11 53.88                                        ^                    ~~~~~~~~~~~~~~~~~
#11 53.88 ../include/isc/refcount.h:56:17: note: expanded from macro 'isc_refcount_current'
#11 53.88         (uint_fast32_t)atomic_load_explicit(target, memory_order_acquire)
#11 53.88                        ^                    ~~~~~~
#11 53.88 ../include/isc/stdatomic.h:81:2: note: expanded from macro 'atomic_load_explicit'
#11 53.88         __c11_atomic_load(obj, order)
#11 53.88         ^                 ~~~
#11 53.89 1 warning and 12 errors generated.
#11 53.90 make[3]: *** [Makefile:172: socket.lo] Error 1
#11 53.90 make[3]: *** Waiting for unfinished jobs....
#11 54.18 make[3]: Leaving directory '/tmp/build/lib/isc/unix'
#11 54.18 make[2]: *** [Makefile:203: subdirs] Error 1
#11 54.18 make[2]: Leaving directory '/tmp/build/lib/isc'
#11 54.18 make[1]: *** [Makefile:82: subdirs] Error 1
#11 54.18 make: *** [Makefile:89: subdirs] Error 1
#11 54.18 make[1]: Leaving directory '/tmp/build/lib'

エラーメッセージを見る限り、型変換に失敗してる? FreeBSDではうまくbuild出来ているようなので、何が違うのか確認していく。

kometchtech commented 5 years ago

-Wno-sign-compareを使用しても、まだエラーが発生する。

kometchtech commented 4 years ago

いくつかのパッケージを追加することでclangでbuild出来るようになった。

https://github.com/kometchtech/docker-build/blob/5f7a52a9ead2c9c09f3c1f43c195dc1a600d2ec6/bind/Dockerfile#L8-L9

https://github.com/kometchtech/docker-build/commit/5f7a52a9ead2c9c09f3c1f43c195dc1a600d2ec6#diff-128477f50347d98ee1213d71f27e8886