如何解决在RHEL 7上无法编译librocksdb-sys错误的问题?

时间:2018-11-01 19:09:25

标签: rust rhel rust-cargo libclang rocksdb

我一直在尝试build the Canvas Data Loader。我已经走到第10步了,解决cargo build fail上的依赖关系非常容易,但是在过去的4天里,我一直无法解决librocksdb-sys v5.14.2的依赖关系:

[root@localhost home]# 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-28) (GCC)

[root@localhost home]# rustc -V

rustc 1.30.0 (da5f414c2 2018-10-24)

[root@localhost home]# rustup -V

rustup 1.14.0 (1e51b07cc 2018-10-04)

[root@localhost home]# rustup show

Default host: x86_64-unknown-linux-gnu

stable-x86_64-unknown-linux-gnu (default)
rustc 1.30.0 (da5f414c2 2018-10-24)

[root@localhost home]# cargo build --release

   Compiling gcc v0.3.55                                                                                                         
   Compiling bit-vec v0.4.4                                                                                                      
   Compiling rustc-demangle v0.1.9                                                                                               
   Compiling percent-encoding v1.0.1                                                                                             
   Compiling linked-hash-map v0.5.1                                                                                              
   Compiling language-tags v0.2.2                                                                                                
   Compiling smallvec v0.4.5                                                                                                     
   Compiling uuid v0.5.1                                                                                                         
   Compiling sha1 v0.2.0                                                                                                         
   Compiling bufstream v0.1.4                                                                                                    
   Compiling fnv v1.0.6                                                                                                          
   Compiling untrusted v0.5.1                                                                                                    
   Compiling crossbeam-utils v0.2.2                                                                                              
   Compiling log v0.4.5                                                                                                          
   Compiling arrayvec v0.4.7                                                                                                     
   Compiling num_cpus v1.8.0                                                                                                     
   Compiling iovec v0.1.2                                                                                                        
   Compiling net2 v0.2.33                                                                                                        
   Compiling memchr v1.0.2                                                                                                       
   Compiling atty v0.2.11                                                                                                        
   Compiling rand v0.4.3                                                                                                         
   Compiling which v1.0.5                                                                                                        
   Compiling time v0.1.40                                                                                                        
   Compiling socket2 v0.3.8                                                                                                      
   Compiling lazy_static v1.1.0                                                                                                  
   Compiling memchr v2.1.0                                                                                                       
   Compiling unicase v2.2.0                                                                                                      
   Compiling semver v0.9.0                                                                                                       
   Compiling unreachable v1.0.0                                                                                                  
   Compiling owning_ref v0.3.3                                                                                                   
   Compiling rand_core v0.2.2                                                                                                    
   Compiling regex-syntax v0.6.2                                                                                                 
   Compiling regex-syntax v0.5.6                                                                                                 
   Compiling proc-macro2 v0.3.5                                                                                                  
   Compiling clang-sys v0.23.0                                                                                                   
   Compiling textwrap v0.10.0                                                                                                    
   Compiling humantime v1.1.1                                                                                                    
   Compiling tokio-executor v0.1.5                                                                                               
   Compiling tokio-service v0.1.0                                                                                                
   Compiling relay v0.1.1                                                                                                        
   Compiling block-buffer v0.3.3                                                                                                 
   Compiling unicode-bidi v0.3.4                                                                                                 
   Compiling phf_shared v0.7.23                                                                                                  
   Compiling foreign-types v0.3.2                                                                                                
   Compiling base64 v0.6.0                                                                                                       
   Compiling base64 v0.7.0                                                                                                       
   Compiling nix v0.9.0                                                                                                          
   Compiling base64 v0.9.3                                                                                                       
   Compiling scheduled-thread-pool v0.1.0                                                                                        
   Compiling serde_test v0.8.23                                                                                                  
   Compiling yaml-rust v0.4.2                                                                                                    
   Compiling log v0.3.9                                                                                                          
   Compiling want v0.0.4                                                                                                         
   Compiling bytes v0.4.10                                                                                                       
   Compiling futures-cpupool v0.1.8                                                                                              
   Compiling nom v3.2.1                                                                                                          
   Compiling mio v0.6.16                                                                                                         
   Compiling rand v0.3.22                                                                                                        
   Compiling smallvec v0.6.5                                                                                                     
   Compiling rand v0.5.5                                                                                                         
   Compiling lock_api v0.1.4                                                                                                     
   Compiling rustc_version v0.2.3                                                                                                
   Compiling quote v0.5.2                                                                                                        
   Compiling clap v2.32.0                                                                                                        
   Compiling tokio-current-thread v0.1.3                                                                                         
   Compiling tokio-timer v0.2.7                                                                                                  
   Compiling phf v0.7.23                                                                                                         
   Compiling stringprep v0.1.2                                                                                                   
   Compiling idna v0.1.5                                                                                                         
   Compiling linked-hash-map v0.3.0                                                                                              
   Compiling r2d2 v0.7.4                                                                                                         
   Compiling tokio-io v0.1.10                                                                                                    
   Compiling generic-array v0.9.0                                                                                                
   Compiling mio-uds v0.6.7                                                                                                      
   Compiling parking_lot_core v0.3.1                                                                                             
   Compiling cexpr v0.2.3                                                                                                        
   Compiling twox-hash v1.1.1                                                                                                    
   Compiling atoi v0.2.3                                                                                                         
   Compiling num-traits v0.1.43                                                                                                  
   Compiling serde_json v1.0.32                                                                                                  
   Compiling toml v0.4.8                                                                                                         
   Compiling quote v0.6.8                                                                                                        
   Compiling tokio-codec v0.1.1                                                                                                  
   Compiling crossbeam-epoch v0.3.1                                                                                              
   Compiling crossbeam-epoch v0.5.2                                                                                              
   Compiling thread_local v0.3.6                                                                                                 
   Compiling url v1.7.1                                                                                                          
   Compiling digest v0.7.6                                                                                                       
   Compiling crypto-mac v0.5.2                                                                                                   
   Compiling aho-corasick v0.6.8                                                                                                 
   Compiling mime v0.3.12                                                                                                        
   Compiling chrono v0.4.6                                                                                                       
   Compiling crossbeam-deque v0.2.0                                                                                              
   Compiling syn v0.15.13                                                                                                        
   Compiling crossbeam-deque v0.6.1                                                                                              
   Compiling sha2 v0.7.1                                                                                                         
   Compiling hmac v0.5.0                                                                                                         
   Compiling tokio-threadpool v0.1.8                                                                                             
   Compiling postgres-protocol v0.3.2                                                                                            
   Compiling parking_lot v0.6.4                                                                                                  
   Compiling rayon v0.8.2                                                                                                        
   Compiling mysql_common v0.5.0                                                                                                 
   Compiling serde_derive v1.0.80                                                                                                
   Compiling env_logger v0.5.13                                                                                                  
   Compiling serde-hjson v0.8.2                                                                                                  
   Compiling tokio-reactor v0.1.6                                                                                                
   Compiling tokio-fs v0.1.4                                                                                                     
   Compiling postgres-shared v0.4.2                                                                                              
   Compiling ring v0.12.1                                                                                                        
   Compiling cc v1.0.25                                                                                                          
   Compiling tokio-tcp v0.1.2                                                                                                    
   Compiling tokio-udp v0.1.2                                                                                                    
   Compiling tokio-uds v0.2.3                                                                                                    
   Compiling config v0.8.0                                                                                                       
   Compiling postgres v0.15.2                                                                                                    
   Compiling libloading v0.5.0                                                                                                   
   Compiling openssl-sys v0.9.39                                                                                                 
   Compiling backtrace-sys v0.1.24                                                                                               
   Compiling libz-sys v1.0.25                                                                                                    
   Compiling tokio v0.1.11                                                                                                       
   Compiling r2d2_postgres v0.13.0                                                                                               
   Compiling tokio-core v0.1.17                                                                                                  
   Compiling flate2 v0.2.20                                                                                                      
   Compiling backtrace v0.3.9                                                                                                    
   Compiling tokio-proto v0.1.1                                                                                                  
   Compiling error-chain v0.11.0                                                                                                 
   Compiling hyper v0.11.27                                                                                                      
   Compiling native-tls v0.1.5                                                                                                   
   Compiling mysql v12.3.1                                                                                                       
   Compiling tokio-tls v0.1.4                                                                                                    
   Compiling hyper-tls v0.1.4                                                                                                    
   Compiling librocksdb-sys v5.14.2                                                                                              
