Skip to content

Instantly share code, notes, and snippets.

@hiroyuki-sato
Last active July 15, 2020 00:49
Show Gist options
  • Select an option

  • Save hiroyuki-sato/23bb71f055871feefc2928be5171054a to your computer and use it in GitHub Desktop.

Select an option

Save hiroyuki-sato/23bb71f055871feefc2928be5171054a to your computer and use it in GitHub Desktop.
ucs build 20200713

C

#include <stdio.h>
#include <sys/types.h>

typedef int64_t ucs_bus_id_bit_rep_t;

int main(){
    ucs_bus_id_bit_rep_t v = 12345;

    printf("sizeof: %lu\n",sizeof(ucs_bus_id_bit_rep_t));
    printf("%ld\n",v);

    return(0);
}
sizeof: 8
12345

macOSの場合

cc -v
Apple clang version 11.0.3 (clang-1103.0.32.62)
cc test.c
test.c:9:20: warning: format specifies type 'long' but the argument has type
      'ucs_bus_id_bit_rep_t' (aka 'long long') [-Wformat]
    printf("%ld\n",v);
            ~~~    ^
            %lld
1 warning generated.

Linux (CentOS7の場合)

gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) エラーを出さずに、ビルドできる。

%lldにするとエラーになる

test.c: In functionmain’:
test.c:10:5: warning: format ‘%lldexpects argument of typelong long int’, but argument 2 has typeucs_bus_id_bit_rep_t’ [-Wformat=]
     printf("%lld\n",v);
     ^
