cornelisnetworks / opa-psm2

Other
36 stars 29 forks source link

PSM2_10.3.58 compilation raises error #30

Closed ael-code closed 5 years ago

ael-code commented 6 years ago

I tried to compile psm2 from source and I've got a compilation error.

gcc version:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/gpfs/apps/MN4/GCC/8.1.0/bin/../libexec/gcc/x86_64-suse-linux/8.1.0/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/apps/GCC/8.1.0 --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --without-system-libunwind --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl --enable-gnu-indirect-function --enable-secureplt --with-long-double-128 --enable-targets=x86_64-linux --disable-multilib --with-cpu-64=skylake --with-tune-64=skylake --build=x86_64-suse-linux --host=x86_64-suse-linux --enable-ld --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-linux-futex --enable-lto --enable-plugin --enable-libada --enable-libssp --disable-libssp --disable-libmudflap --with-pkgversion='SUSE Linux' --enable-version-specific-runtime-libs --program-suffix=-8.1
Thread model: posix
gcc version 8.1.0 (SUSE Linux) 

PSM2 tarball release version:

opa-psm2-PSM2_10.3.58

Compilation error:

gcc   -pthread -Wall -Werror -msse4.2 -D_DEFAULT_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -O3 -g3 -fpic -fPIC -D_GNU_SOURCE -DNVALGRIND  -funwind-tables -Wno-strict-aliasing -Wformat-security  -pthread -Wall -Werror -msse4.2 -D_DEFAULT_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -O3 -g3 -fpic -fPIC -D_GNU_SOURCE -DNVALGRIND  -funwind-tables -Wno-strict-aliasing -Wformat-security -I. -I~/projs/libfabric/opa-psm2-PSM2_10.3.58/include -I~/projs/libfabric/opa-psm2-PSM2_10.3.58/mpspawn -I~/projs/libfabric/opa-psm2-PSM2_10.3.58/include/linux-x86_64 -I/usr/include/uapi -I~/projs/libfabric/opa-psm2-PSM2_10.3.58 -MMD -c ~/projs/libfabric/opa-psm2-PSM2_10.3.58/psm_utils.c -o ~/projs/libfabric/opa-psm2-PSM2_10.3.58/build_release/psm_utils.o
~/projs/libfabric/opa-psm2-PSM2_10.3.58/psm_utils.c: In function ‘psmi_faultinj_getspec’:
~/projs/libfabric/opa-psm2-PSM2_10.3.58/psm_utils.c:955:59: error: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size between 110 and 237 [-Werror=format-truncation=]
   snprintf(fdesc, sizeof(fdesc) - 1, "Fault Injection %s <%s>",
                                                           ^~
     fname, fvals_str);
            ~~~~~~~~~                                       
~/projs/libfabric/opa-psm2-PSM2_10.3.58/psm_utils.c:955:3: note: ‘snprintf’ output between 20 and 274 bytes into a destination of size 255
   snprintf(fdesc, sizeof(fdesc) - 1, "Fault Injection %s <%s>",
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     fname, fvals_str);
     ~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Makefile:523: recipe for target '~/projs/libfabric/opa-psm2-PSM2_10.3.58/build_release/psm_utils.o' failed
make[1]: *** [~/projs/libfabric/opa-psm2-PSM2_10.3.58/build_release/psm_utils.o] Error 1
make[1]: Leaving directory '~/projs/libfabric/opa-psm2-PSM2_10.3.58'
Makefile:279: recipe for target 'all' failed
make: *** [all] Error 2
ael-code commented 5 years ago

I've solved temporary by settings CFLAGS with -Wno-format-truncation

aravindksg commented 5 years ago

Issue fixed with commit 8a12e84