2019-09-28 13:06:42 u010481276 阅读数 33
  • Linux菜鸟篇

    本课程适合未使用过Linux系统、毫无操作基础的新人,包括开发或者网管以及还未参加工作的大学生、高职生等等。

    7396 人正在学习 去看看 董松

deepin 编译android 用的ffmpeg库

安装所需要的环境

转自:https://blog.csdn.net/weixin_34323858/article/details/92066194

【1】安装yasm
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make && sudo make install
 
【2】安装g++  cmake
apt install g++  cmake
 
【3】安装SDL2-2.0 (这里选择SDL2版本的),用于生成ffplay,否则不会生成ffplay
apt install libsdl2-2.0-0 libsdl2-dev libsdl2-doc
 
【4】安装fdk-acc
wget https://jaist.dl.sourceforge.net/project/opencore-amr/fdk-aac/fdk-aac-0.1.6.tar.gz
tar xvf fdk-aac-0.1.6.tar.gz
cd fdk-aac-0.1.6
./configure
make && sudo make install
 
【5】安装lame
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar -xzf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure
make && sudo make install
 
 
【6】安装nasm
wget https://www.nasm.us/pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.gz
tar xvf nasm-2.13.03.tar.gz
cd nasm-2.13.03
./configure
make && sudo make install
 
【7】安装x264视频编解码库
wget http://mirror.yandex.ru/mirrors/ftp.videolan.org/x264/snapshots/last_x264.tar.bz2
bunzip2 last_x264.tar.bz2
tar -vxf last_x264.tar
cd last_x264
./configure --enable-static --enable-shared --disable-asm --disable-avs
make && sudo make install
 
【8】安装x265视频编解码库
wget -c http://mirror.yandex.ru/mirrors/ftp.videolan.org/x265/x265_2.6.tar.gz
tar -zxvf x265_2.6.tar.gz 
cd /x265_v2.6/build/linux 
./make-Makefiles.bash
make  && make install 
 
 
【9】ffmpeg安装
./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-filter=delogo --enable-debug --disable-optimizations --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib
 
make  && make install 
 
 
【10】配置环境变量
1> 将ffmpeg的lib目录加入到/etc/ld.so.conf中
2> 将ffmpeg的bin目录加入环境变量
3> vim /etc/profile.d/ffmpeg_env.sh 添加如下代码
 
#set ffmpeg environment
 
echo 'start to set ffmpeg environment'
if [ -z "$FFMPEG" ]; then
  echo 'export $FFMPEG and $PATH...'
  export FFMPEG=/usr/local/ffmpeg
  export PATH=$FFMPEG/bin:$PATH
 
fi 
 
4> 执行如下命令,使变量生效
#ldconfig
#source /etc/profile
 
 
5>后续编程需要使用/usr/local/ffmpeg中的lib下的so文件,我们还需要进行如下配置
 
vim /etc/ld.so.conf.d/ffmpeg.ld.conf
在该文件下入
/usr/local/ffmpeg/lib
 
然后执行
ldconfig  
 
注意:ldconfig 可能不会生效,需要重启系统
 
当然还有其他方式,比如将so文件拷贝到/usr/bin下,或者创建软连接
 
注意:如果上述环境配置不对,编译c文件时会出现 【/usr/bin/ld 未发现xxx】
 
 
【10】编译
gcc -g -o helloworld helloworld.c -I /usr/local/ffmpeg/include -L /usr/local/ffmpeg/lib -lavutil -lavformat
 
 
 
 

下载ffmpeg
http://ffmpeg.org/

下载ndk
android-ndk-r10d-linux-x86_64.bin
./android-ndk-r10d-linux-x86_64.bin 安装解压

解压 ffmpeg
tar -xvf ffmpeg-3.1.3.tar.gz

修改configure
由于编译生成动态库文件名的版本号在so的后面,android平台不能识别这样的动态库,因此需要修改一下
打开找到build settings,修对应的宏修改成下面那样

SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
SLIB_INSTALL_LINKS='$(SLIBNAME)'

在根目录下添加build.sh

#!/bin/bash
# 清空上次的编译
make clean
#你自己的NDK路径。
export NDK=/home/toby/Downloads/android-ndk-r10d
# 设置你的android平台编译器的版本 这里采用Android4.0 
export SYSROOT=$NDK/platforms/android-21/arch-arm/
#编译使用的toolchain
export TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64
export CPU=arm
# 这个是输出的路径
export PREFIX=$(pwd)/android/$CPU
export ADDI_CFLAGS="-marm"
./configure --target-os=linux \
--prefix=$PREFIX --arch=arm \
--disable-doc \
--disable-shared \
--enable-static \
--disable-yasm \
--disable-symver \
--enable-gpl \
--enable-nonfree \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-doc \
--disable-symver \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" $ADDITIONAL_CONFIGURE_FLAG
make clean
make
make install


编译后生成对应的static lib,在新生 成的android目录下

~/Downloads/ffmpeg-3.1.3$ ls android/arm/lib/
libavcodec.a     libavdevice.a    libavfilter.a    libavformat.a    libavutil.a      libpostproc.a    libswresample.a  libswscale.a     pkgconfig/

编译share lib

--enable-static\
--disable-shared \

修改成

--enable-shared \
--disable-static \

生成的so也在下面(.a与.so在一起)

ffmpeg-3.1.3$ ls android/arm/lib/
libavcodec-57.so  libavdevice-57.so  libavfilter-6.so  libavformat-57.so  libavutil-55.so  libpostproc-54.so  libswresample-2.so  libswscale-4.so  pkgconfig
libavcodec.a      libavdevice.a      libavfilter.a     libavformat.a      libavutil.a      libpostproc.a      libswresample.a     libswscale.a
libavcodec.so     libavdevice.so     libavfilter.so    libavformat.so     libavutil.so     libpostproc.so     libswresample.so    libswscale.so

安装ffmpeg到deepin系统中

https://blog.csdn.net/sinat_41559158/article/details/80363649
这里用的ffmepg版本是:

cat RELEASE 
4.1.git

./configure --disable-x86asm --enable-shared --prefix=/usr/
make
make install

安装后

ffmpeg -version
ffmpeg version N-93755-ga5387f983d Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Debian 7.3.0-19)
configuration: --disable-x86asm --enable-shared --prefix=/usr/
libavutil      56. 26.100 / 56. 26.100
libavcodec     58. 52.100 / 58. 52.100
libavformat    58. 27.103 / 58. 27.103
libavdevice    58.  7.100 / 58.  7.100
libavfilter     7. 50.100 /  7. 50.100
libswscale      5.  4.100 /  5.  4.100
libswresample   3.  4.100 /  3.  4.100

用ffplay 01.avi可以播放视频

android studio中添加c++支持
https://www.cnblogs.com/lsdb/p/9337285.html

创建ndk环境支持 c++开发
https://www.jianshu.com/p/0c9922803bba

编译出现问题:

ERROR: Parameter specified as non-null is null: method com.android.build.gradle.internal.cxx.configure.JsonGenerationVariantConfiguration.<init>, parameter ndkVersion

所使用的的NDK版本不适配的问题,高版本的NDK被使用时会被从source.properties文件获取NDK的版本号
你现在使用的NDK版本没有这个文件。俩种解决方案1.升级NDK版本到最新(需要重新编译可能遇到各种问题)。2,临时方案,找到高版本的NDK版本复制source.properties文件到使用的NDK版本中,就可以解决这个问题。
这里采用android studio 默认的值可以避免这个问题,

CMakeLists.txt
设备路径宏
set(distribution_DIR ./armeabi-v7a/)
设置头文件路径
include_directories(include)
动态库:

add_library(
        avcodec-57.so
        SHARED
        IMPORTED)

set_target_properties(
        avcodec-57.so
        PROPERTIES IMPORTED_LOCATION
        ${distribution_DIR}/libavcodec.so )

静态库
https://blog.csdn.net/qq_27246079/article/details/90549692
发现按照上面的方法弄了之后有编译不过的情况,各种undefined的情况,先是调整了一下lib的次序
https://blog.csdn.net/wo_Niu123/article/details/81451137
CMakeLists.txt

include_directories(${CMAKE_SOURCE_DIR}/include)

