Shared libraries cannot be found when building application in Yocto - yocto

I tried to compile my application with cmake in my Yocto project. My application depends on some static and dynamic libraries. And I added the dependencies in my recipe. I confirmed that all .so and .a have had been installed into recipe-sysroot/usr/lib during building. But some errors still occurs, like,
ld: cannot find -lparson
ld: cannot find -luamqp
And I also observed some wired messages like,
-L/yocto/build_test/tmp/work/armv7at2hf-neon-fslc-linux-gnueabi/my-app/1.0-r0/git/lib
but there is no git/lib
How can I change the link directory to /usr/lib
DEPENDS = "\
azure-iot-sdk-c \
openssl \
zlib \
curl \
boost \
parson \
gtest \
"
S = "${WORKDIR}/git"
B = "${WORKDIR}/build"

Related

Build custom Yocto recipe with meson and ninja

I'm trying to write a custom recipe for a library from github (Aravis). The build/install steps are done using meson and ninja.
$ meson build
$ cd build
$ ninja
$ ninja install
Before writing/adding the recipe, I've added meson, ninja and dependencies in my custom layer.conf. Then, on system, I've cloned the library, compiled it and run some test. Everything works fine, so I'm sure meson, ninja and all dependencies are in place (at system level).
Now I've wrote the recipe
SUMMARY = "Aravis, Your industrial vision library"
LICENSE = "LGPL-2.1"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/LGPL-2.1-only;md5=1a6d268fd218675ffea8be556788b780"
inherit systemd
SRC_URI = "https://github.com/AravisProject/aravis/archive/refs/tags/0.8.22.tar.gz"
SRC_URI[md5sum] = "8d24f794b1c5160f21c2b0d77764c86d"
DEPENDS=" \
gstreamer1.0 \
gstreamer1.0-plugins-base \
libxml2 \
glib-2.0 \
glib-2.0-native \
zlib \
libusb1 \
gtk-doc \
gobject-introspection \
intltool-native \
meson \
"
S = "${WORKDIR}/aravis-0.8.22"
do_configure() {
( cd ${S}
meson build )
}
do_build() {
( cd ${S}/build
ninja )
}
do_install () {
( cd ${S}/build
ninja install )
}
The do_configure() step fails with a meson: not found error. I don't know about ninja yet (didn't reach the do_build()), but it will probably fail, too.
How to have meson and ninja tools available at compile level?
As a blind test, I tried rebuilding the toolchain (bitbake meta-toolchain-qt5), hoping those tools will be added for the next image build, but with no luck.
EDIT
I've also noticed that meson and ninja are already available in my sdk (the one installed on host for cross-compilation after build with mentioned command bitbake meta-toolchain-qt5).
mix#SWDEV1:/opt/fsl-imx-xwayland/5.10-hardknott/sysroots/x86_64-pokysdk-linux$ find . -name ninja
./usr/bin/ninja
mix#SWDEV1:/opt/fsl-imx-xwayland/5.10-hardknott/sysroots/x86_64-pokysdk-linux$ find . -name meson
./usr/share/meson
./usr/bin/meson
The tools are available. I just need to understand how to use them.
Found the problem.
Another test I did was adding inherit meson and removing the custom tasks, but without luck.
Testing it a little more, I discovered the the problem was the recipe name, that was aravis_%.bb. Since I didn't define a recipe version, the resulting build path was tmp/work/cortexa53-crypto-poky-linux/aravis/%_r0/, and it looks like meson doesn't like the character %.
So I've edited my recipe so that the version is defined
SUMMARY = "Aravis, Your industrial vision library"
LICENSE = "LGPL-2.1"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/LGPL-2.1-only;md5=1a6d268fd218675ffea8be556788b780"
PV = "0.8.22"
SRC_URI = "https://github.com/AravisProject/aravis/archive/refs/tags/${PV}.tar.gz"
SRC_URI[md5sum] = "8d24f794b1c5160f21c2b0d77764c86d"
DEPENDS=" \
gstreamer1.0 \
gstreamer1.0-plugins-base \
libxml2 \
glib-2.0 \
glib-2.0-native \
zlib \
libusb1 \
gtk-doc \
gobject-introspection \
intltool-native \
"
S = "${WORKDIR}/aravis-${PV}"
inherit meson
Now the library will be compiled and installed.

Compiling Freetype 2.6.5 Xcode for IOS

