marcan / lsirec

LSI SAS2008/SAS2108 low-level recovery tool for Linux
BSD 2-Clause "Simplified" License
187 stars 30 forks source link

Compile issue #3

Closed nthu9280 closed 5 years ago

nthu9280 commented 5 years ago

I'm getting compile errors. I've added -std=c99 to avoid the "for’ loop initial declarations are only allowed in c99 mode" issue

`

~~ make

cc -std=c99 -Wall -O2 lsirec.c -o lsirec lsirec.c: In function ‘lsi_setup_hcdw’: lsirec.c:261:32: error: ‘MAP_ANONYMOUS’ undeclared (first use in this function) MAP_PRIVATE|MAP_ANONYMOUS|MAP_HUGETLB|MAP_LOCKED, 0, 0); ^ lsirec.c:261:32: note: each undeclared identifier is reported only once for each function it appears in lsirec.c:261:46: error: ‘MAP_HUGETLB’ undeclared (first use in this function) MAP_PRIVATE|MAP_ANONYMOUS|MAP_HUGETLB|MAP_LOCKED, 0, 0); ^ lsirec.c:261:58: error: ‘MAP_LOCKED’ undeclared (first use in this function) MAP_PRIVATE|MAP_ANONYMOUS|MAP_HUGETLB|MAP_LOCKED, 0, 0); ^ lsirec.c: In function ‘i2c_delay’: lsirec.c:394:5: warning: implicit declaration of function ‘usleep’ [-Wimplicit-function-declaration] usleep(5); ^ make: *** [lsirec] Error 1


gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)

uname -r 3.10.0-957.5.1.el7.x86_64


cat /etc/os-release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.6 (Maipo)"

REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.6"

`

ezonakiusagi commented 5 years ago

can you run this and paste the output?:

gcc -M -MG lsirec.c

nthu9280 commented 5 years ago

Please see be output below.

` gcc -M -MG lsirec.c lsirec.o: lsirec.c /usr/include/stdc-predef.h /usr/include/stdio.h \ /usr/include/features.h /usr/include/sys/cdefs.h \ /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ /usr/include/gnu/stubs-64.h \ /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/stddef.h \ /usr/include/bits/types.h /usr/include/bits/typesizes.h \ /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/stdarg.h \ /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ /usr/include/string.h /usr/include/xlocale.h \ /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/stdint.h \ /usr/include/stdint.h /usr/include/bits/wchar.h /usr/include/sys/mman.h \ /usr/include/bits/mman.h /usr/include/sys/types.h /usr/include/time.h \ /usr/include/endian.h /usr/include/bits/endian.h \ /usr/include/bits/byteswap.h /usr/include/bits/byteswap-16.h \ /usr/include/sys/select.h /usr/include/bits/select.h \ /usr/include/bits/sigset.h /usr/include/bits/time.h \ /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ /usr/include/sys/stat.h /usr/include/bits/stat.h \ /usr/include/sys/errno.h /usr/include/errno.h /usr/include/bits/errno.h \ /usr/include/linux/errno.h /usr/include/asm/errno.h \ /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ /usr/include/sys/user.h /usr/include/fcntl.h /usr/include/bits/fcntl.h \ /usr/include/bits/fcntl-linux.h /usr/include/unistd.h \ /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ /usr/include/bits/confname.h /usr/include/getopt.h

`

nthu9280 commented 5 years ago

updated the make file -std=gnu99 resolved the issue and was able to successfully compile it.

` make cc -std=gnu99 -Wall -O2 lsirec.c -o lsirec

[root@rhel01 lsirec]# ls LICENSE lsirec lsirec.c Makefile README.md sample_sbr sbrtool.py

[root@rhel01 lsirec]# ./lsirec --help Usage: ./lsirec [args...] `