PDA

View Full Version : nes.app compiled from source, but can not run


xqterry
03-30-2008, 03:53 PM
Hi

I installed iphone SDK beta2, iphone opensource toolchain, and Helloworld sample could be compiled & run on my iphone(1.1.4). Then I compile iphone NES from source by:
make -f Makefile.iPhoneOS2.0

It can be compiled but I got error when run it on iphone:

dyld: Symbol not found: _OBJC_CLASS_$_AVSystemController
Referenced from: /Applications/./NES.app/NES
Expected in: /System/Library/Frameworks/Celestial.framework/Celestial

Could anybody help me ?

OS: leopard 10.5.2 on thinkpad t60

thanks

Darkmen
03-30-2008, 10:16 PM
iPhone version 1.2 or 1.1.4?

xqterry
03-31-2008, 12:21 PM
Hi Darkmen

it is 1.1.4

Darkmen
03-31-2008, 01:33 PM
But u compiled for 1.2 (as i can c from make-like)
How do u want it to work on 1.1.4?!

Adrian Fogge
03-31-2008, 04:16 PM
Something as simple as a Hello World app is pretty easy to run on ANYTHING.

When you get into more complex applications that use the symbols packs or linking to system libraries, you can get into some troubles when dealing with different versions of everything.

Remember, we know that there are quite a few changes between 1.2/2.0 and 1.1.4.

xqterry
04-01-2008, 07:39 AM
thanks for explain.

I modified Makefile to use Toolchain.platform & 1.1.4 filesystem. Toolchain.platform is copied from iPhoneOS2.0 and replaced system lib by 1.1.4 just like Darkmen's make.sdk for xcode doing.

now I got link error:

ndefined symbols:
"_OBJC_CLASS_$_UIImageAndTextTableCell", referenced from:
_OBJC_CLASS_$_UIDeletableCell in FileTable.o
__objc_classrefs__DATA@0 in FileSelector.o
"_OBJC_METACLASS_$_UIImageAndTextTableCell", referenced from:
_OBJC_METACLASS_$_UIDeletableCell in FileTable.o
"_OBJC_CLASS_$_UIPreferencesTextTableCell", referenced from:
__objc_classrefs__DATA@0 in MainView.o
"_OBJC_METACLASS_$_UIApplication", referenced from:
_OBJC_METACLASS_$_NESApp in NESApp.o
"_OBJC_CLASS_$_NSFileManager", referenced from:
__objc_classrefs__DATA@0 in NESApp.o
__objc_classrefs__DATA@0 in FileSelector.o
__objc_classrefs__DATA@0 in FileBrowser.o
"_OBJC_CLASS_$_NSDictionary", referenced from:
__objc_classrefs__DATA@0 in MainView.o
"_OBJC_METACLASS_$_UIView", referenced from:
_OBJC_METACLASS_$_MainView in MainView.o
_OBJC_METACLASS_$_FileBrowser in FileBrowser.o
_OBJC_METACLASS_$_EmulationView in EmulationView.o
_OBJC_METACLASS_$_ScreenView in ScreenView.o
_OBJC_METACLASS_$_ControllerView in ControllerView.o
"_OBJC_CLASS_$_NSNotificationCenter", referenced from:
__objc_classrefs__DATA@0 in NESApp.o
"_OBJC_METACLASS_$_UITable", referenced from:
_OBJC_METACLASS_$_FileTable in FileTable.o
"_OBJC_CLASS_$_NSAutoreleasePool", referenced from:
__objc_classrefs__DATA@0 in main.o
"_OBJC_CLASS_$_UIWindow", referenced from:
__objc_classrefs__DATA@0 in NESApp.o
"_OBJC_IVAR_$_UIScroller._startOffset", referenced from:
_OBJC_IVAR_$_UIScroller._startOffset$non_lazy_ptr in FileTable.o
"_OBJC_CLASS_$_UINavigationItem", referenced from:
__objc_classrefs__DATA@0 in MainView.o
"_OBJC_CLASS_$_UIPreferencesTable", referenced from:
__objc_classrefs__DATA@0 in MainView.o
"_OBJC_CLASS_$_UIApplication", referenced from:
_OBJC_CLASS_$_NESApp in NESApp.o
"_OBJC_CLASS_$_LKLayer", referenced from:
__objc_classrefs__DATA@0 in ScreenView.o
"_OBJC_CLASS_$__UISwitchSlider", referenced from:
__objc_classrefs__DATA@0 in MainView.o
"_OBJC_CLASS_$_UITable", referenced from:
_OBJC_CLASS_$_FileTable in FileTable.o
"_OBJC_CLASS_$_UIPreferencesTableCell", referenced from:
__objc_classrefs__DATA@0 in MainView.o
"_OBJC_CLASS_$_UIActionSheet", referenced from:
__objc_classrefs__DATA@0 in NESApp.o
__objc_classrefs__DATA@0 in MainView.o
"_OBJC_CLASS_$_UIToolbar", referenced from:
__objc_classrefs__DATA@0 in MainView.o
"_OBJC_CLASS_$_LKTimingFunction", referenced from:
__objc_classrefs__DATA@0 in MainView.o
"_OBJC_CLASS_$_NSMutableArray", referenced from:
__objc_classrefs__DATA@0 in FileSelector.o
__objc_classrefs__DATA@0 in FileBrowser.o
"_OBJC_CLASS_$_NSNumber", referenced from:
__objc_classrefs__DATA@0 in MainView.o
__objc_classrefs__DATA@0 in FileSelector.o
"_OBJC_CLASS_$_AVSystemController", referenced from:
__objc_classrefs__DATA@0 in NESApp.o
"_OBJC_METACLASS_$_UISectionList", referenced from:
_OBJC_METACLASS_$_FileSelector in FileSelector.o
"_OBJC_CLASS_$_UISegmentedControl", referenced from:
__objc_classrefs__DATA@0 in MainView.o
"_OBJC_CLASS_$_UIImage", referenced from:
__objc_classrefs__DATA@0 in FileBrowser.o
__objc_classrefs__DATA@0 in ControllerView.o
"_OBJC_METACLASS_$_NSObject", referenced from:
_OBJC_METACLASS_$_NESApp in NESApp.o
_OBJC_METACLASS_$_MainView in MainView.o
_OBJC_METACLASS_$_FileTable in FileTable.o
_OBJC_METACLASS_$_UIDeletableCell in FileTable.o
_OBJC_METACLASS_$_FileSelector in FileSelector.o
_OBJC_METACLASS_$_FileBrowser in FileBrowser.o
_OBJC_METACLASS_$_EmulationView in EmulationView.o
_OBJC_METACLASS_$_ScreenView in ScreenView.o
_OBJC_METACLASS_$_ControllerView in ControllerView.o
"_OBJC_CLASS_$_NSString", referenced from:
__objc_classrefs__DATA@0 in main.o
__objc_classrefs__DATA@0 in NESApp.o
__objc_classrefs__DATA@0 in MainView.o
__objc_classrefs__DATA@0 in FileSelector.o
__objc_classrefs__DATA@0 in FileBrowser.o
__objc_classrefs__DATA@0 in ControllerView.o
"_OBJC_CLASS_$_UIView", referenced from:
_OBJC_CLASS_$_MainView in MainView.o
_OBJC_CLASS_$_FileBrowser in FileBrowser.o
_OBJC_CLASS_$_EmulationView in EmulationView.o
_OBJC_CLASS_$_ScreenView in ScreenView.o
_OBJC_CLASS_$_ControllerView in ControllerView.o
"_objc_msgSendSuper2", referenced from:
-[NESApp mouseDown:] in NESApp.o
-[MainView initWithFrame:] in MainView.o
-[MainView dealloc] in MainView.o
-[MainView mouseDown:] in MainView.o
-[FileTable swipe:withEvent:] in FileTable.o
-[FileSelector initWithFrame:] in FileSelector.o
-[FileSelector reload] in FileSelector.o
-[FileSelector dealloc] in FileSelector.o
-[FileBrowser initWithFrame:] in FileBrowser.o
-[FileBrowser dealloc] in FileBrowser.o
-[EmulationView dealloc] in EmulationView.o
-[EmulationView mouseDown:] in EmulationView.o
-[EmulationView initWithFrame:] in EmulationView.o
-[ScreenView initWithFrame:] in ScreenView.o
-[ScreenView dealloc] in ScreenView.o
-[ControllerView dealloc] in ControllerView.o
-[ControllerView initWithFrame:] in ControllerView.o
"_OBJC_CLASS_$_UIHardware", referenced from:
__objc_classrefs__DATA@0 in NESApp.o
__objc_classrefs__DATA@0 in MainView.o
__objc_classrefs__DATA@0 in EmulationView.o
__objc_classrefs__DATA@0 in ScreenView.o
__objc_classrefs__DATA@0 in ControllerView.o
"_OBJC_CLASS_$_UISectionList", referenced from:
_OBJC_CLASS_$_FileSelector in FileSelector.o
"_OBJC_CLASS_$_UITransitionView", referenced from:
__objc_classrefs__DATA@0 in MainView.o
"_OBJC_CLASS_$_UINavigationBar", referenced from:
__objc_classrefs__DATA@0 in MainView.o
"_UIGraphicsGetCurrentContext", referenced from:
-[EmulationView drawRect:] in EmulationView.o
-[ControllerView drawRect:] in ControllerView.o
"_UIApplicationUseLegacyEvents", referenced from:
_main in main.o
"_OBJC_CLASS_$_LKTransition", referenced from:
__objc_classrefs__DATA@0 in MainView.o
"_OBJC_CLASS_$_UITableColumn", referenced from:
__objc_classrefs__DATA@0 in FileSelector.o
__objc_classrefs__DATA@0 in FileBrowser.o
"_OBJC_CLASS_$_NSArray", referenced from:
__objc_classrefs__DATA@0 in MainView.o