error: failed to run custom build command for `librocksdb-sys v5.14.2`                                                           
process didn't exit successfully: `/user1/home/target/release/build/librocksdb-sys-56635e7b678cd86e/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-changed=build.rs
cargo:rerun-if-changed=rocksdb/
cargo:rerun-if-changed=snappy/

--- stderr
thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any of [\'libclang.so\', \'libclang.so.*\', \'libclang-*.so\'], set the LIBCLANG_PATH environment variable to a path where one of these files can be found (skipped: [])"', libcore/result.rs:1009:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

我跟随these instructions安装clang,然后跟随these instructions通过clang构建libcxx。

再次尝试构建时,出现以下错误:

Compiling librocksdb-sys v5.14.2                                                                                              
error: failed to run custom build command for `librocksdb-sys v5.14.2`                                                           
process didn't exit successfully: `/user1/home/target/release/build/librocksdb-sys-56635e7b678cd86e/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-changed=build.rs
cargo:rerun-if-changed=rocksdb/
cargo:rerun-if-changed=snappy/
TARGET = Some("x86_64-unknown-linux-gnu")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-unknown-linux-gnu")
CXX_x86_64-unknown-linux-gnu = None
CXX_x86_64_unknown_linux_gnu = None
HOST_CXX = None
CXX = None
CXXFLAGS_x86_64-unknown-linux-gnu = None
CXXFLAGS_x86_64_unknown_linux_gnu = None
HOST_CXXFLAGS = None
CXXFLAGS = None
DEBUG = Some("false")
running: "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "rocksdb/include/" "-I" "rocksdb/" "-I" "rocksdb/third-party/gtest-1.7.0/fused-src/" "-I" "snappy/" "-I" "." "-Wall" "-Wextra" "-std=c++11" "-Wno-unused-parameter" "-DNDEBUG=1" "-DSNAPPY=1" "-DOS_LINUX=1" "-DROCKSDB_PLATFORM_POSIX=1" "-DROCKSDB_LIB_IO_POSIX=1" "-o" "/user1/home/target/release/build/librocksdb-sys-fe80efb4608df839/out/rocksdb/utilities/blob_db/blob_log_format.o" "-c" "rocksdb/utilities/blob_db/blob_log_format.cc"
running: "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "rocksdb/include/" "-I" "rocksdb/" "-I" "rocksdb/third-party/gtest-1.7.0/fused-src/" "-I" "snappy/" "-I" "." "-Wall" "-Wextra" "-std=c++11" "-Wno-unused-parameter" "-DNDEBUG=1" "-DSNAPPY=1" "-DOS_LINUX=1" "-DROCKSDB_PLATFORM_POSIX=1" "-DROCKSDB_LIB_IO_POSIX=1" "-o" "/user1/home/target/release/build/librocksdb-sys-fe80efb4608df839/out/rocksdb/table/full_filter_block.o" "-c" "rocksdb/table/full_filter_block.cc"
running: "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "rocksdb/include/" "-I" "rocksdb/" "-I" "rocksdb/third-party/gtest-1.7.0/fused-src/" "-I" "snappy/" "-I" "." "-Wall" "-Wextra" "-std=c++11" "-Wno-unused-parameter" "-DNDEBUG=1" "-DSNAPPY=1" "-DOS_LINUX=1" "-DROCKSDB_PLATFORM_POSIX=1" "-DROCKSDB_LIB_IO_POSIX=1" "-o" "/user1/home/target/release/build/librocksdb-sys-fe80efb4608df839/out/rocksdb/utilities/merge_operators/bytesxor.o" "-c" "rocksdb/utilities/merge_operators/bytesxor.cc"
running: "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "rocksdb/include/" "-I" "rocksdb/" "-I" "rocksdb/third-party/gtest-1.7.0/fused-src/" "-I" "snappy/" "-I" "." "-Wall" "-Wextra" "-std=c++11" "-Wno-unused-parameter" "-DNDEBUG=1" "-DSNAPPY=1" "-DOS_LINUX=1" "-DROCKSDB_PLATFORM_POSIX=1" "-DROCKSDB_LIB_IO_POSIX=1" "-o" "/user1/home/target/release/build/librocksdb-sys-fe80efb4608df839/out/rocksdb/cache/clock_cache.o" "-c" "rocksdb/cache/clock_cache.cc"

--- stderr
rocksdb/include/rocksdb/c.h:48:9: warning: #pragma once in main file, err: false
thread 'main' panicked at '

Internal error occurred: Failed to find tool. Is `c++` installed?

', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.25/src/lib.rs:2260:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

c++安装在/usr/include/c++

0 个答案:

没有答案