set(my_lib_path ${CMAKE_SOURCE_DIR}/../../../libs/${ANDROID_ABI})
set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -L${my_lib_path} -lz")
target_link_libraries( # Specifies the target library.
                       native-lib
                       avformat avdevice avcodec  avutil swscale avfilter postproc swresample
                       # Links the target library to the log library
                       # included in the NDK.
                       ${log-lib} )

还是有,undefined reference to uncompress 之类的出现,修改ffmpeg所用的ndk与android studio的一样,再将编译生成的.a的给android studio去编译

#你自己的NDK路径。
# export NDK=/home/toby/Downloads/android-ndk-r10d
export NDK=/home/toby/Android/Sdk/ndk-bundle

在这里插入图片描述
发现是configure参数的问题
https://blog.csdn.net/n66040927/article/details/80995460
在./configure后面添加

--enable-bzlib

变成如下,就编译通过了

#!/bin/bash
# 清空上次的编译
make clean
#你自己的NDK路径。
# export NDK=/home/toby/Downloads/android-ndk-r10d
export NDK=/home/toby/Android/Sdk/ndk-bundle
# 设置你的android平台编译器的版本 这里采用Android4.0 
export SYSROOT=$NDK/platforms/android-21/arch-arm/
#编译使用的toolchain
export TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64
export CPU=arm
# 这个是输出的路径
export PREFIX=$(pwd)/android/$CPU
export ADDI_CFLAGS="-marm"
./configure --target-os=android \
--prefix=$PREFIX --arch=arm \
--disable-doc \
--disable-shared \
--enable-static \
--disable-yasm \
--disable-symver \
--enable-gpl \
--enable-nonfree \
--enable-ffmpeg \
--enable-ffplay \
--enable-ffprobe \
--enable-ffserver \
--enable-doc \
--enable-symver \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" $ADDITIONAL_CONFIGURE_FLAG  
--enable-bzlib
make clean
make
make install



配置参数帮助说明
在这里插入图片描述
./configure --help

/code/ffmpeg-4.0.2$ ./configure --help
Usage: configure [options]
Options: [defaults in brackets after descriptions]

Help options:
  --help                   print this message
  --quiet                  Suppress showing informative output
  --list-decoders          show all available decoders
  --list-encoders          show all available encoders
  --list-hwaccels          show all available hardware accelerators
  --list-demuxers          show all available demuxers
  --list-muxers            show all available muxers
  --list-parsers           show all available parsers
  --list-protocols         show all available protocols
  --list-bsfs              show all available bitstream filters
  --list-indevs            show all available input devices
  --list-outdevs           show all available output devices
  --list-filters           show all available filters

Standard options:
  --logfile=FILE           log tests and output to FILE [ffbuild/config.log]
  --disable-logging        do not log configure debug information
  --fatal-warnings         fail if any configure warning is generated
  --prefix=PREFIX          install in PREFIX [/usr/local]
  --bindir=DIR             install binaries in DIR [PREFIX/bin]
  --datadir=DIR            install data files in DIR [PREFIX/share/ffmpeg]
  --docdir=DIR             install documentation in DIR [PREFIX/share/doc/ffmpeg]
  --libdir=DIR             install libs in DIR [PREFIX/lib]
  --shlibdir=DIR           install shared libs in DIR [LIBDIR]
  --incdir=DIR             install includes in DIR [PREFIX/include]
  --mandir=DIR             install man page in DIR [PREFIX/share/man]
  --pkgconfigdir=DIR       install pkg-config files in DIR [LIBDIR/pkgconfig]
  --enable-rpath           use rpath to allow installing libraries in paths
                           not part of the dynamic linker search path
                           use rpath when linking programs (USE WITH CARE)
  --install-name-dir=DIR   Darwin directory name for installed targets

Licensing options:
  --enable-gpl             allow use of GPL code, the resulting libs
                           and binaries will be under GPL [no]
  --enable-version3        upgrade (L)GPL to version 3 [no]
  --enable-nonfree         allow use of nonfree code, the resulting libs
                           and binaries will be unredistributable [no]

Configuration options:
  --disable-static         do not build static libraries [no]
  --enable-shared          build shared libraries [no]
  --enable-small           optimize for size instead of speed
  --disable-runtime-cpudetect disable detecting CPU capabilities at runtime (smaller binary)
  --enable-gray            enable full grayscale support (slower color)
  --disable-swscale-alpha  disable alpha channel support in swscale
  --disable-all            disable building components, libraries and programs
  --disable-autodetect     disable automatically detected external libraries [no]

Program options:
  --disable-programs       do not build command line programs
  --disable-ffmpeg         disable ffmpeg build
  --disable-ffplay         disable ffplay build
  --disable-ffprobe        disable ffprobe build

Documentation options:
  --disable-doc            do not build documentation
  --disable-htmlpages      do not build HTML documentation pages
  --disable-manpages       do not build man documentation pages
  --disable-podpages       do not build POD documentation pages
  --disable-txtpages       do not build text documentation pages

Component options:
  --disable-avdevice       disable libavdevice build
  --disable-avcodec        disable libavcodec build
  --disable-avformat       disable libavformat build
  --disable-swresample     disable libswresample build
  --disable-swscale        disable libswscale build
  --disable-postproc       disable libpostproc build
  --disable-avfilter       disable libavfilter build
  --enable-avresample      enable libavresample build (deprecated) [no]
  --disable-pthreads       disable pthreads [autodetect]
  --disable-w32threads     disable Win32 threads [autodetect]
  --disable-os2threads     disable OS/2 threads [autodetect]
  --disable-network        disable network support [no]
  --disable-dct            disable DCT code
  --disable-dwt            disable DWT code
  --disable-error-resilience disable error resilience code
  --disable-lsp            disable LSP code
  --disable-lzo            disable LZO decoder code
  --disable-mdct           disable MDCT code
  --disable-rdft           disable RDFT code
  --disable-fft            disable FFT code
  --disable-faan           disable floating point AAN (I)DCT code
  --disable-pixelutils     disable pixel utils in libavutil

Individual component options:
  --disable-everything     disable all components listed below
  --disable-encoder=NAME   disable encoder NAME
  --enable-encoder=NAME    enable encoder NAME
  --disable-encoders       disable all encoders
  --disable-decoder=NAME   disable decoder NAME
  --enable-decoder=NAME    enable decoder NAME
  --disable-decoders       disable all decoders
  --disable-hwaccel=NAME   disable hwaccel NAME
  --enable-hwaccel=NAME    enable hwaccel NAME
  --disable-hwaccels       disable all hwaccels
  --disable-muxer=NAME     disable muxer NAME
  --enable-muxer=NAME      enable muxer NAME
  --disable-muxers         disable all muxers
  --disable-demuxer=NAME   disable demuxer NAME
  --enable-demuxer=NAME    enable demuxer NAME
  --disable-demuxers       disable all demuxers
  --enable-parser=NAME     enable parser NAME
  --disable-parser=NAME    disable parser NAME
  --disable-parsers        disable all parsers
  --enable-bsf=NAME        enable bitstream filter NAME
  --disable-bsf=NAME       disable bitstream filter NAME
  --disable-bsfs           disable all bitstream filters
  --enable-protocol=NAME   enable protocol NAME
  --disable-protocol=NAME  disable protocol NAME
  --disable-protocols      disable all protocols
  --enable-indev=NAME      enable input device NAME
  --disable-indev=NAME     disable input device NAME
  --disable-indevs         disable input devices
  --enable-outdev=NAME     enable output device NAME
  --disable-outdev=NAME    disable output device NAME
  --disable-outdevs        disable output devices
  --disable-devices        disable all devices
  --enable-filter=NAME     enable filter NAME
  --disable-filter=NAME    disable filter NAME
  --disable-filters        disable all filters

