licode学习之编译篇--2

今天在一个新的centos系统上面,结果编译git报错:

/usr/bin/perl Makefile.PL PREFIX='/usr/local/git' INSTALL_BASE='' --localedir='/usr/local/git/share/locale'
Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 3.
BEGIN failed--compilation aborted at Makefile.PL line 3.
make[1]: *** [perl.mak] Error 2
make: *** [perl/perl.mak] Error 2

看样子没有perl,安装perl

yum install perl

安装之后,还是不行。参考:https://blog.csdn.net/tspangle/article/details/11798951

输入命令:

[root@localhost git-1.8.2.3]# yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
[root@localhost git-1.8.2.3]# ./configure 
[root@localhost git-1.8.2.3]# make
[root@localhost git-1.8.2.3]# make install
[root@localhost git-1.8.2.3]# ln -s /usr/local/bin/git /usr/bin/git
[root@localhost git-1.8.2.3]# yum -y update  nss

OK,重新完成git安装。

执行 ./installUbuntuDeps.sh

curl: (7) Failed to connect to 2001:470:eb26:54::1: Network is unreachable
tar (child): opus-1.1.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
./installUbuntuDeps.sh: line 152: cd: opus-1.1: No such file or directory
./installUbuntuDeps.sh: line 153: ./configure: No such file or directory
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target `install'.  Stop.

curl: (7) Failed to connect to 2001:470:eb26:54::1: Network is unreachable
tar (child): opus-1.1.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

真是每次错误都不一样啊。

[root@localhost scripts]# vim installUbuntuDeps.sh
install_opus(){
  [ -d $LIB_DIR ] || mkdir -p $LIB_DIR
  cd $LIB_DIR
  if [ ! -f ./opus-1.1.tar.gz ]; then
    curl -OL http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
    tar -zxvf opus-1.1.tar.gz
    cd opus-1.1
    ./configure --prefix=$PREFIX_DIR
    make $FAST_MAKE -s V=0
    make install
  else
    echo "opus already installed"
  fi
  cd $CURRENT_DIR
}

 http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz 这个地址访问不了导致,好吧,换另外一个能墙的网络,下载下来

看代码里面,是将prefix设置为PREFIX_DIR变量,将gz文件放到LIB_DIR目录,这两个目录是多少,得仔细研究下。

修改initUbuntuDeps.sh相关部分代码为

install_opus(){
  [ -d $LIB_DIR ] || mkdir -p $LIB_DIR
  cd $LIB_DIR
  if [ ! -f ./opus-1.1.tar.gz ]; then
    echo "This is myself info. LIB_DIR:$LIB_DIR, PREFIX_DIR:$PREFIX_DIR"
    curl -OL http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
    tar -zxvf opus-1.1.tar.gz
    cd opus-1.1
    ./configure --prefix=$PREFIX_DIR
    make $FAST_MAKE -s V=0
    make install
  else
    echo "opus already installed"
  fi
  cd $CURRENT_DIR
}

再次执行:

./installUbuntuDeps.sh
This is myself info. LIB_DIR:/home/test/licode-master/scripts/./../build/libdeps, PREFIX_DIR:/home/test/licode-master/scripts/./../build/libdeps/build/

打印出来目录以后,将下载的opus源码放到路径下

再次执行installUbuntuDeps.sh

yasm还有一些其他软件没有安装报错

根据 https://blog.csdn.net/tanga842428/article/details/73277739 添加eperl源

这次执行,新安装了好多依赖的包,这是一个好现象

No package libvpx. available.
install_mediadeps(){
  install_opus
  yum -qq install yasm libvpx. libx264.
  if [ -d $LIB_DIR ]; then
    cd $LIB_DIR
    if [ ! -f ./v11.9.tar.gz ]; then
      curl -O -L https://github.com/libav/libav/archive/v11.9.tar.gz
      tar -zxvf v11.9.tar.gz
      cd libav-11.9
      PKG_CONFIG_PATH=${PREFIX_DIR}/lib/pkgconfig ./configure --prefix=$PREFIX_DIR --enable-shared --enable-gpl --enable-libvpx --enable-libx264 --enable-libopus --disable-doc
      make $FAST_MAKE -s V=0
      make install
    else
      echo "libav already installed"
    fi
    cd $CURRENT_DIR
  else
    mkdir -p $LIB_DIR
    install_mediadeps
  fi

}

原来在脚本里面多写了个点,将之删掉,搜索整个文档,将vpx.中的点删掉,再执行一次

OK,总算是没有看到非常严重的错误了

该编译C++库代码了

[root@localhost scripts]# ./installErizo.sh

[root@localhost scripts]# ./installErizo.sh
Installing erizo...
generating release
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.23")
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:20 (message):
gcc version must be >= 5 and is 4.4.7

告诉我gcc版本必须大于5。但是centos中yum的版本里面没有5,试着让其降低版本吧

[root@localhost scripts]# vim ../erizo/src/CMakeLists.txt
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
    OUTPUT_VARIABLE GCC_VERSION)
  if (GCC_VERSION VERSION_LESS 5)
    message(FATAL_ERROR "gcc version must be >= 5 and is ${GCC_VERSION}")
  endif()

  execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
    OUTPUT_VARIABLE CXX_VERSION)
  if (CXX_VERSION VERSION_LESS 5)
    message(FATAL_ERROR "g++ version must be >= 5 and is ${CXX_VERSION}")
  endif()
endif()

将里面的5改为4,让其版本降低

[root@localhost scripts]# ./installErizo.sh 
Installing erizo...
generating release
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- checking for module 'glib-2.0'
--   package 'glib-2.0' not found
CMake Error at /home/test/licode-master/erizo/cmake/FindGlib.cmake:36 (message):
  pkg-config is needed
Call Stack (most recent call first):
  CMakeLists.txt:64 (find_package)
[root@localhost scripts]# yum install glib2-devel
[root@localhost scripts]# ./installErizo.sh 
Installing erizo...
generating release
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- checking for module 'glib-2.0'
--   found glib-2.0, version 2.28.8
-- Found glib-2.0: /usr/include/glib-2.0, /usr/lib64/libglib-2.0.so;/usr/lib64/libgobject-2.0.so;/usr/lib64/libgthread-2.0.so
CMake Error at /usr/share/cmake/Modules/FindBoost.cmake:1138 (message):
  Unable to find the requested Boost libraries.

  Unable to find the Boost header files.  Please set BOOST_ROOT to the root
  directory containing Boost or BOOST_INCLUDEDIR to the directory containing
  Boost's headers.
Call Stack (most recent call first):
  CMakeLists.txt:69 (find_package)


CMake Error at CMakeLists.txt:7 (message):
  lib not found: NICE-NOTFOUND check README
Call Stack (most recent call first):
  CMakeLists.txt:81 (test_lib)
[root@localhost scripts]# yum install doxygen
[root@localhost scripts]# yum install boost-devel
[root@localhost scripts]# ./installErizo.sh 
Installing erizo...
generating release
-- Found Doxygen: /usr/bin/doxygen (found version "1.6.1") 
-- Found glib-2.0: /usr/include/glib-2.0, /usr/lib64/libglib-2.0.so;/usr/lib64/libgobject-2.0.so;/usr/lib64/libgthread-2.0.so
-- Boost version: 1.41.0
-- Found the following Boost libraries:
--   thread
--   regex
--   system
CMake Error at CMakeLists.txt:7 (message):
  lib not found: NICE-NOTFOUND check README
Call Stack (most recent call first):
  CMakeLists.txt:81 (test_lib)

安装了doxygen,boost后,报错,找不到NICE库。

下一篇再继续处理这个问题吧

原文地址:https://www.cnblogs.com/limedia/p/licode_compile_2.html