#  if __WORDSIZE == 64
typedef long int int64_t;
#  elif __GLIBC_HAVE_LONG_LONG
__extension__ typedef long long int int64_t;
#  endif
# endif
make -k
CC algorithm/libucs_la-crc.lo
CC algorithm/libucs_la-qsort_r.lo
CC arch/aarch64/libucs_la-cpu.lo
CC arch/aarch64/libucs_la-global_opts.lo
CC arch/ppc64/libucs_la-timebase.lo
CC arch/ppc64/libucs_la-global_opts.lo
CC arch/x86_64/libucs_la-cpu.lo
CC arch/x86_64/libucs_la-global_opts.lo
CC arch/libucs_la-cpu.lo
CC async/libucs_la-async.lo
async/async.c:619:9: error: implicit declaration of function 'UCS_ASYNC_SIGNAL_BLOCK' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
UCS_ASYNC_BLOCK(async);
^
async/async.h:108:13: note: expanded from macro 'UCS_ASYNC_BLOCK'
UCS_ASYNC_SIGNAL_BLOCK(_async); \
^
async/async.c:629:9: error: implicit declaration of function 'UCS_ASYNC_SIGNAL_UNBLOCK' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
UCS_ASYNC_UNBLOCK(async);
^
async/async.h:127:13: note: expanded from macro 'UCS_ASYNC_UNBLOCK'
UCS_ASYNC_SIGNAL_UNBLOCK(_async); \
^
2 errors generated.
make: *** [async/libucs_la-async.lo] Error 1
CC async/libucs_la-signal.lo
CC async/libucs_la-pipe.lo
CC async/libucs_la-thread.lo
CC config/libucs_la-global_opts.lo
CC config/libucs_la-ucm_opts.lo
CC config/libucs_la-parser.lo
CC datastruct/libucs_la-arbiter.lo
CC datastruct/libucs_la-callbackq.lo
CC datastruct/libucs_la-frag_list.lo
CC datastruct/libucs_la-mpmc.lo
CC datastruct/libucs_la-mpool.lo
CC datastruct/libucs_la-pgtable.lo
CC datastruct/libucs_la-ptr_array.lo
CC datastruct/libucs_la-strided_alloc.lo
CC datastruct/libucs_la-string_buffer.lo
CC datastruct/libucs_la-string_set.lo
CC debug/libucs_la-assert.lo
CC debug/libucs_la-debug.lo
debug/debug.c:24:10: fatal error: 'link.h' file not found
#include <link.h>
^~~~~~~~
1 error generated.
make: *** [debug/libucs_la-debug.lo] Error 1
CC debug/libucs_la-log.lo
debug/log.c:63:30: error: use of undeclared identifier 'HOST_NAME_MAX'
static char ucs_log_hostname[HOST_NAME_MAX] = {0};
^
debug/log.c:227:17: error: format specifies type 'unsigned long' but the argument has type '__darwin_suseconds_t'
(aka 'int') [-Werror,-Wformat]
UCS_LOG_SHORT_ARG(short_file, line, level,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
debug/log.c:37:5: note: expanded from macro 'UCS_LOG_SHORT_ARG'
UCS_LOG_TIME_ARG(_tv), _short_file, _line, (_comp_conf)->name, \
^
debug/log.c:35:47: note: expanded from macro 'UCS_LOG_TIME_ARG'
#define UCS_LOG_TIME_ARG(_tv) (_tv)->tv_sec, (_tv)->tv_usec
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:57:62: note:
expanded from macro 'snprintf'
__builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
^~~~~~~~~~~
debug/log.c:244:17: error: format specifies type 'unsigned long' but the argument has type '__darwin_suseconds_t'
(aka 'int') [-Werror,-Wformat]
UCS_LOG_SHORT_ARG(short_file, line, level,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
debug/log.c:37:5: note: expanded from macro 'UCS_LOG_SHORT_ARG'
UCS_LOG_TIME_ARG(_tv), _short_file, _line, (_comp_conf)->name, \
^~~~~~~~~~~~~~~~~~~~~
debug/log.c:35:47: note: expanded from macro 'UCS_LOG_TIME_ARG'
#define UCS_LOG_TIME_ARG(_tv) (_tv)->tv_sec, (_tv)->tv_usec
^~~~~~~~~~~~~~
3 errors generated.
make: *** [debug/libucs_la-log.lo] Error 1
CC debug/libucs_la-memtrack.lo
CC memory/libucs_la-memory_type.lo
CC memory/libucs_la-memtype_cache.lo
CC memory/libucs_la-numa.lo
CC memory/libucs_la-rcache.lo
memory/rcache.c:625:56: error: incompatible pointer types passing 'uint64_t *' (aka 'unsigned long long *') to parameter
of type 'unsigned long *' [-Werror,-Wincompatible-pointer-types]
return ucs_sys_get_pfn(region->super.start, 1, &ucs_rcache_region_pfn(region));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/path/to/openucx/ucx/src/ucs/sys/sys.h:345:45: note: passing argument to parameter 'data' here
unsigned long *data);
^
1 error generated.
make: *** [memory/libucs_la-rcache.lo] Error 1
CC profile/libucs_la-profile.lo
CC stats/libucs_la-stats.lo
CC sys/libucs_la-event_set.lo
sys/event_set.c:22:10: fatal error: 'sys/epoll.h' file not found
#include <sys/epoll.h>
^~~~~~~~~~~~~
1 error generated.
make: *** [sys/libucs_la-event_set.lo] Error 1
CC sys/libucs_la-init.lo
CC sys/libucs_la-math.lo
CC sys/libucs_la-module.lo
sys/module.c:26:10: fatal error: 'link.h' file not found
#include <link.h>
^~~~~~~~
1 error generated.
make: *** [sys/libucs_la-module.lo] Error 1
CC sys/libucs_la-string.lo
CC sys/libucs_la-sys.lo
CC sys/libucs_la-iovec.lo
CC sys/libucs_la-sock.lo
sys/sock.c:509:48: error: use of undeclared identifier 'MSG_NOSIGNAL'
ssize_t ret = io_func(fd, data, *length_p, MSG_NOSIGNAL);
^
sys/sock.c:545:30: error: use of undeclared identifier 'MSG_NOSIGNAL'
ret = iov_func(fd, &msg, MSG_NOSIGNAL);
^
2 errors generated.
make: *** [sys/libucs_la-sock.lo] Error 1
CC sys/libucs_la-topo.lo
sys/topo.c:83:54: error: format specifies type 'long' but the argument has type 'ucs_bus_id_bit_rep_t' (aka 'long long')
[-Werror,-Wformat]
ucs_debug("bus id %ld exists. sys_dev = %u", bus_id_bit_rep, *sys_dev);
~~~ ^~~~~~~~~~~~~~
%lld
/path/to/openucx/ucx/src/ucs/debug/log_def.h:48:76: note: expanded from macro 'ucs_debug'
#define ucs_debug(_fmt, ...) ucs_log(UCS_LOG_LEVEL_DEBUG, _fmt, ## __VA_ARGS__)
~~~~ ^~~~~~~~~~~
/path/to/openucx/ucx/src/ucs/debug/log_def.h:41:76: note: expanded from macro 'ucs_log'
ucs_log_component(_level, &ucs_global_opts.log_component, _fmt, ## __VA_ARGS__); \
~~~~ ^~~~~~~~~~~
/path/to/openucx/ucx/src/ucs/debug/log_def.h:35:84: note: expanded from macro 'ucs_log_component'
(ucs_log_level_t)(_level), _comp_log_config, _fmt, ## __VA_ARGS__); \
~~~~ ^~~~~~~~~~~
sys/topo.c:88:61: error: format specifies type 'long' but the argument has type 'ucs_bus_id_bit_rep_t' (aka 'long long')
[-Werror,-Wformat]
ucs_debug("bus id %ld doesn't exist. sys_dev = %u", bus_id_bit_rep,
~~~ ^~~~~~~~~~~~~~
%lld
/path/to/openucx/ucx/src/ucs/debug/log_def.h:48:76: note: expanded from macro 'ucs_debug'
#define ucs_debug(_fmt, ...) ucs_log(UCS_LOG_LEVEL_DEBUG, _fmt, ## __VA_ARGS__)
~~~~ ^~~~~~~~~~~
/path/to/openucx/ucx/src/ucs/debug/log_def.h:41:76: note: expanded from macro 'ucs_log'
ucs_log_component(_level, &ucs_global_opts.log_component, _fmt, ## __VA_ARGS__); \
~~~~ ^~~~~~~~~~~
/path/to/openucx/ucx/src/ucs/debug/log_def.h:35:84: note: expanded from macro 'ucs_log_component'
(ucs_log_level_t)(_level), _comp_log_config, _fmt, ## __VA_ARGS__); \
~~~~ ^~~~~~~~~~~
2 errors generated.
make: *** [sys/libucs_la-topo.lo] Error 1
CC sys/libucs_la-stubs.lo
CC time/libucs_la-time.lo
CC time/libucs_la-timer_wheel.lo
CC time/libucs_la-timerq.lo
CC type/libucs_la-class.lo
CC type/libucs_la-status.lo
CC type/libucs_la-init_once.lo
make: *** No rule to make target `../../src/ucm/libucm.la', needed by `libucs.la'.
make: Target `all' not remade because of errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment