axboe / fio

Flexible I/O Tester
GNU General Public License v2.0
5.2k stars 1.26k forks source link

Windows Cygwin build error due to recent MinGW FORTIFY_SOURCE changes #881

Closed wxlg1117 closed 4 years ago

wxlg1117 commented 4 years ago
Administrator@WIN12R2DC ~/fio
$ uname -a
CYGWIN_NT-6.3 WIN12R2DC 3.0.7(0.338/5/3) 2019-04-30 18:08 x86_64 Cygwin

Administrator@WIN12R2DC ~/fio
$ git log
commit 41ceb6c79aea52bd46ea13c5036722a294bb719e (HEAD -> master, origin/master, origin/HEAD)
Author: Vincent Fu <vincent.fu@wdc.com>
Date:   Tue Dec 10 12:54:42 2019 -0500

    t/run-fio-tests: relax acceptance criterion for t0011

    I saw a handful of benign failures for t0011 when run on
    travis/appveyor. This patch allows the test to still pass with a
    measured IOPS of 998 to 1002 and adds a debug print for the value
    actually observed.

    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Administrator@WIN12R2DC ~/fio
$ ./configure
Forcing some known good options on Windows
Operating system              CYGWIN_NT-6.3
CPU                           x86_64
Big endian                    no
Target Windows version        7
Compiler                      x86_64-w64-mingw32-gcc
Cross compile                 no

Static build                  yes
Wordsize                      32
zlib                          yes
Linux AIO support             no
Linux AIO over io_uring       no
POSIX AIO support             no
POSIX AIO support needs -lrt  no
POSIX AIO fsync               no
POSIX pshared support         no
Solaris AIO support           no
__sync_fetch_and_add          yes
__sync_synchronize            yes
__sync_val_compare_and_swap   yes
libverbs                      no
rdmacm                        no
asprintf()                    yes
vasprintf()                   yes
Linux fallocate               no
POSIX fadvise                 no
POSIX fallocate               no
sched_setaffinity(3 arg)      no
sched_setaffinity(2 arg)      no
clock_gettime                 yes
CLOCK_MONOTONIC               yes
CLOCK_MONOTONIC_RAW           no
CLOCK_MONOTONIC_PRECISE       no
clockid_t                     yes
gettimeofday                  yes
fdatasync                     yes
sync_file_range               no
EXT4 move extent              no
Linux splice(2)               no
GUASI                         no
libnuma                       no
strsep                        no
strcasestr                    no
strlcat                       no
getopt_long_only()            yes
inet_aton                     no
socklen_t                     yes
__thread                      yes
RUSAGE_THREAD                 yes
SCHED_IDLE                    yes
TCP_NODELAY                   yes
Net engine window_size        no
TCP_MAXSEG                    no
RLIMIT_MEMLOCK                no
pwritev/preadv                no
pwritev2/preadv2              no
IPv6 helpers                  yes
http engine                   no
Rados engine                  no
Rados Block Device engine     no
setvbuf                       yes
Gluster API engine            no
s390_z196_facilities          no
HDFS engine                   no
MTD                           no
libpmem                       no
libpmemblk                    no
PMDK pmemblk engine           no
PMDK dev-dax engine           no
PMDK libpmem engine           no
DDN's Infinite Memory Engine  no
iscsi engine                  no
NBD engine                    no
lex/yacc for arithmetic       no
getmntent                     no
getmntinfo                    no
Static Assert                 yes
bool                          yes
strndup                       no
Valgrind headers              no
Zoned block device support    no
march_armv8_a_crc_crypto      no
cuda                          no
mkdir(a, b)                   no
Build march=native            yes
CUnit                         yes
__kernel_rwf_t                no
-Wimplicit-fallthrough        yes
MADV_HUGEPAGE                 no
gettid                        no
TCMalloc support              no

Administrator@WIN12R2DC ~/fio
$ make
FIO_VERSION = fio-3.16-73-g41ce
    CC crc/crc16.o
    CC crc/crc32.o
    CC crc/crc32c-arm64.o
    CC crc/crc32c-intel.o
    CC crc/crc32c.o
    CC crc/crc64.o
    CC crc/crc7.o
    CC crc/fnv.o
    CC crc/md5.o
    CC crc/murmur3.o
    CC crc/sha1.o
    CC crc/sha256.o
    CC crc/sha3.o
    CC crc/sha512.o
    CC crc/test.o
    CC crc/xxhash.o
    CC lib/axmap.o
    CC lib/bloom.o
    CC lib/flist_sort.o
    CC lib/gauss.o
    CC lib/getrusage.o
    CC lib/hweight.o
    CC lib/ieee754.o
    CC lib/lfsr.o
    CC lib/memalign.o
    CC lib/memcpy.o
    CC lib/mountcheck.o
    CC lib/num2str.o
    CC lib/output_buffer.o
    CC lib/pattern.o
    CC lib/prio_tree.o
    CC lib/rand.o
    CC lib/rbtree.o
    CC lib/strntol.o
    CC lib/zipf.o
    CC gettime.o
    CC ioengines.o
    CC init.o
    CC stat.o
    CC log.o
    CC time.o
    CC filesetup.o
    CC eta.o
    CC verify.o
    CC memory.o
    CC io_u.o
    CC parse.o
    CC fio_sem.o
    CC rwlock.o
    CC pshared.o
    CC options.o
    CC smalloc.o
    CC filehash.o
    CC profile.o
    CC debug.o
    CC engines/cpu.o
    CC engines/mmap.o
    CC engines/sync.o
    CC engines/null.o
    CC engines/net.o
    CC engines/ftruncate.o
    CC engines/filecreate.o
    CC server.o
    CC client.o
    CC iolog.o
    CC backend.o
    CC libfio.o
    CC flow.o
    CC cconv.o
    CC gettime-thread.o
    CC helpers.o
    CC json.o
    CC idletime.o
    CC td_error.o
    CC profiles/tiobench.o
    CC profiles/act.o
    CC io_u_queue.o
    CC filelock.o
    CC workqueue.o
    CC rate-submit.o
    CC optgroup.o
    CC helper_thread.o
    CC steadystate.o
    CC zone-dist.o
    CC engines/windowsaio.o
    CC oslib/asprintf.o
    CC oslib/strsep.o
    CC oslib/strcasestr.o
    CC oslib/strlcat.o
    CC oslib/strndup.o
    CC oslib/inet_aton.o
    CC os/windows/posix.o
    CC fio.o
  LINK fio
options.o: In function `sprintf':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:909: undefined reference to `__chk_fail'
options.o: In function `memcpy':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/string.h:202: undefined reference to `__memcpy_chk'
options.o: In function `sprintf':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:909: undefined reference to `__chk_fail'
parse.o: In function `sprintf':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:909: undefined reference to `__chk_fail'
init.o: In function `strncpy':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/string.h:240: undefined reference to `__strncpy_chk'
init.o: In function `sprintf':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:909: undefined reference to `__chk_fail'
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:909: undefined reference to `__chk_fail'
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:909: undefined reference to `__chk_fail'
verify.o: In function `sprintf':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:909: undefined reference to `__chk_fail'
filesetup.o: In function `sprintf':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:909: undefined reference to `__chk_fail'
eta.o:/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:909: more undefined references to `__chk_fail' follow
client.o: In function `strcpy':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/string.h:228: undefined reference to `__strcpy_chk'
crc/test.o: In function `sprintf':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:909: undefined reference to `__chk_fail'
server.o: In function `sprintf':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:909: undefined reference to `__chk_fail'
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:909: undefined reference to `__chk_fail'
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:909: undefined reference to `__chk_fail'
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:909: undefined reference to `__chk_fail'
server.o: In function `memcpy':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/string.h:202: undefined reference to `__memcpy_chk'
/usr/x86_64-w64-mingw32/sys-root/mingw/include/string.h:202: undefined reference to `__memcpy_chk'
server.o: In function `strcpy':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/string.h:228: undefined reference to `__strcpy_chk'
server.o: In function `fread':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:812: undefined reference to `__chk_fail'
lib/num2str.o: In function `sprintf':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:909: undefined reference to `__chk_fail'
lib/strntol.o: In function `memcpy':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/string.h:202: undefined reference to `__memcpy_chk'
profiles/tiobench.o: In function `sprintf':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:909: undefined reference to `__chk_fail'
collect2: error: ld returned 1 exit status
make: *** [Makefile:476: fio] Error 1

Administrator@WIN12R2DC ~/fio

how to fix it ? or anybody can help me how to build fio.exe x64 in linux system..

vincentkfu commented 4 years ago

Here is a patch that fixes this issue: https://github.com/vincentkfu/fio/commit/23c6037b216e45d5de174e1e8921dbe9b646af53

I was going to do some more testing to make sure that the problem wasn't just with my setup but now you have confirmed that it isn't just me.

sitsofe commented 4 years ago

@vincentkfu How come this doesn't turn up on CI? Is this only with new mingw installs?

wxlg1117 commented 4 years ago

@vincentkfu How come this doesn't turn up on CI? Is this only with new mingw installs?

yes !!! before build fio.exe i upgrade cygwin to the latest version use "setup-x86_64.exe --root d:\cygwin64 -q --upgrade-also "

vincentkfu commented 4 years ago

@sitsofe I wondered about that too and was planning to investigate more. The bug report linked in the commit message says that this issue appeared in the middle of October. So my guess is that appveyor is using a mingw install from earlier than that.

sitsofe commented 4 years ago

OK there's lots of talk about this over on https://github.com/msys2/MINGW-packages/issues/5803 too. I guess the only question is whether to change the link flag or use something like -fstack-protector-all...

sitsofe commented 4 years ago

@vincentkfu The mozilla folks (https://bugzilla.mozilla.org/show_bug.cgi?id=1601701 and https://hg.mozilla.org/releases/mozilla-esr68/rev/c677377208c2 ) seem to have taken the -lssp route when using llvm-mingw too so it looks like what you've got is a sensible direction to go.

sitsofe commented 4 years ago

@wxlg1117 I assume @vincentkfu's patch fixes the issue for you?

wxlg1117 commented 4 years ago

@wxlg1117 I assume @vincentkfu's patch fixes the issue for you?

yes, it's perfect .