欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

安装pcre时出现configure: error: C compiler cannot create executables错误

程序员文章站 2022-06-04 13:08:17
...

1、./configure时出现以下错误:C compiler cannot create executables

[[email protected] pcre-8.39]# ./configure 
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... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/opt/software/pcre-8.39':
configure: error: C compiler cannot create executables
See `config.log' for more details

2、于是查看config.log文件,发现开始报错处:/usr/bin/ld: cannot find -lgcc_s

gcc: no input files
configure:3809: $? = 1
configure:3829: checking whether the C compiler works
configure:3851: gcc    conftest.c  >&5
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
configure:3855: $? = 1
configure:3893: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "PCRE"
| #define PACKAGE_TARNAME "pcre"
| #define PACKAGE_VERSION "8.39"
| #define PACKAGE_STRING "PCRE 8.39"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "pcre"
| #define VERSION "8.39"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3898: error: in `/opt/software/pcre-8.39':
configure:3900: error: C compiler cannot create executables
See `config.log' for more details

3、再上网找了找cannot find -lgcc_s这个错误,才知道是系统找不到需要链接的库文件(该库文件为libgcc_s.so)

  find / -name libgcc_s.so进行文件查找,发现gcc下有这个文件

[[email protected] pcre-8.39]# find / -name libgcc_s.so
/opt/oracle/app/oracle/product/11.2.0/dbhome_1/lib/stubs/libgcc_s.so
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/32/libgcc_s.so

但是vi编辑这个文件才知道,是个空文件,即libgcc_s.so是一个链接文件,需要链接到对应目录的libgcc_s.so.1文件

于是find / -name libgcc_s.so1,在/usr/lib64/libgcc_s.so.1下(64位机)

[[email protected] pcre-8.39]# find / -name libgcc_s.so.1
/opt/oracle/app/oracle/product/11.2.0/dbhome_1/lib/stubs/libgcc_s.so.1
/root/libgcc_s.so.1
/lib/libgcc_s.so.1
/usr/lib/vmware-tools/lib32/libgcc_s.so.1
/usr/lib/vmware-tools/lib32/libgcc_s.so.1/libgcc_s.so.1
/usr/lib/vmware-tools/lib64/libgcc_s.so.1
/usr/lib/vmware-tools/lib64/libgcc_s.so.1/libgcc_s.so.1
/usr/lib64/libgcc_s.so.1
/lib64/libgcc_s.so.1 

知道问题了,那就好说了,添加libgcc_s.so链接

ln -sf /usr/lib64/libgcc_s.so.1  /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so

好了,再次./configure下,刚才的错误没有了,问题解决

pcre-8.39 configuration summary:

    Install prefix .................. : /usr/local
    C preprocessor .................. : gcc -E
    C compiler ...................... : gcc
    C++ preprocessor ................ : g++ -E
    C++ compiler .................... : g++
    Linker .......................... : /usr/bin/ld -m elf_x86_64
    C preprocessor flags ............ : 
    C compiler flags ................ : -g -O2 -fvisibility=hidden
    C++ compiler flags .............. : -O2 -fvisibility=hidden -fvisibility-inlines-hidden
    Linker flags .................... : 
    Extra libraries ................. : 

    Build 8 bit pcre library ........ : yes
    Build 16 bit pcre library ....... : no
    Build 32 bit pcre library ....... : no
    Build C++ library ............... : yes
    Enable JIT compiling support .... : no
    Enable UTF-8/16/32 support ...... : no
    Unicode properties .............. : no
    Newline char/sequence ........... : lf
    \R matches only ANYCRLF ......... : no
    EBCDIC coding ................... : no
    EBCDIC code for NL .............. : n/a
    Rebuild char tables ............. : no
    Use stack recursion ............. : yes
    POSIX mem threshold ............. : 10
    Internal link size .............. : 2
    Nested parentheses limit ........ : 250
    Match limit ..................... : 10000000
    Match limit recursion ........... : MATCH_LIMIT
    Build shared libs ............... : yes
    Build static libs ............... : yes
    Use JIT in pcregrep ............. : no
    Buffer size for pcregrep ........ : 20480
    Link pcregrep with libz ......... : no
    Link pcregrep with libbz2 ....... : no
    Link pcretest with libedit ...... : no
    Link pcretest with libreadline .. : no
    Valgrind support ................ : no
    Code coverage ................... : no

相关标签: pcre