here is Makefile:

# Makefile for Apple SDK with Open Tool Chain Headers

DEV = /Developer/Platforms/Toolchain.platform/Developer
SDK = $(DEV)/SDKs/Toolchain.sdk
CC = $(DEV)/usr/bin/gcc-4.0
LD = $(CC)
VERSION = iPhoneOS,1.1.4
LDFLAGS = -arch arm -lobjc \
-framework CoreFoundation \
-framework Foundation \
-framework UIKit \
-framework LayerKit \
-framework CoreGraphics \
-framework GraphicsServices \
-framework CoreSurface \
-framework CoreAudio \
-framework Celestial \
-framework AudioToolbox \
-L"$(SDK)/usr/lib" \
-F"$(SDK)/System/Library/Frameworks" \
-F"$(SDK)/System/Library/PrivateFrameworks"

CFLAGS = -arch arm \
-I"/Developer/SDKs/iPhoneOS.sdk/Versions/iPhoneOS2.0.sdk/include" \
-I"$(SDK)/usr/include" \
-I"$(DEV)/usr/lib/gcc/arm-apple-darwin9/4.0.1/include" \
-F"/System/Library/Frameworks" \
-F"$(SDK)/System/Library/Frameworks" \
-F"$(SDK)/System/Library/PrivateFrameworks" \
-DASPEN -DDEBUG -DVERSION='"$(VERSION)"' -O3 -funroll-loops \
-DMAC_OS_X_VERSION_MAX_ALLOWED=1050

all: NES package

NES: src/main.o src/NESApp.o src/MainView.o src/FileTable.o \
src/FileSelector.o src/FileBrowser.o src/EmulationView.o \
src/ScreenView.o src/NESCore/M6502.o src/NESCore/NESCore.o \
src/NESCore/NESCore_Mapper.o src/NESCore/NESCore_pAPU.o \
src/NESCore_iPhone.o src/ControllerView.o
$(LD) $(LDFLAGS) -o $@ $^

%.o: %.m
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

%.o: %.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

%.o: %.cpp
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

package:
rm -rf build
mkdir build
cp -r ./src/NES.app ./build
cp ./src/Application_Resources/*.* ./build/NES.app
mv NES ./build/NES.app
rm -rf ./build/NES.app/.svn

clean:
rm -f src/*.o src/NESCore/*.o NES src/*.gch
rm -rf ./build


I tried nm /Developer/Platforms/Toolchain.platform/Developer/SDKs/Toolchain.sdk/System/Library/Frameworks/UIKit.framework/UIKit | grep UIImageAndTextTable and I can see "00000000 A .objc_class_name_UIImageAndTextTableCell".

Could you tell me which lib(s) I should link or what I made mistake again?

thanks

Darkmen
04-01-2008, 08:14 AM
Add to CC \ LD:
-abi-version=1

xqterry
04-01-2008, 11:33 AM
Add to CC \ LD:
-abi-version=1

'-abi-version=1' takes no effect.
Should it be 'fobjc-abi-version=1' ? I tried and got different link error:

Undefined symbols:
".objc_class_name__UISwitchSlider", referenced from:
literal-pointer@__OBJC@__cls_refs@_UISwitchSlider in MainView.o
".objc_class_name_UIActionSheet", referenced from:
literal-pointer@__OBJC@__cls_refs@UIActionSheet in NESApp.o
literal-pointer@__OBJC@__cls_refs@UIActionSheet in MainView.o
".objc_class_name_UIToolbar", referenced from:
literal-pointer@__OBJC@__cls_refs@UIToolbar in MainView.o
"_UIGraphicsGetCurrentContext", referenced from:
-[EmulationView drawRect:] in EmulationView.o
-[ControllerView drawRect:] in ControllerView.o
"_UIApplicationUseLegacyEvents", referenced from:
_main in main.o

xqterry
04-01-2008, 07:37 PM
Finally I made it compiled, and it works fine on 1.1.4.
1. create a new project as Darkmen's template
2. add source files to project
3. copy /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers to Toolchain.platform with same path, otherwise there would be compile error of AudioQueue.h: no such file or dir.
4. vi /Developer/Platforms/Toolchain.platform/Developer/SDKs/Toolchain.sdk/usr/include/CoreAudio/CoreAudioTypes.h, change L29:#include <CoreService/../Frameworks/CarbonCore.framework/Headers/MacTypes.h> to <CarbonCore/MacTypes.h>