Tag Archives: gcc

[Solved] gcc: error trying to exec ‘cc1‘: execvp: No such file or directory

An execution error occurred after installing GCC An error occurred while loading the C file

gcc: error trying to exec 'cc1': execvp: No such file or directory

After adding environment variables

whereis cc1

Find out where CC1 is

/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/cc1

Position of CC1 in my centos7

If you can’t find it

locate cc1

Once found, copy

/usr/libexec/gcc/x86_64-redhat-linux/4.8.2

then

PATH="$PATH":/usr/libexec/gcc/x86_64-redhat-linux/4.8.2

Import environment variables

export PATH

That’s it

gcc /usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory

$ gcc -fno-stack-protector -m32 -o hello hello.c
In file included from hello.c:3:
/usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory
   27 | #include <bits/libc-header-start.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

The reason is that the GCC environment is incomplete.

solve:

sudo apt-get install gcc-multilib

command ‘gcc’ failed with exit status 1 error while installing scrapy

When I tried to install Scrapy I got this error:

    warning: no previously-included files found matching '*.py'
Requirement already satisfied (use --upgrade to upgrade): pyOpenSSL in /usr/local/lib/python2.7/site-packages/pyOpenSSL-0.14-py2.7.egg (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): cssselect>=0.9 in /usr/local/lib/python2.7/site-packages/cssselect-0.9.1-py2.7.egg (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5.2 in /usr/local/lib/python2.7/site-packages/six-1.6.1-py2.7.egg (from Scrapy)
Downloading/unpacking zope.interface>=3.6.0 (from Twisted>=10.0.0->Scrapy)
  Downloading zope.interface-4.1.1.tar.gz (864kB): 864kB downloaded
  Running setup.py (path:/tmp/pip_build_root/zope.interface/setup.py) egg_info for package zope.interface

    warning: no previously-included files matching '*.dll' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*.pyo' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
Downloading/unpacking cryptography>=0.2.1 (from pyOpenSSL->Scrapy)
  Downloading cryptography-0.4.tar.gz (260kB): 260kB downloaded
  Running setup.py (path:/tmp/pip_build_root/cryptography/setup.py) egg_info for package cryptography
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    c/_cffi_backend.c:14:17: error: ffi.h: No such file or directory
    In file included from c/_cffi_backend.c:21:
    c/malloc_closure.h:33: error: expected specifier-qualifier-list before 'ffi_closure'
    c/malloc_closure.h: In function 'more_core':
    c/malloc_closure.h:69: warning: division by zero
    c/malloc_closure.h:96: error: 'union mmaped_block' has no member named 'next'
    c/malloc_closure.h: At top level:
    c/malloc_closure.h:105: error: expected ')' before '*' token
    c/malloc_closure.h:113: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
    c/_cffi_backend.c:187: error: expected specifier-qualifier-list before 'ffi_cif'
    c/_cffi_backend.c: In function 'cdataowninggc_dealloc':
    c/_cffi_backend.c:1499: error: 'ffi_closure' undeclared (first use in this function)
    c/_cffi_backend.c:1499: error: (Each undeclared identifier is reported only once
    c/_cffi_backend.c:1499: error: for each function it appears in.)
    c/_cffi_backend.c:1499: error: 'closure' undeclared (first use in this function)
    c/_cffi_backend.c:1499: error: expected expression before ')' token
    c/_cffi_backend.c:1502: warning: implicit declaration of function 'cffi_closure_free'
    c/_cffi_backend.c: In function 'cdataowninggc_traverse':
    c/_cffi_backend.c:1514: error: 'ffi_closure' undeclared (first use in this function)
    c/_cffi_backend.c:1514: error: 'closure' undeclared (first use in this function)
    c/_cffi_backend.c:1514: error: expected expression before ')' token
    c/_cffi_backend.c: In function 'cdataowninggc_clear':
    c/_cffi_backend.c:1530: error: 'ffi_closure' undeclared (first use in this function)
    c/_cffi_backend.c:1530: error: 'closure' undeclared (first use in this function)
    c/_cffi_backend.c:1530: error: expected expression before ')' token
    c/_cffi_backend.c: In function 'cdataowning_repr':
    c/_cffi_backend.c:1654: error: 'ffi_closure' undeclared (first use in this function)
    c/_cffi_backend.c:1654: error: expected expression before ')' token
    c/_cffi_backend.c: At top level:
    c/_cffi_backend.c:2200: error: expected declaration specifiers or '...' before 'ffi_abi'
    c/_cffi_backend.c: In function 'cdata_call':
    c/_cffi_backend.c:2334: error: 'ffi_abi' undeclared (first use in this function)
    c/_cffi_backend.c:2334: error: expected ';' before 'fabi'
    c/_cffi_backend.c:2376: error: 'fabi' undeclared (first use in this function)
    c/_cffi_backend.c:2380: error: too many arguments to function 'fb_prepare_cif'
    c/_cffi_backend.c:2385: error: 'cif_description_t' has no member named 'exchange_size'
    c/_cffi_backend.c:2395: error: 'cif_description_t' has no member named 'exchange_offset_arg'
    c/_cffi_backend.c:2425: error: 'cif_description_t' has no member named 'exchange_offset_arg'
    c/_cffi_backend.c:2430: warning: implicit declaration of function 'ffi_call'
    c/_cffi_backend.c:2430: error: 'cif_description_t' has no member named 'cif'
    c/_cffi_backend.c: In function 'b_new_primitive_type':
    c/_cffi_backend.c:3334: error: 'ffi_type' undeclared (first use in this function)
    c/_cffi_backend.c:3334: error: 'ffitype' undeclared (first use in this function)
    c/_cffi_backend.c:3355: error: 'ffi_type_sint8' undeclared (first use in this function)
    c/_cffi_backend.c:3356: error: 'ffi_type_sint16' undeclared (first use in this function)
    c/_cffi_backend.c:3357: error: 'ffi_type_sint32' undeclared (first use in this function)
    c/_cffi_backend.c:3358: error: 'ffi_type_sint64' undeclared (first use in this function)
    c/_cffi_backend.c:3364: error: 'ffi_type_float' undeclared (first use in this function)
    c/_cffi_backend.c:3366: error: 'ffi_type_double' undeclared (first use in this function)
    c/_cffi_backend.c:3368: error: 'ffi_type_longdouble' undeclared (first use in this function)
    c/_cffi_backend.c:3374: error: 'ffi_type_uint8' undeclared (first use in this function)
    c/_cffi_backend.c:3375: error: 'ffi_type_uint16' undeclared (first use in this function)
    c/_cffi_backend.c:3376: error: 'ffi_type_uint32' undeclared (first use in this function)
    c/_cffi_backend.c:3377: error: 'ffi_type_uint64' undeclared (first use in this function)
    c/_cffi_backend.c: At top level:
    c/_cffi_backend.c:3931: error: expected specifier-qualifier-list before 'ffi_type'
    c/_cffi_backend.c:3950: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
    c/_cffi_backend.c: In function 'fb_build':
    c/_cffi_backend.c:4081: error: 'struct funcbuilder_s' has no member named 'atypes'
    c/_cffi_backend.c:4081: error: 'ffi_type' undeclared (first use in this function)
    c/_cffi_backend.c:4081: error: expected expression before ')' token
    c/_cffi_backend.c:4082: error: 'struct funcbuilder_s' has no member named 'nargs'
    c/_cffi_backend.c:4085: error: 'struct funcbuilder_s' has no member named 'rtype'
    c/_cffi_backend.c:4085: warning: implicit declaration of function 'fb_fill_type'
    c/_cffi_backend.c:4093: error: 'cif_description_t' has no member named 'exchange_offset_arg'
    c/_cffi_backend.c:4096: error: 'struct funcbuilder_s' has no member named 'rtype'
    c/_cffi_backend.c:4097: error: 'ffi_arg' undeclared (first use in this function)
    c/_cffi_backend.c:4107: error: 'atype' undeclared (first use in this function)
    c/_cffi_backend.c:4120: error: 'struct funcbuilder_s' has no member named 'atypes'
    c/_cffi_backend.c:4121: error: 'struct funcbuilder_s' has no member named 'atypes'
    c/_cffi_backend.c:4124: error: 'cif_description_t' has no member named 'exchange_offset_arg'
    c/_cffi_backend.c:4131: error: 'cif_description_t' has no member named 'exchange_size'
    c/_cffi_backend.c: In function 'fb_build_name':
    c/_cffi_backend.c:4153: error: 'struct funcbuilder_s' has no member named 'nargs'
    c/_cffi_backend.c:4162: error: 'struct funcbuilder_s' has no member named 'fct'
    c/_cffi_backend.c:4164: error: 'struct funcbuilder_s' has no member named 'fct'
    c/_cffi_backend.c: In function 'fb_prepare_ctype':
    c/_cffi_backend.c:4205: error: 'struct funcbuilder_s' has no member named 'fct'
    c/_cffi_backend.c:4215: error: 'struct funcbuilder_s' has no member named 'fct'
    c/_cffi_backend.c: At top level:
    c/_cffi_backend.c:4235: error: expected declaration specifiers or '...' before 'ffi_abi'
    c/_cffi_backend.c: In function 'fb_prepare_cif':
    c/_cffi_backend.c:4262: warning: implicit declaration of function 'ffi_prep_cif'
    c/_cffi_backend.c:4262: error: 'cif_description_t' has no member named 'cif'
    c/_cffi_backend.c:4262: error: 'fabi' undeclared (first use in this function)
    c/_cffi_backend.c:4262: error: 'struct funcbuilder_s' has no member named 'nargs'
    c/_cffi_backend.c:4263: error: 'struct funcbuilder_s' has no member named 'rtype'
    c/_cffi_backend.c:4263: error: 'struct funcbuilder_s' has no member named 'atypes'
    c/_cffi_backend.c:4263: error: 'FFI_OK' undeclared (first use in this function)
    c/_cffi_backend.c: In function 'b_new_function_type':
    c/_cffi_backend.c:4280: error: 'FFI_DEFAULT_ABI' undeclared (first use in this function)
    c/_cffi_backend.c:4318: error: too many arguments to function 'fb_prepare_cif'
    c/_cffi_backend.c:4326: error: 'struct funcbuilder_s' has no member named 'nargs'
    c/_cffi_backend.c:4336: error: 'struct funcbuilder_s' has no member named 'nargs'
    c/_cffi_backend.c: In function 'convert_from_object_fficallback':
    c/_cffi_backend.c:4360: error: 'ffi_arg' undeclared (first use in this function)
    c/_cffi_backend.c: At top level:
    c/_cffi_backend.c:4432: error: expected ')' before '*' token
    c/_cffi_backend.c: In function 'b_callback':
    c/_cffi_backend.c:4503: error: 'ffi_closure' undeclared (first use in this function)
    c/_cffi_backend.c:4503: error: 'closure' undeclared (first use in this function)
    c/_cffi_backend.c:4524: error: 'ffi_arg' undeclared (first use in this function)
    c/_cffi_backend.c:4542: warning: implicit declaration of function 'cffi_closure_alloc'
    c/_cffi_backend.c:4559: warning: implicit declaration of function 'ffi_prep_closure'
    c/_cffi_backend.c:4559: error: 'cif_description_t' has no member named 'cif'
    c/_cffi_backend.c:4560: error: 'invoke_callback' undeclared (first use in this function)
    c/_cffi_backend.c:4560: error: 'FFI_OK' undeclared (first use in this function)
    c/_cffi_backend.c: In function 'init_cffi_backend':
    c/_cffi_backend.c:5489: error: 'FFI_DEFAULT_ABI' undeclared (first use in this function)
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_root/cryptography/setup.py", line 174, in <module>
        "test": PyTest,
      File "/usr/local/lib/python2.7/distutils/core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "build/bdist.linux-x86_64/egg/setuptools/dist.py", line 260, in __init__
      File "build/bdist.linux-x86_64/egg/setuptools/dist.py", line 285, in fetch_build_eggs
      File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 631, in resolve
      File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 871, in best_match
      File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 883, in obtain
      File "build/bdist.linux-x86_64/egg/setuptools/dist.py", line 335, in fetch_build_egg
      File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 595, in easy_install
      File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 625, in install_item
      File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 822, in install_eggs
      File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1028, in build_and_install
      File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1016, in run_setup
    distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1
    Complete output from command python setup.py egg_info:
    Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

c/_cffi_backend.c:14:17: error: ffi.h: No such file or directory

In file included from c/_cffi_backend.c:21:

c/malloc_closure.h:33: error: expected specifier-qualifier-list before 'ffi_closure'

c/malloc_closure.h: In function 'more_core':

c/malloc_closure.h:69: warning: division by zero

c/malloc_closure.h:96: error: 'union mmaped_block' has no member named 'next'

c/malloc_closure.h: At top level:

c/malloc_closure.h:105: error: expected ')' before '*' token

c/malloc_closure.h:113: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token

c/_cffi_backend.c:187: error: expected specifier-qualifier-list before 'ffi_cif'

c/_cffi_backend.c: In function 'cdataowninggc_dealloc':

c/_cffi_backend.c:1499: error: 'ffi_closure' undeclared (first use in this function)

c/_cffi_backend.c:1499: error: (Each undeclared identifier is reported only once

c/_cffi_backend.c:1499: error: for each function it appears in.)

c/_cffi_backend.c:1499: error: 'closure' undeclared (first use in this function)

c/_cffi_backend.c:1499: error: expected expression before ')' token

c/_cffi_backend.c:1502: warning: implicit declaration of function 'cffi_closure_free'

c/_cffi_backend.c: In function 'cdataowninggc_traverse':

c/_cffi_backend.c:1514: error: 'ffi_closure' undeclared (first use in this function)

c/_cffi_backend.c:1514: error: 'closure' undeclared (first use in this function)

c/_cffi_backend.c:1514: error: expected expression before ')' token

c/_cffi_backend.c: In function 'cdataowninggc_clear':

c/_cffi_backend.c:1530: error: 'ffi_closure' undeclared (first use in this function)

c/_cffi_backend.c:1530: error: 'closure' undeclared (first use in this function)

c/_cffi_backend.c:1530: error: expected expression before ')' token

c/_cffi_backend.c: In function 'cdataowning_repr':

c/_cffi_backend.c:1654: error: 'ffi_closure' undeclared (first use in this function)

c/_cffi_backend.c:1654: error: expected expression before ')' token

c/_cffi_backend.c: At top level:

c/_cffi_backend.c:2200: error: expected declaration specifiers or '...' before 'ffi_abi'

c/_cffi_backend.c: In function 'cdata_call':

c/_cffi_backend.c:2334: error: 'ffi_abi' undeclared (first use in this function)

c/_cffi_backend.c:2334: error: expected ';' before 'fabi'

c/_cffi_backend.c:2376: error: 'fabi' undeclared (first use in this function)

c/_cffi_backend.c:2380: error: too many arguments to function 'fb_prepare_cif'

c/_cffi_backend.c:2385: error: 'cif_description_t' has no member named 'exchange_size'

c/_cffi_backend.c:2395: error: 'cif_description_t' has no member named 'exchange_offset_arg'

c/_cffi_backend.c:2425: error: 'cif_description_t' has no member named 'exchange_offset_arg'

c/_cffi_backend.c:2430: warning: implicit declaration of function 'ffi_call'

c/_cffi_backend.c:2430: error: 'cif_description_t' has no member named 'cif'

c/_cffi_backend.c: In function 'b_new_primitive_type':

c/_cffi_backend.c:3334: error: 'ffi_type' undeclared (first use in this function)

c/_cffi_backend.c:3334: error: 'ffitype' undeclared (first use in this function)

c/_cffi_backend.c:3355: error: 'ffi_type_sint8' undeclared (first use in this function)

c/_cffi_backend.c:3356: error: 'ffi_type_sint16' undeclared (first use in this function)

c/_cffi_backend.c:3357: error: 'ffi_type_sint32' undeclared (first use in this function)

c/_cffi_backend.c:3358: error: 'ffi_type_sint64' undeclared (first use in this function)

c/_cffi_backend.c:3364: error: 'ffi_type_float' undeclared (first use in this function)

c/_cffi_backend.c:3366: error: 'ffi_type_double' undeclared (first use in this function)

c/_cffi_backend.c:3368: error: 'ffi_type_longdouble' undeclared (first use in this function)

c/_cffi_backend.c:3374: error: 'ffi_type_uint8' undeclared (first use in this function)

c/_cffi_backend.c:3375: error: 'ffi_type_uint16' undeclared (first use in this function)

c/_cffi_backend.c:3376: error: 'ffi_type_uint32' undeclared (first use in this function)

c/_cffi_backend.c:3377: error: 'ffi_type_uint64' undeclared (first use in this function)

c/_cffi_backend.c: At top level:

c/_cffi_backend.c:3931: error: expected specifier-qualifier-list before 'ffi_type'

c/_cffi_backend.c:3950: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token

c/_cffi_backend.c: In function 'fb_build':

c/_cffi_backend.c:4081: error: 'struct funcbuilder_s' has no member named 'atypes'

c/_cffi_backend.c:4081: error: 'ffi_type' undeclared (first use in this function)

c/_cffi_backend.c:4081: error: expected expression before ')' token

c/_cffi_backend.c:4082: error: 'struct funcbuilder_s' has no member named 'nargs'

c/_cffi_backend.c:4085: error: 'struct funcbuilder_s' has no member named 'rtype'

c/_cffi_backend.c:4085: warning: implicit declaration of function 'fb_fill_type'

c/_cffi_backend.c:4093: error: 'cif_description_t' has no member named 'exchange_offset_arg'

c/_cffi_backend.c:4096: error: 'struct funcbuilder_s' has no member named 'rtype'

c/_cffi_backend.c:4097: error: 'ffi_arg' undeclared (first use in this function)

c/_cffi_backend.c:4107: error: 'atype' undeclared (first use in this function)

c/_cffi_backend.c:4120: error: 'struct funcbuilder_s' has no member named 'atypes'

c/_cffi_backend.c:4121: error: 'struct funcbuilder_s' has no member named 'atypes'

c/_cffi_backend.c:4124: error: 'cif_description_t' has no member named 'exchange_offset_arg'

c/_cffi_backend.c:4131: error: 'cif_description_t' has no member named 'exchange_size'

c/_cffi_backend.c: In function 'fb_build_name':

c/_cffi_backend.c:4153: error: 'struct funcbuilder_s' has no member named 'nargs'

c/_cffi_backend.c:4162: error: 'struct funcbuilder_s' has no member named 'fct'

c/_cffi_backend.c:4164: error: 'struct funcbuilder_s' has no member named 'fct'

c/_cffi_backend.c: In function 'fb_prepare_ctype':

c/_cffi_backend.c:4205: error: 'struct funcbuilder_s' has no member named 'fct'

c/_cffi_backend.c:4215: error: 'struct funcbuilder_s' has no member named 'fct'

c/_cffi_backend.c: At top level:

c/_cffi_backend.c:4235: error: expected declaration specifiers or '...' before 'ffi_abi'

c/_cffi_backend.c: In function 'fb_prepare_cif':

c/_cffi_backend.c:4262: warning: implicit declaration of function 'ffi_prep_cif'

c/_cffi_backend.c:4262: error: 'cif_description_t' has no member named 'cif'

c/_cffi_backend.c:4262: error: 'fabi' undeclared (first use in this function)

c/_cffi_backend.c:4262: error: 'struct funcbuilder_s' has no member named 'nargs'

c/_cffi_backend.c:4263: error: 'struct funcbuilder_s' has no member named 'rtype'

c/_cffi_backend.c:4263: error: 'struct funcbuilder_s' has no member named 'atypes'

c/_cffi_backend.c:4263: error: 'FFI_OK' undeclared (first use in this function)

c/_cffi_backend.c: In function 'b_new_function_type':

c/_cffi_backend.c:4280: error: 'FFI_DEFAULT_ABI' undeclared (first use in this function)

c/_cffi_backend.c:4318: error: too many arguments to function 'fb_prepare_cif'

c/_cffi_backend.c:4326: error: 'struct funcbuilder_s' has no member named 'nargs'

c/_cffi_backend.c:4336: error: 'struct funcbuilder_s' has no member named 'nargs'

c/_cffi_backend.c: In function 'convert_from_object_fficallback':

c/_cffi_backend.c:4360: error: 'ffi_arg' undeclared (first use in this function)

c/_cffi_backend.c: At top level:

c/_cffi_backend.c:4432: error: expected ')' before '*' token

c/_cffi_backend.c: In function 'b_callback':

c/_cffi_backend.c:4503: error: 'ffi_closure' undeclared (first use in this function)

c/_cffi_backend.c:4503: error: 'closure' undeclared (first use in this function)

c/_cffi_backend.c:4524: error: 'ffi_arg' undeclared (first use in this function)

c/_cffi_backend.c:4542: warning: implicit declaration of function 'cffi_closure_alloc'

c/_cffi_backend.c:4559: warning: implicit declaration of function 'ffi_prep_closure'

c/_cffi_backend.c:4559: error: 'cif_description_t' has no member named 'cif'

c/_cffi_backend.c:4560: error: 'invoke_callback' undeclared (first use in this function)

c/_cffi_backend.c:4560: error: 'FFI_OK' undeclared (first use in this function)

c/_cffi_backend.c: In function 'init_cffi_backend':

c/_cffi_backend.c:5489: error: 'FFI_DEFAULT_ABI' undeclared (first use in this function)

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_root/cryptography/setup.py", line 174, in <module>

    "test": PyTest,

  File "/usr/local/lib/python2.7/distutils/core.py", line 112, in setup

    _setup_distribution = dist = klass(attrs)

  File "build/bdist.linux-x86_64/egg/setuptools/dist.py", line 260, in __init__

  File "build/bdist.linux-x86_64/egg/setuptools/dist.py", line 285, in fetch_build_eggs

  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 631, in resolve

  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 871, in best_match

  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 883, in obtain

  File "build/bdist.linux-x86_64/egg/setuptools/dist.py", line 335, in fetch_build_egg

  File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 595, in easy_install

  File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 625, in install_item

  File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 822, in install_eggs

  File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1028, in build_and_install

  File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1016, in run_setup

distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/cryptography
Storing debug log for failure in /root/.pip/pip.log

Solution :

c/_cffi_backend. c:truth:error:ffi. h:No such file or directory
Install the libffi-devel package
yum install libffi-devel

Gcc compiler warning solution: “extra tokens at end of ifndef directive” Tags: GCC, warning

Recently, after checking all the warnings in the project, we found an interesting warning: “extra tokens at end of ifndef directive”. Literally, “there are invalid instructions after ifndef.”. I wrote a small program verification in private, and found that there are two situations that can generate this warning.

Procedure 1:

// directive_1.c
#include <stdio.h>

#ifndef MIN
  #define MIN(x, y) ((x) > (y) ? (y) : (x)) 
#endif /**/x

int main()
{
	printf("min val = %d\n", MIN(100, -1));

	return 0;
}

The above program intentionally adds an invalid character X after “ENDIF / * * / and compiles with GCC with – wall parameter as follows:
GCC directive_ 1. C - wall - O out1
an alarm is generated immediately:

directive_1.c:5:12: warning: extra tokens at end of #endif directive [-Wendif-labels]
 #endif /**/x

I was immediately shocked. Such an obvious “error” problem was that GCC was just a warning, and generated an executable binary file to execute . / out1 . The result was normal, and the effect was as follows:

min val = -1

Procedure 2:

// directive_2.c
#include <stdio.h>

#ifndef MIN
  #define MIN(x, y) ((x) > (y) ? (y) : (x)) 
#endif

int main()
{
	printf("min val = %d\n", MIN(100, -1));

	return 0;
}

Remove the redundant “X” above, and the compilation will be completely normal. As follows:

wangkai@fiberserver:extra-tokens-at-end-of-#ifndef-directive$ gcc directive_2.c -Wall -o out1
wangkai@fiberserver:extra-tokens-at-end-of-#ifndef-directive$ 

After further divergence of the possible situation after ifndef, it is found that there is another situation that can cause this alarm.

Procedure 3:

// directive_3.c
#include <stdio.h>

#ifndef MIN(x, y)
  #define MIN(x, y) ((x) > (y) ? (y) : (x)) 
#endif

int main()
{
	printf("min val = %d\n", MIN(100, -1));

	return 0;
}

Execute the command “ GCC directive"_ 3. C - wall - O out3 , this alarm also magically appears, as follows:

wangkai@fiberserver:extra-tokens-at-end-of-#ifndef-directive$ gcc directive_3.c -Wall -o out3
directive_3.c:3:12: warning: extra tokens at end of #ifndef directive
 #ifndef MIN(x, y)
            ^

The reason is that the preprocessing of # ifndef in C language only checks the keywords, and the “(x, y)” after it is considered as redundant characters. If the brackets are removed and written as # ifndef min , there will be no alarm.

A solution to the problem of “straight ‘\ 357’ in program” when compiling GCC

Link: http://blog.chinaunix.net/uid-23089249-id-61541.html

I took a few header files from my colleagues. It’s OK to compile them with GCC, but there are a lot of them when I compile them with arm linux GCC!

SerialPort.h:1: error: stray ‘\357’ in program

SerialPort.h:1: error: stray ‘\273’ in program

SerialPort.h:1: error: stray ‘\277’ in program

After looking at these errors, I found that some characters in the file are not supported by the compiler. If you look for these characters one by one, it will take a long time! The simplest solution:

Put the files in the windows system, open these files with Notepad, and then save them as. The code is Asni, and then compile them with the compiler under Linux. Generally, they can pass!

Experience:

The first time: unknown;

Second time: when compiling QT program, prompt this error; solve it according to the above method.

The solution of undefined reference to error

Chen Yunwen

 

When compiling programs under Linux, we often encounter “undefined reference to XXX” error,

Here is a summary of some possible reasons and solutions for those in need:

 

Speaking of undefined reference error, let’s first mention the link rules of Linux GCC

 

The search order of links is as follows:

 

    – L to find the path specified by the environment variable library from left to right_ Path, use the ‘:’ partition to find / etc from left to right/ ld.so.conf The specified path order is / lib and / usr / lib (64 bit is / lib64 and / usr / lib64)

Search order of dynamic library calls:

 

The path specified by the – rpath parameter of

    LD is the path specified by the LD script that is written dead in the code_ LIBRARY_ Path / etc/ ld.so.conf The specified paths / lib and / usr / lib (64 bit is / lib64 and / usr / lib64)
are

In general, we use the – L method to specify the search path when linking, and use LD when calling dynamic link library_ LIBRARY_ Path to specify the link path

Another problem to note is that as long as the first one is found, it will be returned, and the later ones will not be found. For example, – L. / a – L. / B – LX has libx in a, libx. A and libx. A in B libx.so In this case, libx. A in. / a will be used instead of following the principle of dynamic library priority, because. / A is found first and there is no dynamic inventory with the same name in

 

 

For dynamic link library, the actual symbol positioning is carried out at run time. When compiling. So, if the library it needs is not associated with it, such as libx.so You need to use uldict, But forget to compile libx.so Add – luldit when compiling libx.so I won’t make a mistake when I’m here, because at this time libx.so It is considered as a library, in which there are some symbols that do not know the specific implementation, which are legal and can be specified at runtime or when compiling other binary programs

If G + + – lpath – LX is used The linker will find that the required uldict symbol table can not be found and report an error. However, if the program is loaded in dlopen mode, the program will run directly in this place and report an error because it is in runtime. Another case is that an external interface has been declared and defined in the dynamic library, but it has forgotten to implement it. At this time, the Similar mistakes can occur

If such an error is reported in the runtime, we should pay attention to whether it is due to the fact that some libraries are not linked or some interfaces are not implemented

 

 

With the above foundation, it is not difficult to see that the reasons for the undefined reference error are as follows:

    no corresponding library (. O /. A /. So) uses the entity defined in the library, but no library (- LXXX) or library path (- lyyy) is specified, which will lead to this error. The order of connecting library parameters is not right. By default, the more basic the library is, the more it should be written later, Whether it is static or dynamic, the version of GCC / LD does not match the compatibility of the version of GCC / LD. Due to the compatibility problems of the large versions of GCC 2 to GCC 3 (in fact, there are some problems in GCC 3.2 to 3.4), when using the low version of the machine on the high version machine, such errors will be caused. This problem is more common in the 32-bit environment, In addition, the 64 bit library is used carelessly in the 32-bit environment, or vice versa. The C / C + + interdependence and the mixed use of linking GCC and G + + compilation results need to ensure that both sides of extern “C” can use the interface. In our 64 bit environment, the GCC linking G + + library also needs to add – lstdc + +, For details, please refer to the description of hybrid compilation in the previous article. The problem of runtime error is basically due to the program using dlopen mode to load. So, but. So does not link all the required libraries. Please refer to the description of hybrid use of static library and dynamic library in the above section

     

Methods of compiling and installing ffmpeg and libx264 in Linux

Recently in the study of TS stream video preparation FFMPEG video format encoding and conversion
Compiling FFMPEG was smooth but integrating with Libx264 was tedious
It took me a long time to find it online
It is hereby sorted here

Operating system: CentOS 6.4 64-bit kernel 2.6.32
Compiling environment: GCC 4.4.7
FFMPEG version: 2.4
X264 version: X264 0.142.2479 DD79A61
YASM version: 1.3

Prepare documents:
Ffmpeg source
https://www.ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
x264
Git clone git://git.videolan.org/x264.git
yasm
http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz

Compile and install procedure:
1. Install YASM

tar zxvf yasm-1.3.0.tar.gz 
cd yasm-1.3.0
 ./configure 
 make
 make install
 yasm --version

2. Compile and install X264

cd x264 
./configure --enable-shared --enable-pthread --enable-pic
make
make install

3. Compile FFMPEG

cd ffmpeg
./configure --enable-libx264 --enable-gpl --enable-shared  --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --enable-pic
make
make install

Install well at FFMPEG runtime if prompted

ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory

You will need to modify the file: /etc/ld.so.conf

Add a line at the end of the file:
/usr/local/lib
Then execute the command:
ldconfig

Rerun the ffmpeg – encoders | grep x264 will find successful installation

Common problems and solutions under Linux

Common problems and solutions under Linux

. What are tar,.tar.gz,.bz2,.tar.bz2,.bz,.gz files and how do I unlock them?
They are both file (compressed) packages. Tar.gz: package and compress: tar CVF *.tar dirName: tar XVF *.tar
.tar.gz: package and compress: tar CZVF *.tar.gz
2: unpack: bzip2-d *.bz2
.b>unpack: bzip2-d *.bz
.bz: unpack: bzip2-d *.bz
.gz: unpac> Gzip-d *.gz


rh8 There is a graphical interface under the software File-roller to do this. Also can use unzip *. Zip unzip file, unrar *. Rar solution
open RAR file, but the general system does not come with unrar, to download the Internet.

br>

>
a. Create a directory like mkdir a
. Mount the iso file: mount -o loop XXXX.

Delete all files in the directory including subdirectories
-rf directory names

cat /proc/ cpuinfo-CPU (i.e. vendor, Mhz, flags like MMX)
t /proc/interrupts – interrupt
c> proc/ioports – device IO port
cat/p>/ meminfo-memory (i.e. mem used, free, i.e. mem used, free, Swap the size)
the cat/proc/partitions – all equipment all partitions
the cat/proc/pci – pci devices information
the cat/proc/swaps – all the swap partition information
the cat/proc/version – Linux version number Equivalent to the uname -r
uname -a – see system information such as the kernel

RPM -qpl aaa. RPM
RPM -qpl aaa
Gz
tar XVFZ example.tar.gz
tar XVFZ example.tgz
t>vf example.tar
unzip e>le.zip

> Gaim 0.58:

www.linuxsir.org/gaim/gaim-0.58-2.i386.rpm download QQ plug-in for gcc2.9 version

www.linuxsir.org/gaim/libqq-0.0.3-ft-0.58-gcc296.so.gz will download file into the/temp directory, then delete the existing Gaim system, namely, type the command in a terminal emulator: RPM -e Gaim.
Start the installation
en the terminal emulator and continue to install Gaim version 0.58, that is:
c>temp (go to the temp directory)
RPM -iv>im -0.58-2.i386. RPM (install software)
When the inst>tion is successful, you can create the Gaim icon on the GNome or KDE desktop.
To continue installing the QQ plugin, type the command:
nzip libq-0.0.3-ft-0.58 -gcc296.so.gz (unzip the file)
c>bq-0.0.3-ft-0.58 -gcc296.so /usr/lib/gaim (copy the plugin to the gaim library directory)
Softwar>ttings
Login screen> will appear when you first start Gaim version 0.85. Select “Plugins” first, and click “Load” in the “Plugins” dialog box. Load
libmsn.so and libq-0.0.3-FT-0.58-gcc296.so files respectively, and close them after confirmation. Then choose “all accounts”, in the presence of
account in the editor to click “add”, when the modify account page, we can enter your QQ or MSN number,
the login name fill in QQ number or MSN email, password to fill in the corresponding QQ or MSN password, Alias to fill in their nicknames, protocol selection
corresponding QQ or MSN, other Settings by default. When all Settings are completed, you can log in and use.
http://wangzhihng.blog.163.com/blog/static/350999420061030105134290/

The language of C__ FILE__ 、__ LINE__ And line

Original link:
 
http://hi.baidu.com/419836321/blog/item/fcf5ceec484681cfb31cb1f7.html
 
 
 
 

__FILE__ is used in C to indicate the filename of the source file in which the statement is written, for example (test.c) :

    #include < stdio.h> int main() { printf(“%s\n”,__FILE__); }

GCC compiler generates a.out. After execution, the output is:

test.c

Compiling results under Windows VC6.0 are as follows:

C :\ Documents and Settings \ Administrator \ Desktop \ Test.c

——————————————————————————————————————————————————————————————————– ————————————————————————–

__LINE__ in C is used to indicate the position of the statement in the source file. Examples are as follows:

    #include < stdio.h>

    main() { printf(“%d\n”,__LINE__); printf(“%d\n”,__LINE__); printf(“%d\n”,__LINE__); };

The program is compiled in Linux with GCC, in Windows VC6.0 under the compilation can pass, the execution results are:

7

8

9

__LINE__ can also be reset with the #line statement, for example:

    #include < stdio.h>

    # line 200 // specify the next row __LINE__ for 200 main () { printf (” % d \ n “, __LINE__); printf(“%d\n”,__LINE__); printf(“%d\n”,__LINE__); };

After compilation and execution, the output is:

202

203

204

——————————————————————————————————————————————————————————————————– —————————————————————————

GCC also supports __func__, which indicates the function, but this keyword is not supported in VC 6.0 under Windows, for example:

    #include < stdio.h> void main() { printf(“this is print by function %s\n”,__func__); }

The output result after compilation is

this is print by function main

Note # “line”, “__LINE__”, “a __FILE__” and “__func__” are case sensitive.

 

【linux】error: stdio.h: No such file or directory

Ubuntu does not have a C and C++ compilation environment by default
By default, Ubuntu does not have C and C++ compiler environment. When newly installed Ubuntu USES GCC, it will report an error and cannot find a certain header file. When compiling a demo such as hello world, an error will be reported:
error: stdio.h: No such file or directory
Install the C and C++ compilation environment

if there is no aptitude installed, use apt-get, e.g.
udo apt-get install build-essential