Forum > macOS / Mac OS X

trying to compile 32bit on 64bit OSX. Linker Error

(1/3) > >>

Key-Real:
Im trink to comple as 32bit, but I get linker error:








Linking test
ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
ld: warning: ignoring file /System/Library/Frameworks//Foundation.framework/Foundation, building for macOS-i386 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation, missing required architecture i386 in file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation (2 slices)
ld: warning: ignoring file /System/Library/Frameworks//Cocoa.framework/Cocoa, building for macOS-i386 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /System/Library/Frameworks//QuartzCore.framework/QuartzCore, building for macOS-i386 but attempting to link with file built for macOS-x86_64ld: warning: ignoring file /System/Library/Frameworks//CoreData.framework/CoreData, missing required architecture i386 in file /System/Library/Frameworks//CoreData.framework/CoreData (2 slices)

ld: warning: ignoring file /System/Library/Frameworks//Carbon.framework/Carbon, building for macOS-i386 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /System/Library/Frameworks//AppKit.framework/AppKit, building for macOS-i386 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture i386:
  ".objc_class_name_NSApplication", referenced from:
      .objc_class_name_TCocoaApp in vipgfx.o
  ".objc_class_name_NSAutoreleasePool", referenced from:
      pointer-to-literal-objc-class-name in vipgfx.o
  ".objc_class_name_NSBundle", referenced from:
      pointer-to-literal-objc-class-name in vipgfx.o
      pointer-to-literal-objc-class-name in CocoaAll.o
  ".objc_class_name_NSFileManager", referenced from:
      pointer-to-literal-objc-class-name in vipgfx.o
  ".objc_class_name_NSMenu", referenced from:
      pointer-to-literal-objc-class-name in vipgfx.o
  ".objc_class_name_NSMenuItem", referenced from:
      pointer-to-literal-objc-class-name in vipgfx.o
  ".objc_class_name_NSNotificationCenter", referenced from:
      pointer-to-literal-objc-class-name in vipgfx.o
  ".objc_class_name_NSOpenGLContext", referenced from:
      pointer-to-literal-objc-class-name in vipgfx.o
  ".objc_class_name_NSOpenGLPixelFormat", referenced from:
      pointer-to-literal-objc-class-name in vipgfx.o
  ".objc_class_name_NSProcessInfo", referenced from:
      pointer-to-literal-objc-class-name in vipgfx.o
  ".objc_class_name_NSScreen", referenced from:
      pointer-to-literal-objc-class-name in vipgfx.o
  ".objc_class_name_NSTrackingArea", referenced from:
      pointer-to-literal-objc-class-name in vipgfx.o
  ".objc_class_name_NSURL", referenced from:
      pointer-to-literal-objc-class-name in vipgfx.o
  ".objc_class_name_NSView", referenced from:
      .objc_class_name_TOpenGLView in vipgfx.o
  ".objc_class_name_NSWindow", referenced from:
      .objc_class_name_TBorderlessWindow in vipgfx.o
  "_CFBundleCopyLocalizedString", referenced from:
      _MACOSALL_$$_CFCOPYLOCALIZEDSTRING$CFSTRINGREF$PCHAR$$CFSTRINGREF in MacOSAll.o
      _MACOSALL_$$_CFCOPYLOCALIZEDSTRINGFROMTABLE$CFSTRINGREF$CFSTRINGREF$PCHAR$$CFSTRINGREF in MacOSAll.o
      _MACOSALL_$$_CFCOPYLOCALIZEDSTRINGFROMTABLEINBUNDLE$crc9C35D2E2 in MacOSAll.o
      _MACOSALL_$$_CFCOPYLOCALIZEDSTRINGWITHDEFAULTVALUE$crc26953C69 in MacOSAll.o
  "_CFBundleGetMainBundle", referenced from:
      _MACOSALL_$$_CFCOPYLOCALIZEDSTRING$CFSTRINGREF$PCHAR$$CFSTRINGREF in MacOSAll.o
      _MACOSALL_$$_CFCOPYLOCALIZEDSTRINGFROMTABLE$CFSTRINGREF$CFSTRINGREF$PCHAR$$CFSTRINGREF in MacOSAll.o
  "_CFRelease", referenced from:
      _TOOLS_$$_MAKEMESSAGE$ANSISTRING in tools.o
  "_CFStringCreateWithPascalString", referenced from:
      _TOOLS_$$_MAKEMESSAGE$ANSISTRING in tools.o
  "_CFUUIDGetConstantUUIDWithBytes", referenced from:
      _MACOSALL_$$_IUNKNOWNUUID$$CFUUIDREF in MacOSAll.o
      _MACOSALL_$$_KMDEXTERNALDATASTORETYPEID$$CFUUIDREF in MacOSAll.o
      _MACOSALL_$$_KMDEXTERNALDATASTORESTOREINTERFACEID$$CFUUIDREF in MacOSAll.o
      _MACOSALL_$$_KMDIMPORTERTYPEID$$CFUUIDREF in MacOSAll.o
      _MACOSALL_$$_KMDIMPORTERINTERFACEID$$CFUUIDREF in MacOSAll.o
      _MACOSALL_$$_KMDEXPORTERINTERFACEID$$CFUUIDREF in MacOSAll.o
      _MACOSALL_$$_KMDIMPORTERURLINTERFACEID$$CFUUIDREF in MacOSAll.o
      ...
  "_CFUserNotificationDisplayAlert", referenced from:
      _TOOLS_$$_MAKEMESSAGE$ANSISTRING in tools.o
  "_GetItemCmd", referenced from:
      _MACOSALL_$$_GETITEMCMD$MENUREF$WORD$CHAR in MacOSAll.o
  "_GetItemMark", referenced from:
      _MACOSALL_$$_GETITEMMARK$MENUREF$WORD$CHAR in MacOSAll.o
  "_GetKeys", referenced from:
      _MACOSALL_$$_GETKEYS$KEYMAP in MacOSAll.o
  "_NSApp", referenced from:
      _VIPGFX_$$_COCOA_POLLEVENTS in vipgfx.o
      _VIPGFX_$$_SETUPMAINMENU in vipgfx.o
      _VIPGFX$_$SETUPMAINMENU_$$_ADDMENU$NSMENU in vipgfx.o
      _VIPGFX_$$_COCOA_INIT$$BOOLEAN in vipgfx.o
  "_NSApplicationDidChangeScreenParametersNotification", referenced from:
      -[TBorderlessWindow initWithContentRect:styleMask:backing:defer:] in vipgfx.o
  "_NSDefaultRunLoopMode", referenced from:
      -[TCocoaApp poll] in vipgfx.o
  "_NSViewGlobalFrameDidChangeNotification", referenced from:
      -[TOpenGLView initWithFrame:] in vipgfx.o
  "_TickCount", referenced from:
      _VIPGFX_$$_GETTICKCOUNT$$LONGWORD in vipgfx.o
  "___CFStringMakeConstantString", referenced from:
      _COCOAALL_$$_NSSTR$PCHAR$$NSSTRING in CocoaAll.o
      _COCOAALL_$$_NSSTR$ANSISTRING$$NSSTRING in CocoaAll.o
  "_kCFAllocatorDefault", referenced from:
      _MACOSALL_$$_KMDEXTERNALDATASTORETYPEID$$CFUUIDREF in MacOSAll.o
      _MACOSALL_$$_KMDEXTERNALDATASTORESTOREINTERFACEID$$CFUUIDREF in MacOSAll.o
      _MACOSALL_$$_KMDIMPORTERTYPEID$$CFUUIDREF in MacOSAll.o
      _MACOSALL_$$_KMDIMPORTERINTERFACEID$$CFUUIDREF in MacOSAll.o
      _MACOSALL_$$_KMDEXPORTERINTERFACEID$$CFUUIDREF in MacOSAll.o
      _MACOSALL_$$_KMDIMPORTERURLINTERFACEID$$CFUUIDREF in MacOSAll.o
      _MACOSALL_$$_KQLGENERATORTYPEID$$CFUUIDREF in MacOSAll.o
      ...