External library support:

  Using any of the following switches will allow FFmpeg to link to the
  corresponding external library. All the components depending on that library
  will become enabled, if all their other dependencies are met and they are not
  explicitly disabled. E.g. --enable-libwavpack will enable linking to
  libwavpack and allow the libwavpack encoder to be built, unless it is
  specifically disabled with --disable-encoder=libwavpack.

  Note that only the system libraries are auto-detected. All the other external
  libraries must be explicitly enabled.

  Also note that the following help text describes the purpose of the libraries
  themselves, not all their features will necessarily be usable by FFmpeg.

  --disable-alsa           disable ALSA support [autodetect]
  --disable-appkit         disable Apple AppKit framework [autodetect]
  --disable-avfoundation   disable Apple AVFoundation framework [autodetect]
  --enable-avisynth        enable reading of AviSynth script files [no]
  --disable-bzlib          disable bzlib [autodetect]
  --disable-coreimage      disable Apple CoreImage framework [autodetect]
  --enable-chromaprint     enable audio fingerprinting with chromaprint [no]
  --enable-frei0r          enable frei0r video filtering [no]
  --enable-gcrypt          enable gcrypt, needed for rtmp(t)e support
                           if openssl, librtmp or gmp is not used [no]
  --enable-gmp             enable gmp, needed for rtmp(t)e support
                           if openssl or librtmp is not used [no]
  --enable-gnutls          enable gnutls, needed for https support
                           if openssl or libtls is not used [no]
  --disable-iconv          disable iconv [autodetect]
  --enable-jni             enable JNI support [no]
  --enable-ladspa          enable LADSPA audio filtering [no]
  --enable-libaom          enable AV1 video encoding/decoding via libaom [no]
  --enable-libass          enable libass subtitles rendering,
                           needed for subtitles and ass filter [no]
  --enable-libbluray       enable BluRay reading using libbluray [no]
  --enable-libbs2b         enable bs2b DSP library [no]
  --enable-libcaca         enable textual display using libcaca [no]
  --enable-libcelt         enable CELT decoding via libcelt [no]
  --enable-libcdio         enable audio CD grabbing with libcdio [no]
  --enable-libcodec2       enable codec2 en/decoding using libcodec2 [no]
  --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394
                           and libraw1394 [no]
  --enable-libfdk-aac      enable AAC de/encoding via libfdk-aac [no]
  --enable-libflite        enable flite (voice synthesis) support via libflite [no]
  --enable-libfontconfig   enable libfontconfig, useful for drawtext filter [no]
  --enable-libfreetype     enable libfreetype, needed for drawtext filter [no]
  --enable-libfribidi      enable libfribidi, improves drawtext filter [no]
  --enable-libgme          enable Game Music Emu via libgme [no]
  --enable-libgsm          enable GSM de/encoding via libgsm [no]
  --enable-libiec61883     enable iec61883 via libiec61883 [no]
  --enable-libilbc         enable iLBC de/encoding via libilbc [no]
  --enable-libjack         enable JACK audio sound server [no]
  --enable-libkvazaar      enable HEVC encoding via libkvazaar [no]
  --enable-libmodplug      enable ModPlug via libmodplug [no]
  --enable-libmp3lame      enable MP3 encoding via libmp3lame [no]
  --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  --enable-libopencv       enable video filtering via libopencv [no]
  --enable-libopenh264     enable H.264 encoding via OpenH264 [no]
  --enable-libopenjpeg     enable JPEG 2000 de/encoding via OpenJPEG [no]
  --enable-libopenmpt      enable decoding tracked files via libopenmpt [no]
  --enable-libopus         enable Opus de/encoding via libopus [no]
  --enable-libpulse        enable Pulseaudio input via libpulse [no]
  --enable-librsvg         enable SVG rasterization via librsvg [no]
  --enable-librubberband   enable rubberband needed for rubberband filter [no]
  --enable-librtmp         enable RTMP[E] support via librtmp [no]
  --enable-libshine        enable fixed-point MP3 encoding via libshine [no]
  --enable-libsmbclient    enable Samba protocol via libsmbclient [no]
  --enable-libsnappy       enable Snappy compression, needed for hap encoding [no]
  --enable-libsoxr         enable Include libsoxr resampling [no]
  --enable-libspeex        enable Speex de/encoding via libspeex [no]
  --enable-libsrt          enable Haivision SRT protocol via libsrt [no]
  --enable-libssh          enable SFTP protocol via libssh [no]
  --enable-libtesseract    enable Tesseract, needed for ocr filter [no]
  --enable-libtheora       enable Theora encoding via libtheora [no]
  --enable-libtls          enable LibreSSL (via libtls), needed for https support
                           if openssl or gnutls is not used [no]
  --enable-libtwolame      enable MP2 encoding via libtwolame [no]
  --enable-libv4l2         enable libv4l2/v4l-utils [no]
  --enable-libvidstab      enable video stabilization using vid.stab [no]
  --enable-libvmaf         enable vmaf filter via libvmaf [no]
  --enable-libvo-amrwbenc  enable AMR-WB encoding via libvo-amrwbenc [no]
  --enable-libvorbis       enable Vorbis en/decoding via libvorbis,
                           native implementation exists [no]
  --enable-libvpx          enable VP8 and VP9 de/encoding via libvpx [no]
  --enable-libwavpack      enable wavpack encoding via libwavpack [no]
  --enable-libwebp         enable WebP encoding via libwebp [no]
  --enable-libx264         enable H.264 encoding via x264 [no]
  --enable-libx265         enable HEVC encoding via x265 [no]
  --enable-libxavs         enable AVS encoding via xavs [no]
  --enable-libxcb          enable X11 grabbing using XCB [autodetect]
  --enable-libxcb-shm      enable X11 grabbing shm communication [autodetect]
  --enable-libxcb-xfixes   enable X11 grabbing mouse rendering [autodetect]
  --enable-libxcb-shape    enable X11 grabbing shape rendering [autodetect]
  --enable-libxvid         enable Xvid encoding via xvidcore,
                           native MPEG-4/Xvid encoder exists [no]
  --enable-libxml2         enable XML parsing using the C library libxml2 [no]
  --enable-libzimg         enable z.lib, needed for zscale filter [no]
  --enable-libzmq          enable message passing via libzmq [no]
  --enable-libzvbi         enable teletext support via libzvbi [no]
  --enable-lv2             enable LV2 audio filtering [no]
  --disable-lzma           disable lzma [autodetect]
  --enable-decklink        enable Blackmagic DeckLink I/O support [no]
  --enable-libndi_newtek   enable Newteck NDI I/O support [no]
  --enable-mediacodec      enable Android MediaCodec support [no]
  --enable-libmysofa       enable libmysofa, needed for sofalizer filter [no]
  --enable-openal          enable OpenAL 1.1 capture support [no]
  --enable-opencl          enable OpenCL processing [no]
  --enable-opengl          enable OpenGL rendering [no]
  --enable-openssl         enable openssl, needed for https support
                           if gnutls or libtls is not used [no]
  --disable-sndio          disable sndio support [autodetect]
  --disable-schannel       disable SChannel SSP, needed for TLS support on
                           Windows if openssl and gnutls are not used [autodetect]
  --disable-sdl2           disable sdl2 [autodetect]
  --disable-securetransport disable Secure Transport, needed for TLS support
                           on OSX if openssl and gnutls are not used [autodetect]
  --disable-xlib           disable xlib [autodetect]
  --disable-zlib           disable zlib [autodetect]

  The following libraries provide various hardware acceleration features:
  --disable-amf            disable AMF video encoding code [autodetect]
  --disable-audiotoolbox   disable Apple AudioToolbox code [autodetect]
  --enable-cuda-sdk        enable CUDA features that require the CUDA SDK [no]
  --disable-cuvid          disable Nvidia CUVID support [autodetect]
  --disable-d3d11va        disable Microsoft Direct3D 11 video acceleration code [autodetect]
  --disable-dxva2          disable Microsoft DirectX 9 video acceleration code [autodetect]
  --disable-ffnvcodec      disable dynamically linked Nvidia code [autodetect]
  --enable-libdrm          enable DRM code (Linux) [no]
  --enable-libmfx          enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no]
  --enable-libnpp          enable Nvidia Performance Primitives-based code [no]
  --enable-mmal            enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no]
  --disable-nvdec          disable Nvidia video decoding acceleration (via hwaccel) [autodetect]
  --disable-nvenc          disable Nvidia video encoding code [autodetect]
  --enable-omx             enable OpenMAX IL code [no]
  --enable-omx-rpi         enable OpenMAX IL code for Raspberry Pi [no]
  --enable-rkmpp           enable Rockchip Media Process Platform code [no]
  --disable-v4l2-m2m       disable V4L2 mem2mem code [autodetect]
  --disable-vaapi          disable Video Acceleration API (mainly Unix/Intel) code [autodetect]
  --disable-vdpau          disable Nvidia Video Decode and Presentation API for Unix code [autodetect]
  --disable-videotoolbox   disable VideoToolbox code [autodetect]

Toolchain options:
  --arch=ARCH              select architecture []
  --cpu=CPU                select the minimum required CPU (affects
                           instruction selection, may crash on older CPUs)
  --cross-prefix=PREFIX    use PREFIX for compilation tools []
  --progs-suffix=SUFFIX    program name suffix []
  --enable-cross-compile   assume a cross-compiler is used
  --sysroot=PATH           root of cross-build tree
  --sysinclude=PATH        location of cross-build system headers
  --target-os=OS           compiler targets OS []
  --target-exec=CMD        command to run executables on target
  --target-path=DIR        path to view of build directory on target
  --target-samples=DIR     path to samples directory on target
  --tempprefix=PATH        force fixed dir/prefix instead of mktemp for checks
  --toolchain=NAME         set tool defaults according to NAME
                           (gcc-asan, clang-asan, gcc-msan, clang-msan,
                           gcc-tsan, clang-tsan, gcc-usan, clang-usan,
                           valgrind-massif, valgrind-memcheck,
                           msvc, icl, gcov, llvm-cov, hardened)
  --nm=NM                  use nm tool NM [nm -g]
  --ar=AR                  use archive tool AR [ar]
  --as=AS                  use assembler AS []
  --ln_s=LN_S              use symbolic link tool LN_S [ln -s -f]
  --strip=STRIP            use strip tool STRIP [strip]
  --windres=WINDRES        use windows resource compiler WINDRES [windres]
  --x86asmexe=EXE          use nasm-compatible assembler EXE [nasm]
  --cc=CC                  use C compiler CC [gcc]
  --cxx=CXX                use C compiler CXX [g++]
  --objcc=OCC              use ObjC compiler OCC [gcc]
  --dep-cc=DEPCC           use dependency generator DEPCC [gcc]
  --nvcc=NVCC              use Nvidia CUDA compiler NVCC [nvcc]
  --ld=LD                  use linker LD []
  --pkg-config=PKGCONFIG   use pkg-config tool PKGCONFIG [pkg-config]
  --pkg-config-flags=FLAGS pass additional flags to pkgconf []
  --ranlib=RANLIB          use ranlib RANLIB [ranlib]
  --doxygen=DOXYGEN        use DOXYGEN to generate API doc [doxygen]
  --host-cc=HOSTCC         use host C compiler HOSTCC
  --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
  --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
  --host-ld=HOSTLD         use host linker HOSTLD
  --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host
  --host-libs=HLIBS        use libs HLIBS when linking for host
  --host-os=OS             compiler host OS []
  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS []
  --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS []
  --extra-objcflags=FLAGS  add FLAGS to OBJCFLAGS []
  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS []
  --extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS []
  --extra-ldsoflags=ELDFLAGS add ELDFLAGS to LDSOFLAGS []
  --extra-libs=ELIBS       add ELIBS []
  --extra-version=STRING   version string suffix []
  --optflags=OPTFLAGS      override optimization-related compiler flags
  --nvccflags=NVCCFLAGS    override nvcc flags [-gencode arch=compute_30,code=sm_30 -O2]
  --build-suffix=SUFFIX    library name suffix []
  --enable-pic             build position-independent code
  --enable-thumb           compile for Thumb instruction set
  --enable-lto             use link-time optimization
  --env="ENV=override"     override the environment variables

Advanced options (experts only):
  --malloc-prefix=PREFIX   prefix malloc and related names with PREFIX
  --custom-allocator=NAME  use a supported custom allocator
  --disable-symver         disable symbol versioning
  --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  --disable-safe-bitstream-reader
                           disable buffer boundary checking in bitreaders
                           (faster, but may crash)
  --sws-max-filter-size=N  the max filter size swscale uses [256]

Optimization options (experts only):
  --disable-asm            disable all assembly optimizations
  --disable-altivec        disable AltiVec optimizations
  --disable-vsx            disable VSX optimizations
  --disable-power8         disable POWER8 optimizations
  --disable-amd3dnow       disable 3DNow! optimizations
  --disable-amd3dnowext    disable 3DNow! extended optimizations
  --disable-mmx            disable MMX optimizations
  --disable-mmxext         disable MMXEXT optimizations
  --disable-sse            disable SSE optimizations
  --disable-sse2           disable SSE2 optimizations
  --disable-sse3           disable SSE3 optimizations
  --disable-ssse3          disable SSSE3 optimizations
  --disable-sse4           disable SSE4 optimizations
  --disable-sse42          disable SSE4.2 optimizations
  --disable-avx            disable AVX optimizations
  --disable-xop            disable XOP optimizations
  --disable-fma3           disable FMA3 optimizations
  --disable-fma4           disable FMA4 optimizations
  --disable-avx2           disable AVX2 optimizations
  --disable-avx512         disable AVX-512 optimizations
  --disable-aesni          disable AESNI optimizations
  --disable-armv5te        disable armv5te optimizations
  --disable-armv6          disable armv6 optimizations
  --disable-armv6t2        disable armv6t2 optimizations
  --disable-vfp            disable VFP optimizations
  --disable-neon           disable NEON optimizations
  --disable-inline-asm     disable use of inline assembly
  --disable-x86asm         disable use of standalone x86 assembly
  --disable-mipsdsp        disable MIPS DSP ASE R1 optimizations
  --disable-mipsdspr2      disable MIPS DSP ASE R2 optimizations
  --disable-msa            disable MSA optimizations
  --disable-mipsfpu        disable floating point MIPS optimizations
  --disable-mmi            disable Loongson SIMD optimizations
  --disable-fast-unaligned consider unaligned accesses slow

Developer options (useful when working on FFmpeg itself):
  --disable-debug          disable debugging symbols
  --enable-debug=LEVEL     set the debug level []
  --disable-optimizations  disable compiler optimizations
  --enable-extra-warnings  enable more compiler warnings
  --disable-stripping      disable stripping of executables and shared libraries
  --assert-level=level     0(default), 1 or 2, amount of assertion testing,
                           2 causes a slowdown at runtime.
  --enable-memory-poisoning fill heap uninitialized allocated space with arbitrary data
  --valgrind=VALGRIND      run "make fate" tests through valgrind to detect memory
                           leaks and errors, using the specified valgrind binary.
                           Cannot be combined with --target-exec
  --enable-ftrapv          Trap arithmetic overflows
  --samples=PATH           location of test samples for FATE, if not set use
                           $FATE_SAMPLES at make invocation time.
  --enable-neon-clobber-test check NEON registers for clobbering (should be
                           used only for debugging purposes)
  --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
                           should be used only for debugging purposes)
  --enable-random          randomly enable/disable components
  --disable-random
  --enable-random=LIST     randomly enable/disable specific components or
  --disable-random=LIST    component groups. LIST is a comma-separated list
                           of NAME[:PROB] entries where NAME is a component
                           (group) and PROB the probability associated with
                           NAME (default 0.5).
  --random-seed=VALUE      seed value for --enable/disable-random
  --disable-valgrind-backtrace do not print a backtrace under Valgrind
                           (only applies to --disable-optimizations builds)
  --enable-osfuzz          Enable building fuzzer tool
  --libfuzzer=PATH         path to libfuzzer
  --ignore-tests=TESTS     comma-separated list (without "fate-" prefix
                           in the name) of tests whose result is ignored
  --enable-linux-perf      enable Linux Performance Monitor API

NOTE: Object files are built at the place where configure is launched.

2018-11-01 16:12:56 qq910689331 阅读数 2684
  • Linux菜鸟篇

    本课程适合未使用过Linux系统、毫无操作基础的新人,包括开发或者网管以及还未参加工作的大学生、高职生等等。

    7396 人正在学习 去看看 董松

前几天装了deepin15.7美滋滋,然后开始折腾编译.LOS15.1(android8.1),在此记录遇到的问题

1.大天朝下载源码是个问题,换个hosts即可,这里我用的是

https://github.com/googlehosts/hosts

手动黏贴hosts中的内容到/etc/hosts 拔掉网线重新插入即可

sudo gedit /etc/hosts

2.安装需要的依赖

sudo apt-get update && sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk3.0-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-8-jre openjdk-8-jdk pngcrush schedtool libxml2 libxml2-utils xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev gcc-multilib maven tmux screen w3m ncftp liblz4-tool pngquant rsync

不出意外这里安装lib32ncurses5-dev 会报如下错误

下列软件包有未满足的依赖关系:
 lib32ncurses5-dev : 依赖: libncurses5-dev (= 6.0+20170715-2)
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。

解决方法替换软件源

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo gedit /etc/apt/sources.list

我这里用的阿里的文件如下

## Generated by deepin-installer
deb [by-hash=force] http://packages.deepin.com/deepin panda main contrib non-free
#deb-src http://packages.deepin.com/deepin panda main contrib non-free

deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe 
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe 
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe 
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe 
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe

更新下

sudo apt-get update

很好又出现一个错误

错误:3 http://mirrors.aliyun.com/ubuntu trusty-security InRelease                     
  由于没有公钥,无法验证下列签名: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32

添加签名即可

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5

完成
Executing: /tmp/apt-key-gpghome.RxSrDCHNRU/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5

gpg: key 40976EAF437D05B5: 59 signatures not checked due to missing keys
gpg: 密钥 40976EAF437D05B5:公钥“Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>”已导入
gpg: 合计被处理的数量:1
gpg:           已导入:1

来,再执行更新

sudo apt-get update

然后安装刚才失败的lib32ncurses5-dev

sudo aptitude install  lib32ncurses5-dev

这里进行的是降级安装 输入y y y…即可

下列“新”软件包将被安装。         
  lib32ncurses5-dev{b} lib32tinfo-dev{ab} 
0 个软件包被升级,新安装 2 个,0 个将被删除, 同时 19 个将不升级。
需要获取 186 kB 的存档。解包后将要使用 842 kB。
下列软件包存在未满足的依赖关系:
 lib32ncurses5-dev : 依赖: lib32tinfo5 (= 5.9+20140118-1ubuntu1) but 6.0+20170715-2 is installed
                     依赖: lib32ncurses5 (= 5.9+20140118-1ubuntu1) but 6.0+20170715-2 is installed
                     依赖: libncurses5-dev (= 5.9+20140118-1ubuntu1) but 6.1+20180210-4 is installed
 lib32tinfo-dev : 依赖: lib32tinfo5 (= 5.9+20140118-1ubuntu1) but 6.0+20170715-2 is installed
下列动作将解决这些依赖关系:

     保持 下列软件包于其当前版本: 
1)     lib32ncurses5-dev [未安装的]
2)     lib32tinfo-dev [未安装的]   



是否接受该解决方案?[Y/n/q/?] n
下列动作将解决这些依赖关系:

      删除 下列软件包:                                                         
1)      deepin-libwine:i386 [2.18-14~rc1 (now)]                                 
2)      deepin-wine [2.18-14~rc1 (now)]                                         
3)      deepin-wine32:i386 [2.18-14~rc1 (now)]                                  
4)      deepin-wine32-preloader:i386 [2.18-14~rc1 (now)]                        
5)      deepin.com.qq.im:i386 [8.9.19983deepin23 (now)]                         
6)      deepin.com.wechat:i386 [2.6.2.31deepin0 (now)]                          
7)      libncurses-dev [6.1+20180210-4 (now)]                                   
8)      libncurses-dev:i386 [6.1+20180210-4 (now)]                              
9)      libncurses5:i386 [6.1+20180210-4 (now)]                                 
10)     libncurses5-dev:i386 [6.1+20180210-4 (now)]                             

      安装 下列软件包:                                                         
11)     libncurses5 [5.9+20140118-1ubuntu1 (trusty)]                            
12)     libtinfo-dev [5.9+20140118-1ubuntu1 (trusty)]                           

      降级 下列软件包:                                                         
13)     lib32ncurses5 [6.0+20170715-2 (now) -> 5.9+20140118-1ubuntu1 (trusty)]  
14)     lib32tinfo5 [6.0+20170715-2 (now) -> 5.9+20140118-1ubuntu1 (trusty)]    
15)     libncurses5-dev [6.1+20180210-4 (now) -> 5.9+20140118-1ubuntu1 (trusty)]
16)     libreadline6 [6.3-9 (now) -> 6.3-4ubuntu2 (trusty)]                     
17)     libtinfo5 [6.1+20180210-4 (now) -> 5.9+20140118-1ubuntu1 (trusty)]      
18)     libtinfo5:i386 [6.1+20180210-4 (now) -> 5.9+20140118-1ubuntu1 (trusty)] 
19)     ncurses-base [6.1+20180210-4 (now) -> 5.9+20140118-1ubuntu1 (trusty)]   
20)     ncurses-bin [6.1+20180210-4 (now) -> 5.9+20140118-1ubuntu1 (trusty)]    



是否接受该解决方案?[Y/n/q/?] y
下列软件包将被“降级”:
  lib32ncurses5 lib32tinfo5 libncurses5-dev libreadline6 libtinfo5 libtinfo5:i386 
  ncurses-base ncurses-bin 
下列“新”软件包将被安装。
  lib32ncurses5-dev lib32tinfo-dev{a} libncurses5{a} libtinfo-dev{a} 
下列软件包将被“删除”:
  deepin-libwine:i386{a} deepin-wine{a} deepin-wine32:i386{a} 
  deepin-wine32-preloader:i386{a} deepin.com.qq.im:i386{a} 
  deepin.com.wechat:i386{a} libncurses-dev{a} libncurses-dev:i386{a} 
  libncurses5:i386{a} libncurses5-dev:i386{a} libncursesw6:i386{u} 
