Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to configure a library so it runs in the Xcode iOS Simulator?
    primarykey
    data
    text
    <p>I've got an iPhone app that runs on the device. Now I need to run it in the Simulator.</p> <p>It uses an open source project (<a href="http://site.icu-project.org/" rel="nofollow noreferrer">http://site.icu-project.org/</a>), which I build from the command line to create arm-compatible <code>.a</code> files. I can link these with my iPhone project, and it runs on the device.</p> <p>If I switch the target to Simulator, the build fails, as I expected:</p> <blockquote> <p>ld: warning: in libicudata.a, file was built for unsupported file format which is not the architecture being linked (i386)</p> </blockquote> <p>But if I use libs compiled for local use (x86_64), I get the <em>same error</em>, which has got be baffled. Do I have to specify a third architecture for the Simulator? Which one? How do I set the configuration?</p> <p>For reference, this is how I configured the icu project for the two different targets: <a href="https://stackoverflow.com/questions/8126233">How to build ICU so I can use it in an iPhone app?</a></p> <p><strong>Edited to add:</strong></p> <p>As Guillaume suggested (and <a href="https://stackoverflow.com/questions/1678381">Connect iPhone App to PostgreSQL Using Libpq</a> confirmed), I now see that the emulator needs a 32-bit build. So that's the last part: <em>how do I set the configuration</em>?</p> <p>The library has a standard <code>configure</code> script, as far as I know, but I'm still pretty new at this.</p> <p><strong>Edited to add:</strong></p> <p>I've gotten this far, but the references to i686 are obviously wrong.</p> <p>I don't know if i386 is considered a cross-compile, if it is I need "host" and "target" options, too.</p> <pre><code>ICU_PATH=/Users/eric.grunin/Documents/dev/icu2 DEVROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer SDKROOT=$DEVROOT/SDKs/iPhoneSimulator4.3.sdk SYSROOT=$SDKROOT ICU_FLAGS="-I$ICU_PATH/source/common/ -I$ICU_PATH/source/tools/tzcode/ " export CXXPP= export CXXPPFLAGS= export CPPFLAGS="-I$SDKROOT/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/ -I$SDKROOT/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/include/ -I$SDKROOT/usr/include/ -I$SDKROOT/usr/include/c++/4.2.1/armv7-apple-darwin10/ -I./include/ -miphoneos-version-min=2.2 $ICU_FLAGS" export CFLAGS="$CPPFLAGS -pipe -no-cpp-precomp -isysroot $SDKROOT" export CPP="$DEVROOT/usr/bin/cpp $CPPFLAGS" export CXXFLAGS="$CFLAGS" export CC="$DEVROOT/usr/llvm-gcc-4.2/bin/i686-apple-darwin10-llvm-gcc-4.2" export CXX="$DEVROOT/usr/llvm-gcc-4.2/bin/i686-apple-darwin10-llvm-g++-4.2" export LDFLAGS="-L$SDKROOT/usr/lib/ -isysroot $SDKROOT -Wl,-dead_strip -miphoneos-version-min=2.0" cd $ICU_PATH mkdir simbuild cd simbuild $ICU_PATH/source/configure --enable-static --disable-shared gnumake </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload