Home Help Center

Problem building for iPhone

emarshemarsh Member Eric MarshOrganization: Durable Coating SystemsProject: Initially transparent DB synchronization
I've just started working with Ice, building and installing it and then trying to run the demos. I was able to run the "hello" project on the iPhone simulator but when I try to build and install on the device I seem to be getting a stream of link errors (see the output below). I've experimented with the Make.rules, turning the COMPILE_FOR_IPHONE_SIMULATOR & COMPILE_FOR_IPHONE on and off but that didn't help, though it did cause the tests to fail.

Any suggestions on a fix?


cd /Users/emarsh/Development/IceTouch-0.1.0/objc/demo/iPhone/hello
setenv IPHONEOS_DEPLOYMENT_TARGET 2.2
setenv MACOSX_DEPLOYMENT_TARGET 10.5
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.0 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk -L/Users/emarsh/Development/IceTouch-0.1.0/objc/demo/iPhone/hello/build/Debug-iphoneos -L/Users/emarsh/Development/IceTouch-0.1.0/objc/demo/iPhone/hello/../../../lib -L/opt/IceTouch-0.1.0/lib -F/Users/emarsh/Development/IceTouch-0.1.0/objc/demo/iPhone/hello/build/Debug-iphoneos -filelist /Users/emarsh/Development/IceTouch-0.1.0/objc/demo/iPhone/hello/build/hello.build/Debug-iphoneos/hello.build/Objects-normal/armv6/hello.LinkFileList -mmacosx-version-min=10.5 -Wl,-dead_strip -ObjC -miphoneos-version-min=2.2 -framework Foundation -framework UIKit -framework CFNetwork -framework Security -lIceObjC.0.1.0 -o /Users/emarsh/Development/IceTouch-0.1.0/objc/demo/iPhone/hello/build/Debug-iphoneos/hello.app/hello
ld warning: in /Users/emarsh/Development/IceTouch-0.1.0/objc/lib/libIceObjC.0.1.0.dylib, file is not of required architecture
Undefined symbols:
"_OBJC_CLASS_$_ICEOperationNotExistException", referenced from:
[email protected] in Hello.o
"_OBJC_CLASS_$_ICEUtil", referenced from:
[email protected] in helloAppDelegate.o
"_OBJC_METACLASS_$_ICEObject", referenced from:
_OBJC_METACLASS_$_DemoHello in Hello.o
"_OBJC_EHTYPE_$_ICEUserException", referenced from:
GCC_except_table0 in Hello.o
GCC_except_table2 in Hello.o
GCC_except_table3 in Hello.o
GCC_except_table5 in Hello.o
"_OBJC_METACLASS_$_ICEObjectPrx", referenced from:
_OBJC_METACLASS_$_DemoHelloPrx in Hello.o
"_OBJC_CLASS_$_ICEInitializationData", referenced from:
[email protected] in helloAppDelegate.o
"_OBJC_CLASS_$_ICEObject", referenced from:
_OBJC_CLASS_$_DemoHello in Hello.o
[email protected] in Hello.o
"_ICEInternalLookupString", referenced from:
-[DemoHello dispatch__:is:os:] in Hello.o
"_OBJC_CLASS_$_ICEUnknownUserException", referenced from:
[email protected] in Hello.o
"_OBJC_EHTYPE_$_ICELocalException", referenced from:
GCC_except_table0 in helloAppDelegate.o
GCC_except_table1 in helloViewController.o
GCC_except_table2 in helloViewController.o
GCC_except_table3 in helloViewController.o
"_OBJC_CLASS_$_ICEObjectPrx", referenced from:
_OBJC_CLASS_$_DemoHelloPrx in Hello.o
"_OBJC_EHTYPE_$_ICEEndpointParseException", referenced from:
GCC_except_table0 in helloViewController.o
"_OBJC_CLASS_$_ICECallbackOnMainThread", referenced from:
[email protected] in helloViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Comments

  • slypeteslypete Member Pete SylvesterOrganization: Coconaut StudiosProject: iPhone/iPod Game ✭✭
    I found building IceTouch to be pretty straight forward if you follow the instructions in the INSTALL file.

    My guess is that you haven't defined IDENTIFIER in your ~/.MacOSX/environment.plist.

    Have a closer look at the instructions located in INSTALL if this is the case.

    Pete
  • emarshemarsh Member Eric MarshOrganization: Durable Coating SystemsProject: Initially transparent DB synchronization
    There was no .MacOSX directory in my home directory but I created it, added the IDENTITY to the environment file and rebooted to see if it would help. No luck. I had already set the IDENTITY in the build preferences and in other projects that has worked fine.

    It really looks to me like something isn't getting linked in.
  • slypeteslypete Member Pete SylvesterOrganization: Coconaut StudiosProject: iPhone/iPod Game ✭✭
    Hmm...

    I made another observation looking at your compiler's output. It seems you're trying to build for iPhoneOS 2.2.

    The following is in the IceTouch docs:
    The iPhone SDK 2.1 is required if you want to build Ice Touch applications for the iPhone, iPod touch, or iPhone simulator.

    It's quite possible that this has just not been updated yet, but perhaps only 2.1 is supported on the device?

    Pete
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Eric,

    It sounds like you didn't run "make clean" after changing the COMPILE_FOR_IPHONE or COMPILE_FOR_IPHONE_SIMULATOR settings from the objc/config/Make.rules file and before re-building the demo.

    You need to run "make clean" and "make" again at the top-level of the source distribution to ensure the Ice Touch library is re-built with the correct settings. Could you try again and see if it helps?

    Cheers,
    Benoit.
  • emarshemarsh Member Eric MarshOrganization: Durable Coating SystemsProject: Initially transparent DB synchronization
    benoit wrote: »
    Hi Eric,

    It sounds like you didn't run "make clean" after changing the COMPILE_FOR_IPHONE or COMPILE_FOR_IPHONE_SIMULATOR settings from the objc/config/Make.rules file and before re-building the demo.

    You need to run "make clean" and "make" again at the top-level of the source distribution to ensure the Ice Touch library is re-built with the correct settings. Could you try again and see if it helps?

    Cheers,
    Benoit.

    Benoit,

    I've actually done that several times, going back and forth between having those settings enabled and disabled. I found that when they were enabled the python test suite failed. I was also unable to run the stand-alone demo server when the defines were set and got the following error:

    dyld: Library not loaded: @executable_path/Frameworks/libIceObjC.0.1.0.dylib
    Referenced from: /Users/emarsh/Development/IceTouch-0.1.0/objc/demo/Ice/hello/./server
    Reason: image not found

    However when the defines were not set the simulator still builds and runs - I just can't get it to build for the actual iPhone device in any case.

    Incidentally, I've tried building for different versions of the iPhone OS with no effect.

    Can you tell me where the missing objects are supposed to be found?
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    I'm confused as to what you are trying to do.

    There are three possible builds:
    - Mac OS
    - iPhone simulator
    - iPhone device

    If you build for the simulator or the device you cannot run the stand alone demos. They are only for the mac os builds.

    I suggest doing the following to run the demos on the iPhone itself.

    - Download a new Ice Touch distribution and unpack.
    - edit config/Make.rules and select COMPILE_FOR_IPHONE
    - Build the distribution & install.
    - Ensure $IDENTIFIER is set correctly in your global environment (in terminal echo $IDENTIFIER).
    - Build the iPhone demos.

    At this point you should be able to run the demos on your device. If that doesn't work, then please let us know precisely which step failed, and what failure you received.

    Note that you can build and install each of the three types of builds from the same distribution. However, if you want to do that you must:

    - Ensure the distribution is clean.
    - Edit config/Make.rules to set the desired build.
    - Compile, and install.

    The libraries are installed in different directories. The mac os builds will be installed by default in /opt/IceTouch-0.1.0/lib, the iPhone simulator in /opt/IceTouch-0.1.0/lib/simulator and the iPhone device in /opt/IceTouch-0.1.0-lib/device. The header files, and slice2objc translator are the same between the three build types.
  • emarshemarsh Member Eric MarshOrganization: Durable Coating SystemsProject: Initially transparent DB synchronization
    Matthew,

    I'm trying to get the hello app to run on the iPhone. In order to test it I need to run the stand-alone server in demo/hello. The server won't run when built with COMPILE_FOR_IPHONE set. Evidently the iPhone hardware version won't build with COMPILE_FOR_IPHONE not set. So there seems to be a conflict there.

    I created the IDENTIFIER as per the instructions in the INSTALL doc (in fact I cut and pasted your code) and I see it when I do the echo. But let me ask you a question. Is the IDENTITY used just by Xcode or by your make? I can and have set it in Xcode under Project->Edit Project Settings->Build->Code Signing Identity. This has worked for all the other projects that I've worked on.

    I did discover that the COMPILE_FOR_IPHONE and COMPILE_FOR_IPHONE_SIMULATOR flags are mutually exclusive. I had them both set and didn't see the device directory under lib. I set the COMPILE_FOR_IPHONE exclusively and now I see device. I selected the library in XCode and pointed it at the device directory and now I seem to have two fewer link errors.

    I'll keep at it.
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    IDENTIFIER won't cause missing object files. If you have IDENTIFIER set incorrectly, you'll get a dynamic linker error on the phone when you try and execute/deploy the app.
    But let me ask you a question. Is the IDENTITY used just by Xcode or by your make? I can and have set it in Xcode under Project->Edit Project Settings->Build->Code Signing Identity. This has worked for all the other projects that I've worked on.

    It is used by both Xcode (to sign the demos & the test suite) and make when signing the shared libraries.

    At any rate, the problem is that you are mixing up architectures in your build. The build itself tells you that:
    ld warning: in /Users/emarsh/Development/IceTouch-0.1.0/objc/lib/libIceObjC.0.1.0.dylib, file is not of required architecture

    Just to be 100% clear, the iPhone demos link against the libraries in your source build (not in /opt). Hence, the build in your source tree must be an iPhone build.

    As I previously recommended, you should start from scratch with a fresh unadulterated distribution. Unpack it, set COMPILE_FOR_IPHONE, make, and then build the iPhone demos with Xcode. There should be no need to alter anything in the distribution, other than config/Make.rules. If you are messing with the Xcode build files, or our Makefiles you are certainly doing something wrong.
  • emarshemarsh Member Eric MarshOrganization: Durable Coating SystemsProject: Initially transparent DB synchronization
    OK, I'll unpack it again and take another shot at things.


    When I echo IDENTIFIER I get:

    Catbert:IceTouch-0.1.0 emarsh$ echo $IDENTIFIER
    iPhone Developer: Eric Marsh

    I deleted the Ice directory, did a fresh unpack, set the define and built. The build appears to have gone OK but when I ran the test suite I got the following:

    Catbert:objc emarsh$ python allTests.py

    *** running tests 1/16 in /Users/emarsh/Development/IceTouch-0.1.0/objc/test/Ice/proxy
    *** configuration: Default
    *** test started: 12/08/08 07:46:59
    tests with regular server.
    starting server... Output is not a PID: sh: /Users/emarsh/Development/IceTouch-0.1.0/objc/test/Ice/proxy/server: No such file or directory
    Traceback (most recent call last):
    File "/Users/emarsh/Development/IceTouch-0.1.0/objc/test/Ice/proxy/run.py", line 27, in <module>
    TestUtil.clientServerTest(name)
    File "/Users/emarsh/Development/IceTouch-0.1.0/config/TestUtil.py", line 1075, in clientServerTest
    clientServerTestWithOptions(name, "", "")
    File "/Users/emarsh/Development/IceTouch-0.1.0/config/TestUtil.py", line 1071, in clientServerTestWithOptions
    getDefaultClientFile())
    File "/Users/emarsh/Development/IceTouch-0.1.0/config/TestUtil.py", line 1035, in clientServerTestWithOptionsAndNames
    getServerPid(serverPipe)
    File "/Users/emarsh/Development/IceTouch-0.1.0/config/TestUtil.py", line 567, in getServerPid
    serverPids.append(int(output))
    ValueError: invalid literal for int() with base 10: 'sh: /Users/emarsh/Development/IceTouch-0.1.0/objc/test/Ice/proxy/server: No such file or directory'
    ('test in /Users/emarsh/Development/IceTouch-0.1.0/objc/test/Ice/proxy failed with exit status', 256)

    So it looks like the server isn't starting for the tests.

    I unset the COMPILE_FOR_IPHONE flag, did a "make clean" and another build. This time the tests succeeded. I then did a "make install". Next I started the server as a background process.

    I then did a "make clean", reset the COMPILE_FOR_IPHONE flag and did another build.

    This time I got a different set of errors when I ran the test suite:

    ** running tests 1/16 in /Users/emarsh/Development/IceTouch-0.1.0/objc/test/Ice/proxy
    *** configuration: Default
    *** test started: 12/08/08 08:10:21
    tests with regular server.
    starting server... Output is not a PID: dyld: Library not loaded: /opt/IceTouch-0.1/lib/libTestCommon.dylib
    Traceback (most recent call last):
    File "/Users/emarsh/Development/IceTouch-0.1.0/objc/test/Ice/proxy/run.py", line 27, in <module>
    TestUtil.clientServerTest(name)
    File "/Users/emarsh/Development/IceTouch-0.1.0/config/TestUtil.py", line 1075, in clientServerTest
    clientServerTestWithOptions(name, "", "")
    File "/Users/emarsh/Development/IceTouch-0.1.0/config/TestUtil.py", line 1071, in clientServerTestWithOptions
    getDefaultClientFile())
    File "/Users/emarsh/Development/IceTouch-0.1.0/config/TestUtil.py", line 1035, in clientServerTestWithOptionsAndNames
    getServerPid(serverPipe)
    File "/Users/emarsh/Development/IceTouch-0.1.0/config/TestUtil.py", line 567, in getServerPid
    serverPids.append(int(output))
    ValueError: invalid literal for int() with base 10: 'dyld: Library not loaded: /opt/IceTouch-0.1/lib/libTestCommon.dylib'
    sh: line 1: 17646 Trace/BPT trap /Users/emarsh/Development/IceTouch-0.1.0/objc/test/Ice/proxy/server --Ice.NullHandleAbort=1 --Ice.Warn.Connections=1 --Ice.ThreadPool.Server.Size=1 --Ice.ThreadPool.Server.SizeMax=3 --Ice.ThreadPool.Server.SizeWarn=0 --Ice.PrintProcessId=1 --Ice.PrintAdapterReady=1 --Ice.ServerIdleTime=30 --Ice.Default.Host=127.0.0.1 2>&1
    ('test in /Users/emarsh/Development/IceTouch-0.1.0/objc/test/Ice/proxy failed with exit status', 256)

    I am able to build in Xcode though, which was the big problem I was facing. So it looks like my problem is that I failed to notice that the COMPILE_FOR_IPHONE and COMPILE_FOR_IPHONE_SIMULATOR flags are mutually exclusive. When I set them both COMPILE_FOR_IPHONE_SIMULATOR overrode COMPILE_FOR_IPHONE.

    It looks like it is necessary to do a make clean and then another build each time I move from the simulator to the device. I think that people would appreciate being able to build one time, having Xcode just look in the correct location for the applicable library. There is also the problem of the server not running when any of the IPHONE flags are set. I set COMPILE_FOR_IPHONE_SIMULATOR, did a build and tried to start the server. I got the error:

    Catbert:IceTouch-0.1.0 emarsh$ objc/demo/Ice/hello/server
    dyld: Library not loaded: @executable_path/Frameworks/libIceObjC.0.1.0.dylib
    Referenced from: /Users/emarsh/Development/IceTouch-0.1.0/objc/demo/Ice/hello/server
    Reason: image not found

    Thanks for the help.
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Eric,

    Overall, I recommend that you unpack the Ice Touch source distribution 3 times in 3 separate directories, and build each directory with a different target (MacOS, simulator, device). Cleaning and rebuilding the same directory over and over is not very convenient.

    The demo/iPhone/hello README.txt actually suggests this setup:
    This demo runs against any hello server, such as the server in
    objc/demo/Ice/hello. To run the server in objc/demo/Ice/hello it must
    have been previously built with the Mac OS X version of Ice Touch in a
    separate build tree.
    

    Later on, when you build your own application, you should use the installed version of Ice Touch, and you will no longer need these 3 build directories.

    Best regards,
    Bernard
  • slypeteslypete Member Pete SylvesterOrganization: Coconaut StudiosProject: iPhone/iPod Game ✭✭
    emarsh wrote: »
    It looks like it is necessary to do a make clean and then another build each time I move from the simulator to the device. I think that people would appreciate being able to build one time, having Xcode just look in the correct location for the applicable library.

    To solve this problem, I compiled two versions of IceTouch and setup a separate target for the simulator and the device.

    I plan to improve this to just one target in the future by using conditional linking, but I haven't had the time to investigate it further.

    edit: I was in the process of writing this when Bernard posted!
  • emarshemarsh Member Eric MarshOrganization: Durable Coating SystemsProject: Initially transparent DB synchronization
    Thanks for the feedback. All in all this looks like it should be really useful. I'm planning on writing some generic code that will synchronize remote and local databases with it and then some apps that use that code.
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    emarsh wrote: »
    ...
    I deleted the Ice directory, did a fresh unpack, set the define and built. The build appears to have gone OK but when I ran the test suite I got the following:

    Catbert:objc emarsh$ python allTests.py

    *** running tests 1/16 in /Users/emarsh/Development/IceTouch-0.1.0/objc/test/Ice/proxy
    *** configuration: Default
    *** test started: 12/08/08 07:46:59
    tests with regular server.
    starting server... Output is not a PID: sh: /Users/emarsh/Development/IceTouch-0.1.0/objc/test/Ice/proxy/server: No such file or directory
    Traceback (most recent call last):
    File "/Users/emarsh/Development/IceTouch-0.1.0/objc/test/Ice/proxy/run.py", line 27, in <module>
    TestUtil.clientServerTest(name)
    File "/Users/emarsh/Development/IceTouch-0.1.0/config/TestUtil.py", line 1075, in clientServerTest
    clientServerTestWithOptions(name, "", "")
    File "/Users/emarsh/Development/IceTouch-0.1.0/config/TestUtil.py", line 1071, in clientServerTestWithOptions
    getDefaultClientFile())
    File "/Users/emarsh/Development/IceTouch-0.1.0/config/TestUtil.py", line 1035, in clientServerTestWithOptionsAndNames
    getServerPid(serverPipe)
    File "/Users/emarsh/Development/IceTouch-0.1.0/config/TestUtil.py", line 567, in getServerPid
    serverPids.append(int(output))
    ValueError: invalid literal for int() with base 10: 'sh: /Users/emarsh/Development/IceTouch-0.1.0/objc/test/Ice/proxy/server: No such file or directory'
    ('test in /Users/emarsh/Development/IceTouch-0.1.0/objc/test/Ice/proxy failed with exit status', 256)

    So it looks like the server isn't starting for the tests.
    ...

    Just in case is it not clear, this is expected. If you build for the iPhone you cannot run any of the stand alone tests or demos. This stuff is only for the mac os build.

    For the iPhone simulator, or the device, you have to run the iPhone versions. This is (or at least it should be) documented in the INSTALL file.
Sign In or Register to comment.