0 个软件包被升级,新安装 4 个,8 个被降级,11 个将被删除, 同时 19 个将不升级。
需要获取 1,104 kB 的存档。解包后将释放 333 MB。
您要继续吗?[Y/n/?] y
读取: 1 http://mirrors.aliyun.com/ubuntu trusty/main amd64 ncurses-base all 5.9+20140118-1ubuntu1 [16.6 kB]
读取: 2 http://mirrors.aliyun.com/ubuntu trusty/main amd64 libreadline6 amd64 6.3-4ubuntu2 [116 kB]
读取: 3 http://mirrors.aliyun.com/ubuntu trusty/main i386 libtinfo5 i386 5.9+20140118-1ubuntu1 [70.8 kB]
读取: 4 http://mirrors.aliyun.com/ubuntu trusty/main amd64 libtinfo5 amd64 5.9+20140118-1ubuntu1 [75.0 kB]
读取: 5 http://mirrors.aliyun.com/ubuntu trusty/main amd64 libncurses5 amd64 5.9+20140118-1ubuntu1 [93.6 kB]
读取: 6 http://mirrors.aliyun.com/ubuntu trusty/main amd64 libncurses5-dev amd64 5.9+20140118-1ubuntu1 [170 kB]
读取: 7 http://mirrors.aliyun.com/ubuntu trusty/main amd64 libtinfo-dev amd64 5.9+20140118-1ubuntu1 [76.3 kB]
读取: 8 http://mirrors.aliyun.com/ubuntu trusty/main amd64 ncurses-bin amd64 5.9+20140118-1ubuntu1 [137 kB]
读取: 9 http://mirrors.aliyun.com/ubuntu trusty/main amd64 lib32ncurses5 amd64 5.9+20140118-1ubuntu1 [92.9 kB]
读取: 10 http://mirrors.aliyun.com/ubuntu trusty/main amd64 lib32tinfo5 amd64 5.9+20140118-1ubuntu1 [70.3 kB]
读取: 11 http://mirrors.aliyun.com/ubuntu trusty/main amd64 lib32tinfo-dev amd64 5.9+20140118-1ubuntu1 [69.1 kB]
读取: 12 http://mirrors.aliyun.com/ubuntu trusty/main amd64 lib32ncurses5-dev amd64 5.9+20140118-1ubuntu1 [117 kB]
已下载 1,104 kB,耗时 1秒 (1,960 kB/s)    
(正在读取数据库 ... 系统当前共安装有 195281 个文件和目录。)
正在卸载 deepin.com.qq.im:i386 (8.9.19983deepin23) ...
正在卸载 deepin.com.wechat:i386 (2.6.2.31deepin0) ...
正在卸载 deepin-wine32-preloader:i386 (2.18-14~rc1) ...
正在卸载 deepin-wine (2.18-14~rc1) ...
正在卸载 deepin-wine32:i386 (2.18-14~rc1) ...
正在卸载 deepin-libwine:i386 (2.18-14~rc1) ...
正在卸载 libncurses5-dev:i386 (6.1+20180210-4) ...
正在卸载 libncurses5:i386 (6.1+20180210-4) ...
dpkg: 警告: 即将把 ncurses-base 从 6.1+20180210-4 降级到 5.9+20140118-1ubuntu1
(正在读取数据库 ... 系统当前共安装有 193492 个文件和目录。)
正准备解包 .../ncurses-base_5.9+20140118-1ubuntu1_all.deb  ...
正在将 ncurses-base (5.9+20140118-1ubuntu1) 解包到 (6.1+20180210-4) 上 ...
正在设置 ncurses-base (5.9+20140118-1ubuntu1) ...
dpkg: 警告: 即将把 libreadline6:amd64 从 6.3-9 降级到 6.3-4ubuntu2
(正在读取数据库 ... 系统当前共安装有 193488 个文件和目录。)
正准备解包 .../libreadline6_6.3-4ubuntu2_amd64.deb  ...
正在将 libreadline6:amd64 (6.3-4ubuntu2) 解包到 (6.3-9) 上 ...
dpkg: 警告: 即将把 libtinfo5:amd64 从 6.1+20180210-4 降级到 5.9+20140118-1ubuntu1
正准备解包 .../libtinfo5_5.9+20140118-1ubuntu1_amd64.deb  ...
正在反配置 libtinfo5:i386 (6.1+20180210-4) ...
正在将 libtinfo5:amd64 (5.9+20140118-1ubuntu1) 解包到 (6.1+20180210-4) 上 ...
dpkg: 警告: 即将把 libtinfo5:i386 从 6.1+20180210-4 降级到 5.9+20140118-1ubuntu1
正准备解包 .../libtinfo5_5.9+20140118-1ubuntu1_i386.deb  ...
正在将 libtinfo5:i386 (5.9+20140118-1ubuntu1) 解包到 (6.1+20180210-4) 上 ...
正在设置 libtinfo5:amd64 (5.9+20140118-1ubuntu1) ...
正在设置 libtinfo5:i386 (5.9+20140118-1ubuntu1) ...
正在选中未选择的软件包 libncurses5:amd64。
(正在读取数据库 ... 系统当前共安装有 193487 个文件和目录。)
正准备解包 .../libncurses5_5.9+20140118-1ubuntu1_amd64.deb  ...
正在解包 libncurses5:amd64 (5.9+20140118-1ubuntu1) ...
(正在读取数据库 ... 系统当前共安装有 193495 个文件和目录。)
正在卸载 libncurses-dev:i386 (6.1+20180210-4) ...
dpkg: libncurses-dev:amd64:有依赖问题,但是如您所愿,将继续卸载:
 libncurses5-dev:amd64 依赖于 libncurses-dev (= 6.1+20180210-4).

正在卸载 libncurses-dev:amd64 (6.1+20180210-4) ...
dpkg: 警告: 即将把 libncurses5-dev:amd64 从 6.1+20180210-4 降级到 5.9+20140118-1ubuntu1
(正在读取数据库 ... 系统当前共安装有 193369 个文件和目录。)
正准备解包 .../libncurses5-dev_5.9+20140118-1ubuntu1_amd64.deb  ...
正在将 libncurses5-dev:amd64 (5.9+20140118-1ubuntu1) 解包到 (6.1+20180210-4) 上 ...
正在选中未选择的软件包 libtinfo-dev:amd64。
正准备解包 .../libtinfo-dev_5.9+20140118-1ubuntu1_amd64.deb  ...
正在解包 libtinfo-dev:amd64 (5.9+20140118-1ubuntu1) ...
dpkg: 警告: 即将把 ncurses-bin 从 6.1+20180210-4 降级到 5.9+20140118-1ubuntu1
正准备解包 .../ncurses-bin_5.9+20140118-1ubuntu1_amd64.deb  ...
正在将 ncurses-bin (5.9+20140118-1ubuntu1) 解包到 (6.1+20180210-4) 上 ...
正在设置 ncurses-bin (5.9+20140118-1ubuntu1) ...
(正在读取数据库 ... 系统当前共安装有 193416 个文件和目录。)
正在卸载 libncursesw6:i386 (6.1+20180210-4) ...
dpkg: 警告: 即将把 lib32ncurses5 从 6.0+20170715-2 降级到 5.9+20140118-1ubuntu1
(正在读取数据库 ... 系统当前共安装有 193409 个文件和目录。)
正准备解包 .../lib32ncurses5_5.9+20140118-1ubuntu1_amd64.deb  ...
正在将 lib32ncurses5 (5.9+20140118-1ubuntu1) 解包到 (6.0+20170715-2) 上 ...
dpkg: 警告: 即将把 lib32tinfo5 从 6.0+20170715-2 降级到 5.9+20140118-1ubuntu1
正准备解包 .../lib32tinfo5_5.9+20140118-1ubuntu1_amd64.deb  ...
正在将 lib32tinfo5 (5.9+20140118-1ubuntu1) 解包到 (6.0+20170715-2) 上 ...
正在选中未选择的软件包 lib32tinfo-dev。
正准备解包 .../lib32tinfo-dev_5.9+20140118-1ubuntu1_amd64.deb  ...
正在解包 lib32tinfo-dev (5.9+20140118-1ubuntu1) ...
正在选中未选择的软件包 lib32ncurses5-dev。
正准备解包 .../lib32ncurses5-dev_5.9+20140118-1ubuntu1_amd64.deb  ...
正在解包 lib32ncurses5-dev (5.9+20140118-1ubuntu1) ...
正在设置 libncurses5:amd64 (5.9+20140118-1ubuntu1) ...
正在处理用于 lastore-daemon (0.9.66.3-1) 的触发器 ...
正在处理用于 mime-support (3.60) 的触发器 ...
正在处理用于 desktop-file-utils (0.23-3) 的触发器 ...
正在设置 libtinfo-dev:amd64 (5.9+20140118-1ubuntu1) ...
正在设置 lib32tinfo5 (5.9+20140118-1ubuntu1) ...
正在设置 lib32ncurses5 (5.9+20140118-1ubuntu1) ...
正在设置 libncurses5-dev:amd64 (5.9+20140118-1ubuntu1) ...
正在处理用于 bamfdaemon (0.5.3-2+b1) 的触发器 ...
Rebuilding /usr/share/applications/bamf-2.index...
正在处理用于 libc-bin (2.27-3) 的触发器 ...
正在处理用于 man-db (2.8.3-2) 的触发器 ...
正在设置 lib32tinfo-dev (5.9+20140118-1ubuntu1) ...
正在处理用于 hicolor-icon-theme (0.17-2) 的触发器 ...
正在设置 libreadline6:amd64 (6.3-4ubuntu2) ...
正在设置 lib32ncurses5-dev (5.9+20140118-1ubuntu1) ...
                                 
当前状态:76946 (-9) new。

2.同步源码参考
https://mirrors.tuna.tsinghua.edu.cn/help/lineageOS/
https://wiki.lineageos.org/devices/dumpling/build

repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/lineageOS/LineageOS/android.git -b lineage-15.1
repo sync -c -f -j8 --force-sync --no-clone-bundle

清华镜像站这里做了限制当遇到failed请用-j1进行同步

repo sync -c -f -j1 --force-sync --no-clone-bundle

源码同步完毕

source build/envsetup.sh
breakfast dumpling

其他问题继续更新中…

错误1 高版本编译器问题

FAILED: /home/wenxiangli/android/los15/out/target/product/enchilada/obj/STATIC_LIBRARIES/libedify_intermediates/lexer.cpp 
/bin/bash -c "prebuilts/misc/linux-x86/flex/flex-2.5.39 -o/home/wenxiangli/android/los15/out/target/product/enchilada/obj/STATIC_LIBRARIES/libedify_intermediates/lexer.cpp bootable/recovery/edify/lexer.ll"
flex-2.5.39: loadlocale.c:130:_nl_intern_locale_data: ?? 'cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' ???
Aborted
ninja: build stopped: subcommand failed.
16:25:42 ninja failed with: exit status 1
 export LC_ALL=C
 source build/envsetup.sh
 make -j32

错误2 这个跟问题一其实一样

prebuilts/clang/host/linux-x86/clang-3289846/bin/clang.real: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
[  0% 2/107167] bc: libclcore.bc <= frameworks/rs/driver/runtime/rs_element.c
FAILED: /home/wenxiangli/android/los16/out/target/product/enchilada/obj/RENDERSCRIPT_BITCODE/libclcore.bc_intermediates/rs_element.bc 

解决办法

1、确定有一个64位架构的内核
$ dpkg --print-architecture  
amd64
 
2、确认打开多架构支持功能
$ dpkg --print-foreign-architectures  
i386


如果不是i386的话,那么请打开多架构支持

步骤:
2.1)、$ sudo dpkg --add-architecture i386   
2.2)、$ sudo apt -get update  
 
3、检查拥有的库文件是否需要更新版本
$ sudo apt-get dist-upgrade  
 
4、执行下面语句安装:

$ sudo apt install lib32ncursesw5 lib32ncursesw5-dev  
sudo apt-get install lib32ncurses5
2016-08-02 23:26:59 yili270 阅读数 7171
  • Linux菜鸟篇

    本课程适合未使用过Linux系统、毫无操作基础的新人,包括开发或者网管以及还未参加工作的大学生、高职生等等。

    7396 人正在学习 去看看 董松

前言:

最近项目完成得差不多了,有些空闲于是装了基于ubuntu的Deepin玩玩,感觉挺好的,于是尝试用它来作为开发的系统,接下来就是要搭建android的开发环境,但是看了好多都是很老的,IDE是eclipse的开发环境,对于喜欢尝试新鲜事物的我来说,这是不能忍的,我要用android studio!!! 所以我便将我的studio的搭建过程写到blog上,希望可以帮到有需要的人(本人也是linux菜鸟,里面使用的命令可能不是最好的,用更好地方式还请多多指教)

一.下载配置JDK

1.下载最新版的JDK 点此下载最新版JDK

2. 解压并移动到指定文件夹

  • (1) 解压jdk
  • (2)重命名文件夹(也可不修改,个人习惯)
  • (3)将jdk文件夹移到指定的目录
tar -zxvf ./jdk-8u101-linux-x64.tar.gz
sudo mv jdk1.8.0_101  jdk
sudo cp -r ./jdk/ /opt/android

3. 配置环境变量

  • 先调用以下命令 打开配置文本
~ sudo vi /etc/environment

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/android/jdk/bin"

JAVA_HOME=/opt/android/jdk
  • 让环境变量生效
~ . /etc/environment

4. 测试java环境是否搭建完成
打开命令行 输入 java -version 查看是否显示如下 java version “1.8.0XXX”
测试java图片

注:

一定先安装java后安装android studio,否则android studio会自动使用内部的openjdk,导致android开发过程中其中一些与oracle jdk语法不一样的地方,后期修改成一般用jdk也会比较繁琐

二.下载配置AndroidStudio

1.下载最新版的Android Studio 墙内用户推荐androiddevtools下载

2.将下载后的studio解压并移到指定文件夹

  • 1.解压androidstudio (不同版本的编号不一致,注意修改成你当前的编号)
  • 2 将解压后的android-studio移到opt/android下(在同一个文件夹下主要为了方便管理)
tar -zxvf ./android-studio-ide-145.3070098-linux.zip
sudo cp -r ./android-studio/ /opt/android 

3.配置androidstudio环境
先调用以下命令 打开配置文本

sudo gedit ~/.bashrc

将一下内容写入文件,并保存即可

GRADLE_HOME=/opt/android/android-studio/gradle/gradle-2.10
export PATH=$PATH:$GRADLE_HOME/bin
export ANDROID_SDK=/opt/android/android_sdk
export ANDROID_HOME=/opt/android/android_studio
export APKTOOL=/opt/android/apktool
export PATH=$APKTOOL:$ANDROID_SDK/platform-tools:$ANDROID_SDK/tools:$ANDROID_SDK/build-tools/24.0.0:$PATH

4.运行android studio
在android-studio下 运行studio.sh即可(暂时先不要尝试,因为一般可能都是没有sdk的版本)

 sudo ./bin/studio.sh 

三.安装SDK

