编译Android时没有此类文件或目录错误

时间:2011-12-20 21:18:50

标签: android android-ndk java-native-interface live555

在使用ndk为android编译live555时,我遇到了这个错误!

cd liveMedia ; make
make[1]: Entering directory `/home/jomit/Public/jimjh-liveMedia-for-Android-0c18fdd/liveMedia'
arm-linux-androideabi-ar cr libliveMedia.a -L/home/jomit/Applications/android-ndk-r6/sources/cxx-stl/gnu-libstdc++/libs/armeabi  \
    Media.o MediaSource.o FramedSource.o FramedFileSource.o FramedFilter.o ByteStreamFileSource.o ByteStreamMultiFileSource.o ByteStreamMemoryBufferSource.o BasicUDPSource.o DeviceSource.o AudioInputDevice.o WAVAudioFileSource.o MPEG1or2Demux.o MPEG1or2DemuxedElementaryStream.o MPEGVideoStreamFramer.o MPEG1or2VideoStreamFramer.o MPEG1or2VideoStreamDiscreteFramer.o MPEG4VideoStreamFramer.o MPEG4VideoStreamDiscreteFramer.o H264VideoStreamFramer.o H264VideoStreamDiscreteFramer.o MPEGVideoStreamParser.o MPEG1or2AudioStreamFramer.o MPEG1or2AudioRTPSource.o MPEG4LATMAudioRTPSource.o MPEG4ESVideoRTPSource.o MPEG4GenericRTPSource.o MP3FileSource.o MP3HTTPSource.o MP3Transcoder.o MP3ADU.o MP3ADUdescriptor.o MP3ADUinterleaving.o MP3ADUTranscoder.o MP3StreamState.o MP3Internals.o MP3InternalsHuffman.o MP3InternalsHuffmanTable.o MP3ADURTPSource.o MPEG1or2VideoRTPSource.o MPEG2TransportStreamMultiplexor.o MPEG2TransportStreamFromPESSource.o MPEG2TransportStreamFromESSource.o MPEG2TransportStreamFramer.o ADTSAudioFileSource.o H263plusVideoRTPSource.o H263plusVideoStreamFramer.o H263plusVideoStreamParser.o AC3AudioStreamFramer.o AC3AudioRTPSource.o DVVideoStreamFramer.o DVVideoRTPSource.o JPEGVideoSource.o AMRAudioSource.o AMRAudioFileSource.o InputFile.o MediaSink.o FileSink.o BasicUDPSink.o AMRAudioFileSink.o H264VideoFileSink.o MPEG1or2AudioRTPSink.o MP3ADURTPSink.o MPEG1or2VideoRTPSink.o MPEG4LATMAudioRTPSink.o MPEG4GenericRTPSink.o MPEG4ESVideoRTPSink.o H263plusVideoRTPSink.o H264VideoRTPSink.o DVVideoRTPSink.o AC3AudioRTPSink.o GSMAudioRTPSink.o JPEGVideoRTPSink.o SimpleRTPSink.o AMRAudioRTPSink.o TCPStreamSink.o OutputFile.o uLawAudioFilter.o RTPSource.o MultiFramedRTPSource.o SimpleRTPSource.o H261VideoRTPSource.o H264VideoRTPSource.o QCELPAudioRTPSource.o AMRAudioRTPSource.o JPEGVideoRTPSource.o RTPSink.o MultiFramedRTPSink.o AudioRTPSink.o VideoRTPSink.o RTPInterface.o RTCP.o rtcp_from_spec.o RTSPServer.o RTSPClient.o RTSPCommon.o RTSPServerSupportingHTTPStreaming.o SIPClient.o MediaSession.o ServerMediaSession.o PassiveServerMediaSubsession.o OnDemandServerMediaSubsession.o FileServerMediaSubsession.o MPEG4VideoFileServerMediaSubsession.o H264VideoFileServerMediaSubsession.o H263plusVideoFileServerMediaSubsession.o WAVAudioFileServerMediaSubsession.o AMRAudioFileServerMediaSubsession.o MP3AudioFileServerMediaSubsession.o MPEG1or2VideoFileServerMediaSubsession.o MPEG1or2FileServerDemux.o MPEG1or2DemuxedServerMediaSubsession.o MPEG2TransportFileServerMediaSubsession.o ADTSAudioFileServerMediaSubsession.o DVVideoFileServerMediaSubsession.o AC3AudioFileServerMediaSubsession.o QuickTimeFileSink.o QuickTimeGenericRTPSource.o AVIFileSink.o MPEG2IndexFromTransportStream.o MPEG2TransportStreamIndexFile.o MPEG2TransportStreamTrickModeFilter.o DarwinInjector.o BitVector.o StreamParser.o DigestAuthentication.o our_md5.o our_md5hl.o Base64.o Locale.o
arm-linux-androideabi-ar: -L/home/jomit/Applications/android-ndk-r6/sources/cxx-stl/gnu-libstdc++/libs/armeabi: No such file or directory
make[1]: *** [libliveMedia.a] Error 1
make[1]: Leaving directory `/home/jomit/Public/jimjh-liveMedia-for-Android-0c18fdd/liveMedia'
make: *** [all] Error 2

错误说明:

arm-linux-androideabi-ar: -L/home/jomit/Applications/android-ndk-r6/sources/cxx-stl/gnu-libstdc++/libs/armeabi: No such file or directory

但我的文件系统上有/home/jomit/Applications/android-ndk-r6/sources/cxx-stl/gnu-libstdc++/libs/armeabi目录。它是通过从android ndk的make-standalone-toolchain.sh目录运行脚本tools获得的。为了避免所有权限问题,我使用chmod 777 -R /home/jomit/Applications/android-ndk-r6/为ndk及其子目录授予了所有权限。我的问题是如何解决这个错误?

注意:

来自github的

liveMedia-for-Android是我正在使用的live555 android端口。

我正在运行64位Fedora 16。

以下是我正在运行以编译live555的android.sh文件:

#!/bin/sh
# 
# Builds libraries for Android
# Written by Jiunn Haur Lim <jim@jh-lim.com>

export PATH="${NDK_ROOT}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/:${PATH}"

SYS_ROOT="${NDK_ROOT}/platforms/android-8/arch-arm"
PREF="arm-linux-androideabi-"
export LD="${PREF}ld  --sysroot=${SYS_ROOT}"

./genMakefiles android
make

exit 0

以下是config.android文件:

CROSS_COMPILE   ?=      arm-linux-androideabi-

SYS_ROOT        =       $(NDK_ROOT)/platforms/android-8/arch-arm

COMPILE_OPTS    =       $(INCLUDES) -I. -O2 -DSOCKLEN_T=socklen_t -DNO_SSTREAM=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -fPIC --sysroot=$(SYS_ROOT) -DLINUX -DANDROID

C               =       c

C_COMPILER      =       $(CROSS_COMPILE)gcc

C_FLAGS         =       $(COMPILE_OPTS) -lc -lgcc

CPP             =       cpp

CPLUSPLUS_COMPILER =    $(CROSS_COMPILE)g++

CPLUSPLUS_FLAGS =       $(COMPILE_OPTS) -Wall -DBSD=1 -lstdc++ -lsupc++ \

                        -I$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/include \

                        -I$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include \

                        -L$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/armeabi 

OBJ             =       o

LINK            =       $(CROSS_COMPILE)g++ --sysroot=$(SYS_ROOT) -o 

LINK_OPTS       =       -L$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/armeabi 

CONSOLE_LINK_OPTS =     $(LINK_OPTS)

LIBRARY_LINK    =       $(CROSS_COMPILE)ar cr 

LIBRARY_LINK_OPTS =     $(LINK_OPTS)

LIB_SUFFIX      =           a

LIBS_FOR_CONSOLE_APPLICATION =

LIBS_FOR_GUI_APPLICATION =

EXE =

这两个文件 - android.shconfig.android - 都是端口已有的文件。

我非常感谢任何帮助,因为Google对这个问题缺乏了解:)

1 个答案:

答案 0 :(得分:0)

问题是GNU ar (在这种情况下是arm-linux-androideabi-ar)不接受-L选项,这导致它将其视为文件(而不是路径)动态链接时应该转到 gcc / ld 的选项。

ar 从一组目标文件中编译静态库,因此不需要/遵守 -L 选项。