epam / nfstrace

Network file system monitor and analyzer
http://epam.github.io/nfstrace/
GNU General Public License v2.0
151 stars 34 forks source link

Compiling errors on Fedora 29 #36

Closed pierg75 closed 3 years ago

pierg75 commented 6 years ago

I'm trying to compile it on F29 but I get some issues:

$ make                                                                                                                                                                                      Scanning dependencies of target nfstrace                                                                                                                                                                                                      
[  1%] Building CXX object CMakeFiles/nfstrace.dir/src/analysis/analysis_manager.cpp.o                                                                                                                                                         
In file included from /home/plambri/sources/upstream/nfstrace/src/api/ianalyzer.h:28,                                                                                                                                                                           from /home/plambri/sources/upstream/nfstrace/src/api/plugin_api.h:30,                                                                                                                                                        
                 from /home/plambri/sources/upstream/nfstrace/src/analysis/plugin.h:27,                                                                                                                                                        
                 from /home/plambri/sources/upstream/nfstrace/src/analysis/analyzers.h:28,                                                                                                                                                     
                 from /home/plambri/sources/upstream/nfstrace/src/analysis/analysis_manager.h:27,                                                                                                                                              
                 from /home/plambri/sources/upstream/nfstrace/src/analysis/analysis_manager.cpp:22:                                                                                                                                           
/home/plambri/sources/upstream/nfstrace/src/api/nfs3_types_rpcgen.h:25:10: fatal error: rpc/rpc.h: No such file or directory                                                                                                                  
 #include <rpc/rpc.h>                                                                                                                                                                                                                         
          ^~~~~~~~~~~                                                                                                                                                                                                                         
compilation terminated.                                                                                                                                                                                                                        
make[2]: *** [CMakeFiles/nfstrace.dir/build.make:63: CMakeFiles/nfstrace.dir/src/analysis/analysis_manager.cpp.o] Error 1                                                                                                                     
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/nfstrace.dir/all] Error 2                                                                                                                                                                    
make: *** [Makefile:163: all] Error 2                                                                                                    

Adding the header dir for libtirpc I then get:

c++:

$ make                                  
Scanning dependencies of target nfstrace                                                     
[  1%] Building CXX object CMakeFiles/nfstrace.dir/src/analysis/analysis_manager.cpp.o                                                                                                                                                         [  3%] Building CXX object CMakeFiles/nfstrace.dir/src/analysis/analyzers.cpp.o
[  5%] Building CXX object CMakeFiles/nfstrace.dir/src/analysis/cifs_parser.cpp.o
[  6%] Building CXX object CMakeFiles/nfstrace.dir/src/analysis/nfs_parser.cpp.o
In file included from /home/plambri/sources/upstream/nfstrace/src/analysis/nfs_parser.h:28,
                 from /home/plambri/sources/upstream/nfstrace/src/analysis/nfs_parser.cpp:22:
/home/plambri/sources/upstream/nfstrace/src/protocols/nfs/nfs_procedure.h: In instantiation of ‘NST::protocols::NFSProcedure<ArgType, ResType>::NFSProcedure(NST::protocols::xdr::XDRDecoder&, NST::protocols::xdr::XDRDecoder&, const NST::API
::Session*) [with ArgType = NST::API::NFS3::NULL3args; ResType = NST::API::NFS3::NULL3res]’:
/home/plambri/sources/upstream/nfstrace/src/analysis/nfs_parser.cpp:143:78:   required from here
/home/plambri/sources/upstream/nfstrace/src/protocols/nfs/nfs_procedure.h:54:15: error: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct NST::API::NFS3::NULL3args’; use assignment or value-initialization in
stead [-Werror=class-memaccess]                                                                                                                                                                                                               
         memset(&arg, 0, sizeof(arg));
         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/plambri/sources/upstream/nfstrace/src/api/ianalyzer.h:28,
                 from /home/plambri/sources/upstream/nfstrace/src/api/plugin_api.h:30,                              
                 from /home/plambri/sources/upstream/nfstrace/src/analysis/plugin.h:27,
                 from /home/plambri/sources/upstream/nfstrace/src/analysis/analyzers.h:28,
                 from /home/plambri/sources/upstream/nfstrace/src/analysis/nfs_parser.h:25,
                 from /home/plambri/sources/upstream/nfstrace/src/analysis/nfs_parser.cpp:22:
/home/plambri/sources/upstream/nfstrace/src/api/nfs3_types_rpcgen.h:264:8: note: ‘struct NST::API::NFS3::NULL3args’ declared here
 struct NULL3args
        ^~~~~~~~~

clang:

$ make                                  
Scanning dependencies of target nfstrace                                                     
[  1%] Building CXX object CMakeFiles/nfstrace.dir/src/analysis/analysis_manager.cpp.o                                                                                                                                                         
In file included from /home/plambri/sources/upstream/nfstrace/src/analysis/analysis_manager.cpp:22:                 
In file included from /home/plambri/sources/upstream/nfstrace/src/analysis/analysis_manager.h:28:
/home/plambri/sources/upstream/nfstrace/src/analysis/parser_thread.h:47:19: error: braces around scalar initializer [-Werror,-Wbraced-scalar-init]                                                                                             
        , running{ATOMIC_FLAG_INIT} // false                                                                                                                                                                                                  
                  ^~~~~~~~~~~~~~~~                                                         
/usr/bin/../lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/atomic_base.h:157:26: note: expanded from macro 'ATOMIC_FLAG_INIT'
#define ATOMIC_FLAG_INIT { 0 }                                                                                                   
                         ^~~~~                                                                                      
1 error generated.                                                                       
make[2]: *** [CMakeFiles/nfstrace.dir/build.make:63: CMakeFiles/nfstrace.dir/src/analysis/analysis_manager.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/nfstrace.dir/all] Error 2                  
make: *** [Makefile:163: all] Error 2                                                                                                                                             
andrewshadura commented 6 years ago

The same issue’s on Debian with GCC-8: https://bugs.debian.org/897819

pierg75 commented 6 years ago

Thanks, adding -Wno-class-memaccess -Wno-ignored-qualifiers indeed helps to move forward but then I get:

[ 46%] Linking CXX executable nfstrace                                                                                                                                                                                                         
/usr/bin/ld: CMakeFiles/nfstrace.dir/src/analysis/nfs_parser.cpp.o: in function `NST::analysis::analyze_nfsv3_procedure(unsigned int, NST::protocols::xdr::XDRDecoder&&, NST::protocols::xdr::XDRDecoder&&, NST::analysis::Session const*, NST:
:analysis::Analyzers&)':                                                                                                                                                                                                                       
nfs_parser.cpp:(.text+0x2a13): undefined reference to `xdr_free'                                                                                                                                                                               
/usr/bin/ld: nfs_parser.cpp:(.text+0x2a1a): undefined reference to `xdr_replymsg'                                                                                                                                                              
/usr/bin/ld: nfs_parser.cpp:(.text+0x2a23): undefined reference to `xdr_free'                                                                                                                                                                  
/usr/bin/ld: nfs_parser.cpp:(.text+0x2a36): undefined reference to `xdr_free'                                                                                                                                                                  
/usr/bin/ld: nfs_parser.cpp:(.text+0x2a3d): undefined reference to `xdr_callmsg'                                                                                                                                                               
/usr/bin/ld: nfs_parser.cpp:(.text+0x2a45): undefined reference to `xdr_free'                                                                                                                                                                  
/usr/bin/ld: nfs_parser.cpp:(.text+0x2ab3): undefined reference to `xdr_free'                                                                     

Because I added the dir to the libtirpc headers for rpc.h, I then wonder which rpc headers is using on debian.

zdzichu commented 5 years ago

Glibc removed RPC headers, you need to use libtirpc.

andrewshadura commented 3 years ago

Please remove the RedHat/Fedora conditional, since this applies to all systems shipping glibc 2.32 or later.