1.下载SDK
这个获取方式就比较多了这里就不详细介绍了,,我发百度盘链接出来(http://pan.baidu.com/s/1nuR5sZv),如果分享失效,实在找不到可以留言或者私信我
2.将该文件夹移动到指定文件夹
1.先将sdk名称修改未android_sdk(说明:这里也可以不修改名称,但是你需要在配置文件中将AANDROID_SDK的路径名称与你的名称相对应)
2.将sdk移动到opt/android下

sudo mv sdk  android_sdk
sudo cp -r ./android_sdk/ /opt/android

注.一般没有翻墙的情况下安装时选择custom然后选择你的sdk路径

四.一些安装出现的问题与解决方法

1. android studio 编译项目时报错:Gradle ‘XXX’ project refresh failed Error:Error writing to server
分析:这种情况多是没有翻墙导致的gradle无法更新的问题
解决:File–>Setting–>Build,Execution,Deployment–>Gradle
-1.选择user local gradle 然后选择路径为/android/android-studio/gradle/gradle2.10.zip
-2. offline work 路径与上面相同

2. android studio 编译项目时报错:Gradle ‘XXX’ project refresh failed Error=13, 权限不够
分析:文件权限不足,提升权限(这里遇到这个问题,但是没有表明到底什么地方权限不足,故列举一些可能的地方)

sudo chmod +x  /opt/android/android-sdk/platform-tools/*
sudo chmod 777 /opt/android/jdk/jre/bin/keytool

3. jdk配置了以后在终端中输入java -version出现
java -version
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp
java version “1.8.0_25”
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) Server VM (build 25.25-b02, mixed mode)

分析:这是因为jdk运行中使用了Linux内部的openjdk的配置文件导致的
解决:删除该配置文件即可 sudo rm /etc/profile.d/java-awt-font-gasp.sh
注:有人说需要保留该配置文件 也可以备份下 具体参看考这篇文档

4. 运行studio 出现错误 “No JDK found. Please validate either STUDIO_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation.”
分析:这个问题是因为系统没有识别出来你的jdk,所以你要告诉系统你的jdk安装路径(前提是你的jdk要安装好了,就是说java -version 可以看到jdk的版本)
解决:1.$ sudo update-alternatives --install /usr/bin/java java /opt/android/jdk/bin/java 300
这段代码 分五部分 (1).sudo update-alternatives –install 告诉系统一个路径
(2)./usr/bin/java 我的理解这个是系统的jdk路径(不要修改)
(3).java jdk的名字 也就是java
(4). /opt/android/jdk/bin/java 你的实际配置的jdk路径(替换成你的jdk路径)
(5). 300优先级 可以理解成权限(不建议修改)
2.
sudo update-alternatives –install /usr/bin/javac javac /opt/android/jdk/bin/java 300
这个和上面类似 不做解释
3.
sudoupdatealternativesconfigjavajdk4. sudo update-alternatives –config java

有 3 个候选项可用于替换 java (提供 /usr/bin/java)。
  选择       路径                                优先级  状态
------------------------------------------------------------
* 0            /home/yasin/Android/jdk1.8/bin/java    300       自动模式
  1            /home/yasin/Android/jdk1.8/bin/java    300       手动模式
  2            /home/yasin/Android/jdk1.8/bin/javac   300       手动模式

要维持当前值[*]请按<回车键>,或者键入选择的编号:1

你想用那个输那个。
如上所示,这样就设置好了要使用的java了。
5.对于一些目录下需要权限 而直接运行 sududio.sh会出现一些文件不能创建的问题
建议是用 sudo 管理员身份运行

sudo: ./bin/studio.sh:找不到命令

可用如下方式来解决

chmod 777 android-studio

最后附录环境搭建成功图片

这里写图片描述

转载请注明本文链接,支持原创谢谢!!

2017-12-19 09:42:26 sksweet 阅读数 307
  • Linux菜鸟篇

    本课程适合未使用过Linux系统、毫无操作基础的新人,包括开发或者网管以及还未参加工作的大学生、高职生等等。

    7396 人正在学习 去看看 董松
        一年前在ubuntu 14.04上编译成功了jdk1.8,前不久换了deepin 15来用(可以用windows下面的几个常用软件和下载工具+Android源代码编译+商店配置好各种开箱即用的开发工具,没理由回ubuntu了),jdk源代码运行环境都没有了,只能重新搞过。因为,deepin15及ubuntu 16.10这种高版本用ubuntu 14.04这种低版本编译方法会出现各种问题,特别有些依赖问题只有deepin15/Debian高版本系列才会有,特此总结一下,供在deepin系统上以Java为业的网友做学习提高之用。

 OpenJDK的编译分为四部分:1 下载源代码,2 编译环境准备,3 高版本Linux问题处理 4 编译

一 下载源代码

    1年前的话,我是直接到openJdk网站 http://download.java.net/openjdk/jdk8/ 去下载打包好的源代码包,结果今天再去看的话,下载链接还是哪个,但点进去,已经被oracle这个货给和谐了。所以,决定使用官方第二种方式,hg下载,类似git的下载方式,下载Jdk8的源代码,方法如下:

 $sudo apt-get install mercurial -y
 $hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/  
 $cd jdk8u
 $sh get_source.sh  
这里会正式下载每个包的源代码,大概是800多M,速度并不慢,看各位的网速吧。

二 编译环境的准备
1) 设置环境变量
    首先,要说一下,构建openJDK要一个药引,这个药引叫boot jdk,这个工具一般已经集成在普通的jdk中了,所以,在这之前一定要安装一个普通的JDK7到系统上(不能比jdk8高,也不能太低,只能是低一个版本,java的二进制包安装方法,这里就不介绍了。~题外话,当今的编程语言版本基本都是用自家的低版本去编译出来的),然后继续在自家根目录.bashrc里边添加以下变量。

代码
#build openjdk option
export SKIP_DEBUG_BUILD=false    
export SKIP_FASTDEBUG_BUILD=true    
export DEBUG_NAME=debug     
export LANG=C     
export ALLOW_DOWNLOADS=true 
export USE_PRECOMPILED_HEADER=true   

export BUILD_LANGTOOLS=true  
export BUILD_JAXP=true  
export BUILD_JAXWS=true  
export BUILD_CORBA=true  
export BUILD_HOSTPOT=true  
export BUILD_JDK=true  
BUILD_DEPLOY=false  

unset CLASSPATH    
unset JAVA_HOME

2)配置编译环境
代码:
$cd jdk8u{jdk源代码根目录}
$sh configure 或者 bash configure
该过程会检测构建环境是否符合要求,如有问题,它会给出提示。下面先给出我碰到的要安装的库文件:

代码:
ubuntu和debian系统
$sudo apt-get install libxext-dev libxrender-dev libxtst-dev libxt-dev
$sudo apt-get install libcups2-dev
$sudo apt-get install libfreetype6-dev
$sudo apt-get install build-essential    
$sudo apt-get install ant
$sudo apt-get install xorg-dev
Fedora系统---没错,我还在Feodra上面试过,就下面安装依赖库不同,其他的一样.
$sudo yum groupinstall "Development Tools"
$sudo yum install gcc-c++
$sudo yum install libXtst-devel libXt-devel libXrender-devel
$sudo yum install cups-devel
$sudo yum install freetype-devel
$sudo yum install alsa-lib-devel


后面可能,大部分还有继续安装的缺失的工具,都可以通过提示apt安装即可。说一下deepin15/debian没有的库文件安装:
libX11-dev,这个库是没有的预装的,库里也没记录。上网到debian库找,
debian库总地址,以后大家缺少包都可以上debian库里找。
https://www.debian.org/distrib/packages
libX11-dev地址:
http://mirrors.ustc.edu.cn/debian/pool/main/libx/libx11/libx11-dev_1.6.4-3_amd64.deb

下载后安装
$sudo dpkg -i libx11-dev_1.6.4-3_amd64.deb

三 高版本Linux问题处理
在上面sh configure命令检查机制跑通后,即无error信息后,就可以处理高版本Linux编译环境的问题。

代码
$cd cd jdk8u{jdk源代码根目录}
$gedit ./hotspot/make/linux/makefiles/gcc.make
查找一个字段WARNINGS_ARE_ERRORS = -Werror,找到后,把它注释掉。

四 编译
因为高版本的gcc不再支持stabs,make下要加点参数(DEBUG_BINARIES=true),同时在运行时,可能出现问题,最好把错误日志打印出来。

代码
$make all DEBUG_BINARIES=true 2>&1 |tee build.log
接下来就是20多分钟的等待,编译出来的build文件有3.3G大小,还是挺大的。


后记:
   想在Windows下尝试编译jdk源代码的程序员网友可以试试以下方法,全网只有这两个下面位分享了方法,而且第二位是参考第一位的,一定要安装vs201X,因为要用到它的C++编译器,过程真的非常复杂。
https://www.cnblogs.com/lighten/p/5906359.html
http://www.jianshu.com/p/e85f93cc74cb

enjoy~

附图:


--编译成功




---上面1.7.0_95是系统JDK版本,下面1.8.0-internal是使用源代码编译的JDK

2012-08-21 11:08:14 smartdog_1 阅读数 620
  • Linux菜鸟篇

    本课程适合未使用过Linux系统、毫无操作基础的新人,包括开发或者网管以及还未参加工作的大学生、高职生等等。

    7396 人正在学习 去看看 董松

一、修改编译器版本

1、修改gcc版本,默认是4.6.1的,这个版本太高了,改为4.5.2或者4.5.3

      sudo apt-get install gcc-4.5

      sudo apt-get install g++-4.5  

6、查看下安装的结果如下:

    root@pc:# ls /usr/bin/gcc*

    /usr/bin/gcc   /usr/bin/gcc-4.6    /usr/bin/gcc-4.4  

7、增加gcc4.6和gcc4.5的可选项

     root@pc:# update-alternatives    --install      /usr/bin/gcc    gcc    /usr/bin/gcc-4.6     46

     root@pc:# update-alternatives    --install     /usr/bin/gcc     gcc    /usr/bin/gcc-4.5      45

    如果没有第一句的话,也能行。但是系统默认的4.6版本的GCC就不能使用了。为了以后能用得着,还是加上第一句。

8、切换版本到gcc-4.5

    root@pc:# update-alternatives   --config   gcc

    There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

  选择       路径            优先级  状态
------------------------------------------------------------
* 0            /usr/bin/gcc-4.6   46        自动模式
  1            /usr/bin/gcc-4.5   45        手动模式

9、切换g++ 版本到4.5

   同上。
要维持当前值[*]请按回车键,或者键入选择的编号:1(自己手动输入要选择的默认值,输入1,设置默认为4.5版本的)

9、查看当前gcc版本

    root@pc:# gcc -v


二、添加JDK环境

          去官网下载JDK安装包,或者压缩包都行。解压到指定目录,然后执行以下环境变量的配置。
         我使用的是JDK-1.6 其他版本的没有尝试

vi ~/.bashrc

 在配置文件中加入如下部分:

            #set java environment
            USER_NAME=zhy
           JAVA_HOME=/home/$USER_NAME/bin/jdk1.6.0_29/
           export JRE_HOME=$JAVA_HOME/jre
           export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
           export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

           #以下为Eclipse开发环境的环境变量配置。对于单纯编译Android源码,以下不需要
            export PATH="$PATH:/home/$USER_NAME/bin/eclipse/android-sdk-linux_x86/platform-tools"
            export PATH="$PATH:/home/$USER_NAME/bin/eclipse"

            export PATH="$PATH:/home/$USER_NAME/bin"

          注意:PATH与后面的字符窜之间没有空格。等号两边不能有空格


三、安装依赖库

   sudo apt-get install bison libc6-dev-i386 g++-4.5-multilib zlib1g-dev lib32z1-dev bison flex 
                                       lib32ncurses5-dev  libx11-dev gperf ia32-libs  lib32stdc++6  u-boot-tools

   注意:一定要将gcc/g++版本修改之后在进行编译。同时安装g++-4.5-multilib的时候注意版本一定要指定。
没有更多推荐了,返回首页