Alright guys, I posted a similar question and took it down because it wasn't specific enough so here I go. From the zip file of Freetype 2.6.5 I have not been able to create an Xcode project that will compile the library for iOS use, only for i386_64.
I tried the commands here but I don't get past the first commands the and I am getting this
FreeType build system -- automatic system detection
The following settings are used:
platform unix compiler cc
configuration directory ./builds/unix configuration rules
./builds/unix/unix.mk
If this does not correspond to your system or settings please remove
the file `config.mk' from this directory then read the INSTALL file
for help.
Otherwise, simply type
/Applications/Xcode.app/Contents/Developer/usr/bin/make' again to
build the library, or
/Applications/Xcode.app/Contents/Developer/usr/bin/make refdoc' to
build the API reference (this needs python >= 2.6).
cd builds/unix; \
./configure 'CFLAGS=-arch i386' /bin/sh: ./configure: No such file or directory make: *** [setup] Error 127
I also followed the instructions inside the cmakelists.txt that it comes inside the project but still nothing, I still get an xcode project for osx and not for IOS which is giving me a plethora of linking errors. Here is the instructions for your reference.
For an iOS static library, use
#
cmake -D IOS_PLATFORM=OS -G Xcode
#
or
#
cmake -D IOS_PLATFORM=SIMULATOR -G Xcode
I am not sure what else to do. Any help?
Here's an outline of the basic build process to compile the FreeType libaries for iOS:
Download the latest FreeType source code
Extract the archive and cd into the unarchived directory
Setup toolchain and export variables for the architectures desired (arm64, arm7, i386, x86_64)
Compile the source code and build the libraries
For example, the build commands for arm64 might look something like this:
$ export CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
$ iphoneos="7.0" # target version of iOS
$ ARCH="arm64" # architecture (arm64, arm7, i386, x86_64)
$ export CFLAGS="-arch ${ARCH} -pipe -mdynamic-no-pic -Wno-trigraphs -fpascal-strings \
-O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden \
-miphoneos-version-min=$iphoneos -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/libxml2 \
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
$ export AR="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar"
$ export LDFLAGS="-arch ${ARCH} -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk \
-miphoneos-version-min=7.0"
$ ./configure --host="aarch64-apple-darwin" --enable-static=yes --enable-shared=no
$ make
$ clean
It's a bit of work to construct the commands for each arch, but
fortunately there's a build
script
— which automatically downloads, extracts, and builds the latest FreeType (2.6.5 currently).
To run the script just use the following command in Terminal:
./build_freetype.sh
The resulting iOS libraries can be found in ~/Desktop/FreeType_iOS_Release when it completes.

How to use jpeglib in xCode

I'm developing an iPhone application and I'm kind of new to everything. I'm working on Mountain Lion OS X 10.8 and using xCode v4.5. I need JPEG handling capabilities in my project and I want to use the libjpeg (http://www.ijg.org/) library. I have tried a few different approaches, but being a bit naive, I'm not really sure how to begin. After downloading packages I've made usual ./configure; make and make install. Right now I have (jconfig.h, jerror.h, jmorecfg.h, jpeglib.h) under (/usr/local/include) and (libjpeg.a, libjpeg.la) under (/usr/local/lib) but I have no idea how to link/use this in my xCode project.
Can anyone link me to a tutorial or give me a push in the right direction?
If anyone successfully installed and used jpeg library please help..
This is a bit of a pain, because you will need to compile LibJPEG for two architectures: ARM, for iOS, and x86, for the simulator.
Your best bet is to use NSImage or CGImage. There already is a JPEG library on iOS, supplied with the system, so you don't need to use LibJPEG.
An alternative is to put the LibJPEG sources directly into your project (including the *.c files). This way, they will be built correctly for different architectures (simulation and deployment).
You could also just build for ARM, and then forget about running the simulator.
Or you could build LibJPEG as a fat binary by compiling it twice and combining the resulting library (libjpeg.a) from each compilation with libtool.
libtool -static path/to/arm/libjpeg.a path/to/x86/libjpeg.a -o libjpeg.a
You can see why the recommendation is to use NSImage or CGImage. Better to use a library that is already installed rather than try to build and install a new one.
How to make a fat static library
Since it sounds like you want to do things the hard way, here is an example of how to build a fat static library for i386 and ppc architectures. This was done on a PowerPC OS X box, you will have to adjust if you want to compile for ARM and i386.
Note that you have to specify --host and --build for cross-compiling. The values below are correct for my computer, but I am certain that they are wrong for your computer.
$ cd jpeg-8d
$ mkdir build-ppc build-i386
$ cd build-ppc
$ ../configure CFLAGS='-arch ppc -O2 -g' LDFLAGS='-arch ppc' \
--enable-static --disable-shared
$ make -j2
$ cd ../build-i386
$ ../configure CFLAGS='-arch i386 -O2 -g' LDFLAGS='-arch i386' \
--enable-static --disable-shared \
--build=powerpc-apple-darwin9.8.0 --host=i386-apple-darwin9.8.0
$ make -j2
$ cd ..
$ file build-ppc/.libs/libjpeg.a
build-ppc/.libs/libjpeg.a: current ar archive random library
$ file build-i386/.libs/libjpeg.a
build-i386/.libs/libjpeg.a: current ar archive random library
$ libtool -static build-*/.libs/libjpeg.a -o libjpeg.a
$ file libjpeg.a
libjpeg.a: Mach-O universal binary with 2 architectures
libjpeg.a (for architecture i386): current ar archive random library
libjpeg.a (for architecture ppc): current ar archive random library

command-line library build fails with linker error

I am getting a library not found error building GraphViz current release (June 7 2012) with Xcode 4.3 using a script. I may have made mistakes updating build scripts from other people's successful recipes for the new location of Xcode4.3 and the developer tools in the Applications folder.
ld: library not found for -lcrt1.10.6.o
(doing this from memory so exact number on the CRT lib may be wrong)
Am also a little lost also how I would incorporate this into an Xcode build in the IDE. I am a very experienced programmer but having trouble finding my way around Xcode 4 at times. (Decades of Visual Studio et al).
I have copied the instructions from this earlier question and adapted
#!/bin/sh
# For iPhoneOS, see http://clang.llvm.org/ for options
export DEV_iOS=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
# was /Developer/Platforms/iPhoneOS.platform/Developer
export SDK_iOS=${DEV_iOS}/SDKs/iPhoneOS5.1.sdk
export COMPILER_iOS=${DEV_iOS}/usr/bin
export CC=${COMPILER_iOS}/clang
export CXX=${COMPILER_iOS}/clang++
export LDFLAGS="-arch armv7 -pipe -Os -gdwarf-2 -mthumb -isysroot ${SDK_iOS}"
export CFLAGS="${LDFLAGS}"
export OBJCFLAGS="${LDFLAGS}"
export CXXFLAGS="${LDFLAGS} -fvisibility-inlines-hidden"
export LD=${COMPILER_iOS}/ld
export CPP=${COMPILER_iOS}/clang
export AR=${COMPILER_iOS}/ar
export AS=${COMPILER_iOS}/as
export NM=${COMPILER_iOS}/nm
export CXXCPP="${COMPILER_iOS}/clang++"
export OBJC=${COMPILER_iOS}/clang
export RANLIB=${COMPILER_iOS}/ranlib
./configure \
--build=arm-apple-darwin11 \
--host=arm-apple-darwin11 \
--disable-dependency-tracking \
--enable-shared=no \
--enable-static=yes \
--enable-ltdl=no \
--enable-swig=no \
--enable-tcl=no \
--srcdir=${GVROOT} \
--with-codegens=no \
--with-cgraph=no \
--with-graph=yes \
--with-expat=no \
--with-fontconfig=no \
--with-freetype2=no \
--with-ipsepcola=yes \
--with-libgd=no \
--with-quartz=yes \
--with-visio=yes \
--with-x=no
The compiler normally uses crt1.o combined with crt[i/n].o and crt[begin/end].o to support the constructors and destructors (functions called before and after main and exit).
This error could be caused by this missing library file for the specific deployment target.
First, do some investigation, like:
list all your deployment targets:
ls -la /Developer/SDKs
and find which crt1 libraries do you have for which environment
find /Developer/SDKs -name crt1\*
You could see something like:
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/crt1.10.5.o
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/crt1.o
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/crt1.10.5.o
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/crt1.10.6.o
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/crt1.o
So as you can see, crt1.10.6.o is missing for MacOSX10.5.
Solution 1:
You can solve that by creating the link to the missing file pointed to the other environment, or you could change your deployment target.
E.g.
ln -s /Developer/SDKs/MacOSX10.6.sdk/usr/lib/crt1.10.6.o /Developer/SDKs/MacOSX10.5.sdk/usr/lib/
Also this could be caused, that you have different gcc installed in your system. See:
which gcc;
xcrun -find gcc;
brew list | grep gcc; brew list gcc47
Solution 2
So when you're compiling using make, you can actually specify the right compiler by CC variable. E.g.
CC=/path/to/gcc-3.4 make
Solution 3
What you can also try is specifying the right target deployment environment variable for gcc, by executing the following lines:
export MACOSX_DEPLOYMENT_TARGET=10.5
export C_INCLUDE_PATH=/Developer/SDKs/MacOSX10.5.sdk/usr/include
export LIBRARY_PATH=/Developer/SDKs/MacOSX10.5.sdk/usr/lib
If this works, then you can add above lines to your shell profile (~/.profile) to make the change permanent.
How to test
Create the example conftest.c file with the following code:
#ifdef __GNUC__
yes;
#endif
And try to compile it via:
gcc conftest.c
cc conftest.c
cc conftest.cc conftest.c
Troubleshooting
To see which exactly what file is missing, try to debug it using dtruss, e.g.:
sudo dtruss -f gcc conftest.c 2>/dev/stdout | grep crt
You should see something like:
12426/0xb4e3b: stat64("/Developer/usr/lib/gcc/i686-apple-darwin10/4.2.1/crt1.10.6.o\0", 0x7FFF5FBFE780, 0xB) = -1 Err#2
So once you found the missing file, then you can follow by the first solution by linking the missing file from existing location (e.g. locate crt1.10.6.o). If you will have other missing symbols, then try another file (check the architecture before by: file `locate crt1.10.6.o`).
E.g.
sudo ln -s /Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib/crt1.10.6.o /Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/crt1.10.6.o
sudo ln -s /Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib/crt1.10.6.o /Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64/crt1.10.6.o
Related
Error in xcode project: ld: library not found for -lcrt1.10.6.o
If I remember correctly this is what fixed the library not found problem.
CFLAGS="$(OTHER_CFLAGS) -miphoneos-version-min=5.0"
LDFLAGS="$(OTHER_LDFLAGS) --miphoneos-version-min=5.0"
To link this to Xcode, under Build Settings then Header and Library search paths you need to add the paths to the built versions of the library and the header.
You can add the build script as part of your Xcode project, but I haven't had success with this, plus you should only need to build it once per version, so putting the time into anything other than a build script doesn't have much return.
If you decide to put the script in your project anyway (good luck!), then go to the build phases tab, add a build phase of type "Run Script" and paste your script there.

FFMPEG integration on iphone/ ipad project

Can any One Tell me how do i integrate FFMPEG in my iphone/ ipad project.i m using Xcode 4.
i searched a lot but did not find any useful Link .please tell me step by step procedure to integrate FFMpeg in my project.
thanks,
Prerequisites
MacPorts to install:open terminal and type
sudo port install pkgconfig
Launch Terminal and download FFmpeg source
The location of the directory is up to your personal preference and I chose to save it in a ffmpeg folder under my Home folder for easy access later on.
git clone git://source.ffmpeg.org/ffmpeg.git ~/ffmpeg
Before we go further, we need to think ahead and realize that we are likely to do some simulation on Mac itself along with actual testing on iPhone. What we need to do is that we need to build libraries for 3 architectures: armv7 (iPhone 3Gs or later), armv7s (iPhone 5) and i386 (iPhone Simulator).
Let’s create some folders inside ffmpeg folder to hold 3 different builds so that we can lipo those together into one universal build.
cd ffmpeg
mkdir armv7
mkdir armv7s
mkdir i386
mkdir -p universal/lib
To Install gas-preprocessor
Click on the ZIP icon to download gas-preprocessor.
Copy gas-preprocessor.pl to /usr/bin directory.
Change permission of gas-preprocessor.pl by setting the privilege to Read & Write for all.
Configure FFmpeg for armv7 build
Before configuring,
You may refer to the detailed options by going in to the ffmpeg folder and type:
./configure --help
list of options for your reference: FFmpeg Configure Options. The “Components options” will be up to you depending on what you want to do with FFmpeg.
Now run the following configure options:
./configure \
--prefix=armv7 \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--enable-avresample \
--enable-cross-compile \
--sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk"
\
--target-os=darwin \
--cc="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc"
\
--extra-cflags="-arch armv7 -mfpu=neon -miphoneos-version-min=6.0" \
--extra-ldflags="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk
-miphoneos-version-min=6.0" \
--arch=arm \
--cpu=cortex-a9 \
--enable-pic \
You may get a warning such as:
WARNING: Compiler does not indicate floating-point ABI, guessing soft.
No worries. You should be fine to continue to next steps.
Build FFmpeg for armv7
Run the build commands:
make clean && make && make install
Now you should be able to see files are populated inside the ffmpeg/armv7 folder. We now move onto building for armv7s for iPhone 5.
Configure and Install FFmpeg for armv7s architecture (iPhone 5)
.
/configure \
--prefix=armv7s \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--enable-avresample \
--enable-cross-compile \
--sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk"
\
--target-os=darwin \
--cc="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc"
\
--extra-cflags="-arch armv7s -mfpu=neon -miphoneos-version-min=6.0" \
--extra-ldflags="-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk
-miphoneos-version-min=6.0" \
--arch=arm \
--cpu=cortex-a9 \
--enable-pic \
Then build with:
make clean && make && make install
Configure FFmpeg for i386 build
./configure \
--prefix=i386 \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--enable-avresample \
--enable-cross-compile \
--sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk"
\
--target-os=darwin \
--cc="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc"
\
--extra-cflags="-arch i386" \
--extra-ldflags="-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk"
\
--arch=i386 \
--cpu=i386 \
--enable-pic \
--disable-asm \
Please note the last --disable-asm tag. If you forget to include this tag, you will likely to receive this error:
cc1: error in backend: Ran out of registers during register
allocation! make: *** [libavcodec/h264_cabac.o] Error 1
Build FFmpeg for i386
make clean && make && make install
Create universal library
The lipo commands (assuming you are still under the ffmpeg folder):
(Please note that Mountain Lion-supplied lipo knows nothing about armv7s as of yet. So we need to use xcrun to find the lipo supplied with the SDK.)
cd armv7/lib for file in *.a do cd ../.. xcrun -sdk iphoneos lipo
-output universal/lib/$file -create \
-arch armv7 armv7/lib/$file \
-arch armv7s armv7s/lib/$file \
-arch i386 i386/lib/$file echo "Universal $file created." cd - done cd ../..
Look under universal/lib, you will find all FAT libs freshly baked there. We now turn our attention to linking these static libraries to the Xcode project.
if you are getting error like this Error: No developer directory found at /Developer”? then type
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Linking static libraries in Xcode
Firstly, we pull in the .a files.
Create a new Empty Application using Xcode. Assign a Product Name and Company Identifier. Then click Next and save the project.
Locate the universal libs that we created (the .a files) under ffmpeg/universal/lib.
Drag the .a files into the Frameworks folder in the Project Navigator pane.
Tick “Copy items into destination group’s folder (if needed)”. And click Finish.
Now we take care of the include files.
Locate the include files under ffmpeg/armv7/include.
Drag and drop the content of that folder onto the Project Name folder in the Project Navigator pane.
Again, tick “Copy items into destination group’s folder (if needed)”. Then click Finish.
Finally, we need to set the Header Search Paths for the project.
Click on the Project in the Project Navigator pane.
In the Standard Editor in the middle of the screen, click on Build Settings.
Search for “Header Search Paths”.
Add your project path and set it to Recursive. i.e. $(SRCROOT)
Click on Build Phases.
Under Link Binary With Libraries, add libbz2.dylib and libz.dylib.
Test and verify the working of library
We are not going to be in-depth here. Just to verify that the library is functioning.
Go to your AppDelegate.m, and add:
> #include "avformat.h"
And in the didFinishLaunchingWithOptions function, add:
av_register_all();
if suppose you are getting this errors means
Undefined symbols for architecture i386:
"_iconv", referenced from:
_mail_iconv in libmailcore.a(charconv.o)
"_iconv_open", referenced from:
_charconv in libmailcore.a(charconv.o)
_charconv_buffer in libmailcore.a(charconv.o)
"_iconv_close", referenced from:
_charconv in libmailcore.a(charconv.o)
_charconv_buffer in libmailcore.a(charconv.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
then add libiconv.dylib framework
you are now ready to dive in to develop using FFmpeg on iOS.
./configure script:
./configure --extra-ldflags=-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/system --disable-bzlib --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-cross-compile --arch=arm --target-os=darwin --cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc --as='gas-preprocessor/gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk --cpu=cortex-a8 --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7' --enable-pic
this works fine. since the default FFMPEG configuration script has the default Library path set to /usr/lib/system so it can not find library libcache.dylib, so here I have set it to the latest sdk path.