Bộ xử lý tiền xử lý C ++ / lib / cpp không kiểm tra độ tỉnh


21

Tôi cần biên dịch HDF5 và sau khi cấu hình quá trình, tôi nhận được lỗi này:

configure: error: C++ preprocessor "/lib/cpp" fails sanity check

Và tôi biết tôi đã cppcài đặt trênubuntu

Bất kỳ trợ giúp sẽ được thực sự đánh giá cao :) Đây là đầu ra của dpkg --list | grep compiler

ii  gcc                                                        4:4.8.2-1ubuntu6                                    amd64        GNU C compiler
ii  gcc-4.8                                               4.8.2-19ubuntu1                                     amd64        GNU C compiler
ii  gfortran                                              4:4.8.2-1ubuntu6                                    amd64        GNU Fortran 95 compiler
ii  gfortran-4.8                                          4.8.2-19ubuntu1                                     amd64        GNU Fortran compiler
ii  hardening-includes                                    2.5ubuntu2                                          all          Makefile for enabling compiler flags for security hardening
ii  libllvm3.4:amd64                                      1:3.4-1ubuntu3                                      amd64        Modular compiler and toolchain technologies, runtime library
ii  libxkbcommon0:amd64                                   0.4.1-0ubuntu1                                      amd64        library interface to the XKB compiler

Và đây là lỗi tôi nhận được:

  nazanin@barashka:~/hdf5-1.8.13$ ./configure --with-zlib=/home/nazanin/local    --prefix=/home/nazanin/local
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking shell variables initial values... done
checking if basename works... yes
checking if xargs works... yes
checking for cached host... none
checking for config x86_64-unknown-linux-gnu... no
checking for config x86_64-unknown-linux-gnu... no
checking for config unknown-linux-gnu... no
checking for config unknown-linux-gnu... no
checking for config x86_64-linux-gnu... no
checking for config x86_64-linux-gnu... no
checking for config x86_64-unknown... no
checking for config linux-gnu... found
compiler 'gcc' is GNU gcc-4.8.2
checking for config ./config/site-specific/host-barashka... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking if unsupported combinations of configure options are allowed... no
checking if Fortran interface enabled... no
checking if Fortran 2003 interface enabled... yes
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking dependency style of g++... none
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in `/home/nazanin/hdf5-1.8.13':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details

Tôi có phải sao chép config.log ở đây không? Cảm ơn


Xin vui lòng hiển thị một số dòng trên và dưới!
Volker Siegel

con bạn đầu ra kết quả của dpkg --list | grep compiler?
AlexGreg

Câu trả lời:


24

Nếu đầu ra cấu hình của bạn trông tương tự tho, trình biên dịch C ++ bị thiếu:

[ ... ]
*** C++ compiler and preprocessor
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking dependency style of g++... none
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in `/home/ubuntu/.local/share/Trash/files/openmpi-1.4.1':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.


Để cài đặt trình biên dịch GNU C ++, hãy sử dụng
apt-get install g++


Kết quả đầu ra cấu hình cho thấy ./mình đã cố gắng tìm trình biên dịch C ++ bằng cách kiểm tra nhiều tên trình biên dịch đã biết, từng cái một.
Khi bắt đầu, chúng tôi thấy g++thiếu - một ưu tiên, được kiểm tra trước.
Nhưng nó tiếp tục cố gắng tìm một số trình biên dịch khác mà bạn có thể thích sử dụng.


21

Tôi đã gặp loại lỗi tương tự trong quá trình cài đặt protobuf-2.5.0 trên centos 7, vì điều này tôi phải cài đặt gcc-c ++ bằng lệnh -

 yum install gcc-c++

2
yumlà trình quản lý gói của một bản phân phối Linux khác ngoài chủ đề ở đây. Ubuntu sử dụng Apt.
David Foerster

11
Tôi chỉ định hét lên rằng google đã đưa tôi đến đây và câu trả lời của anh ấy vẫn rất hữu ích.
Shadoninja

3
Cảm ơn bạn vì câu trả lời này, ngay cả khi nó không đúng chủ đề. Giúp tôi ra ngoài.
Ed Daniel

2
Cảm ơn. Điều này giúp tôi tiết kiệm cài đặt PHP 7.0 trên máy Amazon Linux.
Marcos Regis

2

Giải pháp của tôi là tạo một symlink tại / lib / cpp trỏ đến gcc.

ln -sv "$(which gcc)" /lib/cpp


1

Đặt điều này trong môi trường của bạn có thể thực hiện các mẹo:

GCC_PATH=#add the root directory to the gcc installation
export CPPFLAGS=-I$GCC_PATH/include/c++/5.3.0:$CPPFLAGS

Nếu nó hoạt động, điều đó có nghĩa là có một xung đột thư viện giữa phiên bản gcc mà bạn muốn sử dụng và phiên bản của gcc mà nó đang cố gắng đưa vào.

Khi sử dụng trang web của chúng tôi, bạn xác nhận rằng bạn đã đọc và hiểu Chính sách cookieChính sách bảo mật của chúng tôi.
Licensed under cc by-sa 3.0 with attribution required.