ld: symbol(s) not found for architecture i386
Error: Error while linking
Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

Jonas Maebe:
macOS 10.15 and later no longer include 32 bit Intel libraries. If you wish to compile a 32 bit Intel application on such a system, you have to manually install a 32 bit SDK somewhere and point the compiler to it with the -XR command line option.

Someone created a github repository that contains most Mac OS X/OS X/macOS SDKs ever released: https://github.com/phracker/MacOSX-SDKs/ . If you don't want to clone the entire repository, you can try making a partial clone. Alternatively, you can create a full clone and then perform a partial checkout.

geraldholdsworth:
I'm in the same boat, having just upgraded to Catalina.

I've downloaded the SDKs, specifically the one for High Sierra, but now haven't got a clue what to do with it. The instructions are rather vague as to where to put this, and how to get Lazarus to see it (along with the 64 bit ones).

A nice simple step-by-step instructions would be nice, for simple folk like me.

In the meanwhile, I've got a MacBook Air with High Sierra on, but I needed to install Xcode on that - finding an old version that would install was the hardest...so that is currently downloading. And I've also trying to install Mojave in a VirtualBox on this Mac, which is taking for ever (5 hours and counting, so far, and still hasn't got to the GUI yet!).

I'm beginning to wonder if it is all worth it - I mean, how many folk will actually use the 32 bit binary, after I compile it?

Jonas Maebe:

--- Quote from: geraldholdsworth on May 08, 2021, 04:30:26 pm ---I'm in the same boat, having just upgraded to Catalina.

I've downloaded the SDKs, specifically the one for High Sierra, but now haven't got a clue what to do with it. The instructions are rather vague as to where to put this, and how to get Lazarus to see it (along with the 64 bit ones).

--- End quote ---
1) You can put it anywhere.
2) Technically Lazarus doesn't care at all, it's the system's linker. To make FPC tell the linker where the SDK is, add the -XR/full/path/to/MacOSX10.something.something.sdk command line parameter to FPC (via Lazarus, if you're using it).

geraldholdsworth:
That simple?

Well, for me, not so. Where does one put the -XR/<path>?

After a bit of Internet searching, all I could find suggested adding

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---if TargetOS = 'darwin' then begin  UsageCustomOptions += ' -k-macosx_version_min -k10.5';  UsageCustomOptions += ' -XR/Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk/';end;
To Project Options->Custom Options, in the top box with macOS 32bit Build mode selected (which worked OK before I upgraded). I even tried in the bottom box with no luck. I also tried adding -XR/<path> to the end of the Compiler executable entry in Tools->Options->Environment->Files, but it didn't like the entry when I clicked on OK.

Navigation

[0] Message Index

[#] Next page

Go to full version