View Issue Details

IDProjectCategoryView StatusLast Update
0017470FPCCompilerpublic2011-12-01 09:24
ReportereugenekryukovAssigned ToJonas Maebe 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformiPhone SimulatorOSMac OS XOS Version10.6
Product Version2.5.1Product Build 
Target VersionFixed in Version2.6.0 
Summary0017470: Linker error when linked for iPhoneOS Simulator
DescriptionProject can't linked for iPhoneOS Simulator (i386) for iPhone SDK 3.2+ (tested on 3.2, 4.0, 4.1). For iPhone SDK 2.x linker work correct.

Undefined symbols:
  ".objc_class_name_NSObject", referenced from:
      .objc_class_name_ApplicationDelegate in vg_platform_ios.o
      .objc_class_name_TCocoaTimerObject in vg_platform_ios.o
  ".objc_class_name_NSString", referenced from:
      literal-pointer@__OBJC@__cls_refs@NSString in vg_platform_ios.o
  ".objc_class_name_UIWindow", referenced from:
      .objc_class_name_TvgNSWindow in vg_platform_ios.o
  ".objc_class_name_UIFont", referenced from:
      literal-pointer@__OBJC@__cls_refs@UIFont in vg_canvas_ios.o
  ".objc_class_name_UIImage", referenced from:
      literal-pointer@__OBJC@__cls_refs@UIImage in vg_canvas_ios.o
  ".objc_class_name_UIView", referenced from:
      .objc_class_name_TvgNSView in vg_platform_ios.o
  ".objc_class_name_NSTimer", referenced from:
      literal-pointer@__OBJC@__cls_refs@NSTimer in vg_platform_ios.o
  ".objc_class_name_UIViewController", referenced from:
      .objc_class_name_TvgNSViewController in vg_platform_ios.o
  ".objc_class_name_UIScreen", referenced from:
      literal-pointer@__OBJC@__cls_refs@UIScreen in vg_platform_ios.o
  ".objc_class_name_NSNotificationCenter", referenced from:
      literal-pointer@__OBJC@__cls_refs@NSNotificationCenter in vg_platform_ios.o
  ".objc_class_name_NSRunLoop", referenced from:
      literal-pointer@__OBJC@__cls_refs@NSRunLoop in vg_platform_ios.o
  ".objc_class_name_NSData", referenced from:
      literal-pointer@__OBJC@__cls_refs@NSData in vg_canvas_ios.o
  ".objc_class_name_NSDate", referenced from:
      literal-pointer@__OBJC@__cls_refs@NSDate in vg_platform_ios.o
  ".objc_class_name_UITextField", referenced from:
      literal-pointer@__OBJC@__cls_refs@UITextField in vg_platform_ios.o
  ".objc_class_name_UIDevice", referenced from:
      literal-pointer@__OBJC@__cls_refs@UIDevice in vg_platform_ios.o
  ".objc_class_name_NSAutoreleasePool", referenced from:
      literal-pointer@__OBJC@__cls_refs@NSAutoreleasePool in vg_platform_ios.o
ld: symbol(s) not found

For real device (ARM) project compiled and linked with out error.
Steps To ReproduceJust use iPhone SDK 3.2 +
TagsNo tags attached.
Fixed in Revision16065
FPCOldBugId0
FPCTarget
Attached Files

Activities

Jonas Maebe

2010-09-30 14:13

manager   ~0041382

Last edited: 2010-10-02 00:51

There is now a separate iphonesim target that can be used to target iPhoneSimulators that use the Objective-C 2.0 ABI.

In short:
a) build the i386 compiler normally and install it
b) build the iphonesim units: make FPC=installed_ppc386 OS_TARGET=iphonesim all
c) install the iphonesim units: sudo make FPC=installed_ppc386 OS_TARGET=iphonesim install CROSSINSTALL=1

Next, you will also have to modify the Xcode build scripts (under the "fpc" target) so that
a) the "build libfpc.a" and "Compile Pascal Sources" phases use the units from i386-iphonesim instead of i386-darwin when compiling for i386
b) the "Compile Pascal Sources" phase adds "-Tiphonesim" to the compiler options when compiling for i386

The iphonsim target defines both "darwin" and "iphonesim", so you can use {$ifdef darwin} for common code and {$ifdef iphonesim} for iphonesim-specific code.

Jonas Maebe

2010-09-30 14:25

manager   ~0041383

One more thing: step c) will also install a "ppcross386" compiler. You can ignore/delete it, as it is not different from the regular ppc386 installed during step b).

You do *not* need it to compile iphonesim binaries, because any ppc386 compiler can always generate code for all i386 platforms.

eugenekryukov

2010-10-01 06:33

reporter   ~0041390

Not i have error when try to install iphonesim units:

make FPC=installed_ppc386 OS_TARGET=iphonesim all

Result:
...
fpcmake -p -Ti386-iphonesim Makefile.fpc
Processing Makefile.fpc
Error: No targets set
make[3]: *** [fpc_install] Error 1
make[2]: *** [rtl_distinstall] Error 2
make[1]: *** [installbase] Error 2
make: *** [install] Error 2

Jonas Maebe

2010-10-01 10:04

manager   ~0041396

After the "make all" and before the "make install", copy utils/fpcm/fpcmake to /usr/local/bin

Jonas Maebe

2010-10-01 11:59

manager   ~0041398

Actually, the step a) in my instructions should already have updated the global fpcmake, so I'm not sure why it's not working for you.

Marco van de Voort

2010-10-01 17:44

manager   ~0041402

Does "which fpcmake" return /usr/local/bin ?

Jonas Maebe

2010-10-01 22:19

manager   ~0041411

I've now added "CROSSINSTALL=1" at the end of the iphonesim install line (point c), so that it will not overwrite the existing fpcmake and other utilities. However, that cannot have caused the problem because those binaries (obviously) also contain iphonesim support (and they're also plain i386 binaries, although they'll only run on 10.5 and later).

Issue History

Date Modified Username Field Change
2010-09-23 07:52 eugenekryukov New Issue
2010-09-30 14:13 Jonas Maebe Fixed in Revision => 16065
2010-09-30 14:13 Jonas Maebe Status new => resolved
2010-09-30 14:13 Jonas Maebe Fixed in Version => 2.5.1
2010-09-30 14:13 Jonas Maebe Resolution open => fixed
2010-09-30 14:13 Jonas Maebe Assigned To => Jonas Maebe
2010-09-30 14:13 Jonas Maebe Note Added: 0041382
2010-09-30 14:25 Jonas Maebe Note Added: 0041383
2010-10-01 06:33 eugenekryukov Status resolved => feedback
2010-10-01 06:33 eugenekryukov Resolution fixed => reopened
2010-10-01 06:33 eugenekryukov Note Added: 0041390
2010-10-01 10:04 Jonas Maebe Status feedback => resolved
2010-10-01 10:04 Jonas Maebe Resolution reopened => fixed
2010-10-01 10:04 Jonas Maebe Note Added: 0041396
2010-10-01 11:59 Jonas Maebe Note Added: 0041398
2010-10-01 17:44 Marco van de Voort Note Added: 0041402
2010-10-01 22:15 Jonas Maebe Note Edited: 0041382
2010-10-01 22:19 Jonas Maebe Note Added: 0041411
2010-10-02 00:50 Jonas Maebe Note Edited: 0041382
2010-10-02 00:51 Jonas Maebe Note Edited: 0041382
2011-12-01 09:24 Marco van de Voort FPCOldBugId => 0
2011-12-01 09:24 Marco van de Voort Fixed in Version 2.5.1 => 2.6.0