Recent

Author Topic: [Solved] Unable to make iOS cross compiler  (Read 964 times)

lebao3105

  • Newbie
  • Posts: 6
[Solved] Unable to make iOS cross compiler
« on: February 16, 2024, 05:33:53 am »
I'm on macOS with the latest Xcode installed along with iOS 17 SDK. FPC installed via Homebrew. I want to build a cross compiler for my jailbroken iOS with FPC trunk. I used this command:
Code: Bash  [Select][+][-]
  1. $ make distclean all OS_TARGET=ios CPU_TARGET=arm CPU_SOURCE=x86_64 OPT="-XR/Applications/Xcode-15.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.2.sdk" PP=/usr/local/bin/ppcx64
  2.  

The process ran fine except the linking part:
Code: [Select]
ld: warning: -multiply_defined is obsolete
-macosx_version_min has been renamed to -macos_version_min
ld: warning: ignoring file '/Applications/Xcode-15.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libSystem.B.tbd': tapi error: missing required architecture x86_64 in file /Applications/Xcode-15.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libSystem.B.tbd (4 slices)
ld: Undefined symbols:
  ___error, referenced from:
      _SYSTEM_$$_GETERRNO$$LONGINT in system.o
      _SYSTEM_$$_SETERRNO$LONGINT in system.o
      _INITC_$$_FPGETCERRNO$$LONGINT in initc.o
      _INITC_$$_FPSETCERRNO$LONGINT in initc.o
  __exit, referenced from:
      _SYSUTILS_$$_EXECUTEPROCESS$RAWBYTESTRING$RAWBYTESTRING$TEXECUTEFLAGS$$LONGINT in sysutils.o
      _SYSUTILS_$$_EXECUTEPROCESS$RAWBYTESTRING$array_of_RAWBYTESTRING$TEXECUTEFLAGS$$LONGINT in sysutils.o
      _UNIX_$$_POPEN_INTERNAL$TEXT$RAWBYTESTRING$CHAR$$LONGINT in unix.o
      _UNIX_$$_POPEN_INTERNAL$TEXT$RAWBYTESTRING$CHAR$$LONGINT in unix.o
      _UNIX_$$_POPEN_INTERNAL$TEXT$RAWBYTESTRING$CHAR$$LONGINT in unix.o
      _UNIX_$$_POPEN_INTERNAL$file$RAWBYTESTRING$CHAR$$LONGINT in unix.o
      _UNIX_$$_POPEN_INTERNAL$file$RAWBYTESTRING$CHAR$$LONGINT in unix.o
      _UNIX_$$_POPEN_INTERNAL$file$RAWBYTESTRING$CHAR$$LONGINT in unix.o
      ...
  _access, referenced from:
      _SYSUTILS_$$_FILEEXISTS$RAWBYTESTRING$BOOLEAN$$BOOLEAN in sysutils.o
      _SYSUTILS_$$_FILEISREADONLY$RAWBYTESTRING$$BOOLEAN in sysutils.o
      _BASEUNIX_$$_FPACCESS$RAWBYTESTRING$LONGINT$$LONGINT in baseunix.o
      _UNIX_$$_ASSIGNSTREAM$TEXT$TEXT$ANSISTRING$array_of_ANSISTRING$$LONGINT in unix.o
      _UNIX_$$_ASSIGNSTREAM$TEXT$TEXT$TEXT$ANSISTRING$array_of_ANSISTRING$$LONGINT in unix.o
  _bcopy, referenced from:
      _SYSTEM_$$_MOVE$formal$formal$INT64 in system.o
  _chdir, referenced from:
      _SYSTEM_$$_DO_CHDIR$RAWBYTESTRING in system.o
      _BASEUNIX_$$_FPCHDIR$RAWBYTESTRING$$LONGINT in baseunix.o
  _chmod, referenced from:
      _BASEUNIX_$$_FPCHMOD$RAWBYTESTRING$WORD$$LONGINT in baseunix.o
      _CSCRIPT$_$TSCRIPT_$__$$_WRITETODISK in cscript.o
      _LINK$_$TINTERNALLINKER_$__$$_MAKEEXECUTABLE$$BOOLEAN in link.o
  _chown, referenced from:
      _BASEUNIX_$$_FPCHOWN$RAWBYTESTRING$LONGWORD$LONGWORD$$LONGINT in baseunix.o
  _close, referenced from:
      _SYSTEM_$$_DO_CLOSE$LONGINT in system.o
      _SYSUTILS_$$_DOFILELOCKING$LONGINT$LONGINT$$LONGINT in sysutils.o
      _SYSUTILS_$$_DOFILELOCKING$LONGINT$LONGINT$$LONGINT in sysutils.o
      _SYSUTILS_$$_FILEOPENNOLOCKING$RAWBYTESTRING$LONGINT$$LONGINT in sysutils.o
      _SYSUTILS_$$_FILECLOSE$LONGINT in sysutils.o
      _UNIX_$$_PCLOSE$file$$LONGINT in unix.o
      _UNIX_$$_PCLOSE$TEXT$$LONGINT in unix.o
      ...
  _closedir, referenced from:
      _SYSUTILS_$$_INTERNALFINDCLOSE$POINTER in sysutils.o
      _TERMIO$_$TTYNAME$LONGINT$$SHORTSTRING_$$_MYSEARCH$SHORTSTRING$$BOOLEAN in termio.o
      _TERMIO$_$TTYNAME$LONGINT$$SHORTSTRING_$$_MYSEARCH$SHORTSTRING$$BOOLEAN in termio.o
      _TERMIO$_$TTYNAME$LONGINT$$SHORTSTRING_$$_MYSEARCH$SHORTSTRING$$BOOLEAN in termio.o
  _dup, referenced from:
      _BASEUNIX_$$_FPDUP$TEXT$TEXT$$LONGINT in baseunix.o
      _BASEUNIX_$$_FPDUP$file$file$$LONGINT in baseunix.o
  _dup2, referenced from:
      _BASEUNIX_$$_FPDUP2$TEXT$TEXT$$LONGINT in baseunix.o
      _BASEUNIX_$$_FPDUP2$file$file$$LONGINT in baseunix.o
      _UNIX_$$_POPEN_INTERNAL$file$RAWBYTESTRING$CHAR$$LONGINT in unix.o
      _UNIX_$$_POPEN_INTERNAL$file$RAWBYTESTRING$CHAR$$LONGINT in unix.o
  _execve, referenced from:
      _SYSUTILS_$$_EXECUTEPROCESS$RAWBYTESTRING$RAWBYTESTRING$TEXECUTEFLAGS$$LONGINT in sysutils.o
      _BASEUNIX_$$_FPEXECVE$RAWBYTESTRING$PPANSICHAR$PPANSICHAR$$LONGINT in baseunix.o
      _BASEUNIX_$$_FPEXECV$RAWBYTESTRING$PPANSICHAR$$LONGINT in baseunix.o
      _UNIX_$$_INTFPEXECVEMAYBEP$RAWBYTESTRING$PPANSICHAR$PPANSICHAR$BOOLEAN$$LONGINT in unix.o
      _UNIX_$$_POPEN_INTERNAL$TEXT$RAWBYTESTRING$CHAR$$LONGINT in unix.o
      _UNIX_$$_POPEN_INTERNAL$file$RAWBYTESTRING$CHAR$$LONGINT in unix.o
  _exit, referenced from:
      _SYSTEM_$$_SYSTEM_EXIT in system.o
  _fcntl, referenced from:
      _SYSTEM_$$_FPFCNTL$LONGINT$LONGINT$$LONGINT in system.o
      _SYSTEM_$$_FPFCNTL$LONGINT$LONGINT$LONGINT$$LONGINT in system.o
      _SYSTEM_$$_FPFCNTL$LONGINT$LONGINT$FLOCK$$LONGINT in system.o
      _BASEUNIX_$$_FPFCNTL$LONGINT$LONGINT$$LONGINT in baseunix.o
      _BASEUNIX_$$_FPFCNTL$LONGINT$LONGINT$LONGINT$$LONGINT in baseunix.o
      _BASEUNIX_$$_FPFCNTL$LONGINT$LONGINT$FLOCK$$LONGINT in baseunix.o
  _flock, referenced from:
      _SYSUTILS_$$_DOFILELOCKING$LONGINT$LONGINT$$LONGINT in sysutils.o
      _UNIX_$$_FPFLOCK$TEXT$LONGINT$$LONGINT in unix.o
      _UNIX_$$_FPFLOCK$file$LONGINT$$LONGINT in unix.o
  _fork, referenced from:
      _SYSUTILS_$$_EXECUTEPROCESS$RAWBYTESTRING$array_of_RAWBYTESTRING$TEXECUTEFLAGS$$LONGINT in sysutils.o
      _UNIX_$$_ASSIGNSTREAM$TEXT$TEXT$ANSISTRING$array_of_ANSISTRING$$LONGINT in unix.o
      _UNIX_$$_ASSIGNSTREAM$TEXT$TEXT$TEXT$ANSISTRING$array_of_ANSISTRING$$LONGINT in unix.o
  _fstat$INODE64, referenced from:
      _SYSTEM_$$_DO_ISDEVICE$LONGINT$$BOOLEAN in system.o
      _SYSTEM_$$_DO_FILESIZE$LONGINT$$INT64 in system.o
      _SYSUTILS$_$FILEOPENNOLOCKING$RAWBYTESTRING$LONGINT$$LONGINT_$$_ISHANDLEDIRECTORY$LONGINT$$BOOLEAN in sysutils.o
      _SYSUTILS_$$_FILEGETDATE$LONGINT$$INT64 in sysutils.o
      _BASEUNIX_$$_FPFSTAT$TEXT$STAT$$BOOLEAN in baseunix.o
      _BASEUNIX_$$_FPFSTAT$file$STAT$$BOOLEAN in baseunix.o
      _TERMIO_$$_TTYNAME$LONGINT$$SHORTSTRING in termio.o
      ...
  _fsync, referenced from:
      _SYSUTILS_$$_FILEFLUSH$LONGINT$$BOOLEAN in sysutils.o
  _ftruncate, referenced from:
      _SYSTEM_$$_DO_TRUNCATE$LONGINT$INT64 in system.o
      _SYSUTILS_$$_FILETRUNCATE$LONGINT$INT64$$BOOLEAN in sysutils.o
  _futimens, referenced from:
      _SYSUTILS_$$_FILESETDATE$LONGINT$INT64$$LONGINT in sysutils.o
  _getcwd, referenced from:
      _SYSTEM_$$_DO_GETDIR$BYTE$RAWBYTESTRING in system.o
      _BASEUNIX_$$_FPGETCWD$$RAWBYTESTRING in baseunix.o
  _getdomainname, referenced from:
      _UNIX_$$_GETDOMAINNAME$$SHORTSTRING in unix.o
  _getenv, referenced from:
      _GLOBALS_$$_GETENVPCHAR$ANSISTRING$$PCHAR in globals.o
      _SYSUTILS_$$_GETENVIRONMENTVARIABLE$ANSISTRING$$ANSISTRING in sysutils.o
      _BASEUNIX_$$_FPGETENV$SHORTSTRING$$PANSICHAR in baseunix.o
  _getpagesize, referenced from:
      _SYSTEM_$$_DARWIN_INIT_PAGE_SIZE in system.o
  _getpid, referenced from:
      _SYSTEM_$$_GETPROCESSID$$QWORD in system.o
  _gettimeofday, referenced from:
      _SYSUTILS_$$_GETTICKCOUNT64$$QWORD in sysutils.o
      _SYSUTILS_$$_DOGETUNIVERSALDATETIME$WORD$WORD$WORD$WORD$WORD$WORD$WORD$WORD in sysutils.o
      _SYSUTILS_$$_DOGETLOCALDATETIME$WORD$WORD$WORD$WORD$WORD$WORD$WORD$WORD in sysutils.o
  _ioctl, referenced from:
      _SYSTEM_$$_FPIOCTL$LONGINT$QWORD$POINTER$$LONGINT in system.o
      _BASEUNIX_$$_FPIOCTL$LONGINT$QWORD$POINTER$$LONGINT in baseunix.o
  _link, referenced from:
      _BASEUNIX_$$_FPLINK$RAWBYTESTRING$RAWBYTESTRING$$LONGINT in baseunix.o
  _lseek, referenced from:
      _SYSTEM_$$_DO_FILEPOS$LONGINT$$INT64 in system.o
      _SYSTEM_$$_DO_SEEK$LONGINT$INT64 in system.o
      _SYSTEM_$$_DO_SEEKEND$LONGINT$$INT64 in system.o
      _SYSUTILS_$$_FILESEEK$LONGINT$INT64$LONGINT$$INT64 in sysutils.o
      _UNIX_$$_TELLDIR$PDIR$$INT64 in unix.o
  _lstat$INODE64, referenced from:
      _SYSUTILS_$$_FILEGETDATETIMEINFO$ANSISTRING$TDATETIMEINFOREC$BOOLEAN$$BOOLEAN in sysutils.o
      _SYSUTILS_$$_FILEGETSYMLINKTARGET$RAWBYTESTRING$TRAWBYTESYMLINKREC$$BOOLEAN in sysutils.o
      _BASEUNIX_$$_FPLSTAT$RAWBYTESTRING$PSTAT$$LONGINT in baseunix.o
      _BASEUNIX_$$_FPLSTAT$PANSICHAR$STAT$$LONGINT in baseunix.o
      _BASEUNIX_$$_FPLSTAT$RAWBYTESTRING$STAT$$LONGINT in baseunix.o
  _mach_task_self_, referenced from:
      _SYSTEM_$$_MACH_TASK_SELF$$LONGWORD in system.o
      _SYSTEM_$$_SYSOSALLOC$QWORD$$POINTER in system.o
      _SYSTEM_$$_SYSOSFREE$POINTER$QWORD in system.o
      _SYSTEM_$$_SYSOSREALLOC$POINTER$QWORD$QWORD$$POINTER in system.o
  _memchr, referenced from:
      _SYSTEM_$$_INDEXBYTE$formal$INT64$BYTE$$INT64 in system.o
  _memcmp, referenced from:
      _SYSTEM_$$_COMPAREBYTE$formal$formal$INT64$$INT64 in system.o
  _memset, referenced from:
      _SYSTEM_$$_FILLCHAR$formal$INT64$BYTE in system.o
  _mkdir, referenced from:
      _SYSTEM_$$_DO_MKDIR$RAWBYTESTRING in system.o
      _BASEUNIX_$$_FPMKDIR$RAWBYTESTRING$WORD$$LONGINT in baseunix.o
  _mkfifo, referenced from:
      _BASEUNIX_$$_FPMKFIFO$RAWBYTESTRING$WORD$$LONGINT in baseunix.o
  _nanosleep, referenced from:
      _SYSUTILS_$$_SLEEP$LONGWORD in sysutils.o
  _open, referenced from:
      _SYSTEM_$$_FPOPEN$PANSICHAR$LONGINT$WORD$$LONGINT in system.o
      _BASEUNIX_$$_FPOPEN$PANSICHAR$LONGINT$WORD$$LONGINT in baseunix.o
  _opendir, referenced from:
      _SYSUTILS_$$_INTERNALFINDNEXT$TABSTRACTSEARCHREC$RAWBYTESTRING$$LONGINT in sysutils.o
      _BASEUNIX_$$_FPOPENDIR$RAWBYTESTRING$$PDIR in baseunix.o
      _BASEUNIX_$$_FPOPENDIR$SHORTSTRING$$PDIR in baseunix.o
      _TERMIO$_$TTYNAME$LONGINT$$SHORTSTRING_$$_MYSEARCH$SHORTSTRING$$BOOLEAN in termio.o
  _pathconf, referenced from:
      _SYSUTILS_$$_ISFILENAMECASESENSITIVE$RAWBYTESTRING$$BOOLEAN in sysutils.o
      _SYSUTILS_$$_ISFILENAMECASEPRESERVING$RAWBYTESTRING$$BOOLEAN in sysutils.o
  _pipe, referenced from:
      _UNIX_$$_ASSIGNPIPE$LONGINT$LONGINT$$LONGINT in unix.o
  _read, referenced from:
      _SYSTEM_$$_DO_READ$LONGINT$POINTER$LONGINT$$LONGINT in system.o
      _BASEUNIX_$$_FPREAD$LONGINT$formal$QWORD$$INT64 in baseunix.o
      _UNIX_$$_IOPIPE$TEXT$$LONGINT in unix.o
  _readdir$INODE64, referenced from:
      _SYSUTILS_$$_INTERNALFINDNEXT$TABSTRACTSEARCHREC$RAWBYTESTRING$$LONGINT in sysutils.o
      _TERMIO$_$TTYNAME$LONGINT$$SHORTSTRING_$$_MYSEARCH$SHORTSTRING$$BOOLEAN in termio.o
      _TERMIO$_$TTYNAME$LONGINT$$SHORTSTRING_$$_MYSEARCH$SHORTSTRING$$BOOLEAN in termio.o
  _readlink, referenced from:
      _BASEUNIX_$$_FPREADLINK$RAWBYTESTRING$$RAWBYTESTRING in baseunix.o
  _rename, referenced from:
      _SYSTEM_$$_DO_RENAME$PANSICHAR$PANSICHAR$BOOLEAN$BOOLEAN in system.o
      _SYSUTILS_$$_RENAMEFILE$RAWBYTESTRING$RAWBYTESTRING$$BOOLEAN in sysutils.o
      _BASEUNIX_$$_FPRENAME$RAWBYTESTRING$RAWBYTESTRING$$LONGINT in baseunix.o
  _rmdir, referenced from:
      _SYSTEM_$$_DO_RMDIR$RAWBYTESTRING in system.o
      _BASEUNIX_$$_FPRMDIR$RAWBYTESTRING$$LONGINT in baseunix.o
  _select, referenced from:
      _BASEUNIX_$$_FPSELECT$LONGINT$PFDSET$PFDSET$PFDSET$LONGINT$$LONGINT in baseunix.o
      _BASEUNIX_$$_FPSELECT$TEXT$PTIMEVAL$$LONGINT in baseunix.o
      _BASEUNIX_$$_FPSELECT$TEXT$PTIMEVAL$$LONGINT in baseunix.o
      _UNIX_$$_SELECTTEXT$TEXT$PTIMEVAL$$LONGINT in unix.o
      _UNIX_$$_SELECTTEXT$TEXT$PTIMEVAL$$LONGINT in unix.o
  _sigaction, referenced from:
      _SYSTEM_$$_INSTALLDEFAULTSIGNALHANDLER$LONGINT$SIGACTIONREC in system.o
      _SYSTEM_$$_RESTOREOLDSIGNALHANDLERS in system.o
      _SYSTEM_$$_RESTOREOLDSIGNALHANDLERS in system.o
      _SYSTEM_$$_RESTOREOLDSIGNALHANDLERS in system.o
      _SYSTEM_$$_RESTOREOLDSIGNALHANDLERS in system.o
      _SYSUTILS_$$_INTERNALINQUIRESIGNAL$LONGINT$SIGACTIONREC$BOOLEAN$$TSIGNALSTATE in sysutils.o
      _SYSUTILS_$$_UNHOOKSIGNAL$LONGINT$BOOLEAN in sysutils.o
      ...
  _sigprocmask, referenced from:
      _SYSTEM_$$_REENABLE_SIGNAL$LONGINT$$BOOLEAN in system.o
  _stat$INODE64, referenced from:
      _SYSTEM_$$_DO_ERASE$PANSICHAR$BOOLEAN in system.o
      _SYSUTILS_$$_FILEAGE$RAWBYTESTRING$$INT64 in sysutils.o
      _SYSUTILS_$$_FILEGETDATETIMEINFO$ANSISTRING$TDATETIMEINFOREC$BOOLEAN$$BOOLEAN in sysutils.o
      _SYSUTILS_$$_LINUXTOWINATTR$RAWBYTESTRING$STAT$$LONGINT in sysutils.o
      _SYSUTILS_$$_FILEGETSYMLINKTARGET$RAWBYTESTRING$TRAWBYTESYMLINKREC$$BOOLEAN in sysutils.o
      _SYSUTILS_$$_FILEEXISTS$RAWBYTESTRING$BOOLEAN$$BOOLEAN in sysutils.o
      _SYSUTILS_$$_DIRECTORYEXISTS$RAWBYTESTRING$BOOLEAN$$BOOLEAN in sysutils.o
      ...
  _statfs, referenced from:
      _SYSUTILS_$$_DISKFREE$BYTE$$INT64 in sysutils.o
      _SYSUTILS_$$_DISKSIZE$BYTE$$INT64 in sysutils.o
      _UNIX_$$_FPSTATFS$ANSISTRING$PSTATFS$$LONGINT in unix.o
  _strcasecmp, referenced from:
      _SYSTEM_$$_STRICOMP$PANSICHAR$PANSICHAR$$INT64 in system.o
      _SYSUTILS_$$_STRICOMP$PANSICHAR$PANSICHAR$$INT64 in sysutils.o
  _strchr, referenced from:
      _SYSTEM_$$_STRSCAN$PANSICHAR$CHAR$$PANSICHAR in system.o
      _SYSUTILS_$$_STRSCAN$PANSICHAR$CHAR$$PANSICHAR in sysutils.o
  _strcmp, referenced from:
      _SYSTEM_$$_STRCOMP$PANSICHAR$PANSICHAR$$INT64 in system.o
      _SYSUTILS_$$_STRCOMP$PANSICHAR$PANSICHAR$$INT64 in sysutils.o
  _strcpy, referenced from:
      _SYSTEM_$$_STRCOPY$PANSICHAR$PANSICHAR$$PANSICHAR in system.o
      _SYSUTILS_$$_STRCOPY$PANSICHAR$PANSICHAR$$PANSICHAR in sysutils.o
  _strlen, referenced from:
      fpc_pchar_length in system.o
  _strncasecmp, referenced from:
      _SYSTEM_$$_STRLICOMP$PANSICHAR$PANSICHAR$INT64$$INT64 in system.o
      _SYSUTILS_$$_STRLICOMP$PANSICHAR$PANSICHAR$INT64$$INT64 in sysutils.o
  _strncmp, referenced from:
      _SYSTEM_$$_COMPARECHAR0$formal$formal$INT64$$INT64 in system.o
      _SYSTEM_$$_STRLCOMP$PANSICHAR$PANSICHAR$INT64$$INT64 in system.o
      _SYSUTILS_$$_STRLCOMP$PANSICHAR$PANSICHAR$INT64$$INT64 in sysutils.o
  _strrchr, referenced from:
      _SYSTEM_$$_STRRSCAN$PANSICHAR$CHAR$$PANSICHAR in system.o
      _SYSUTILS_$$_STRRSCAN$PANSICHAR$CHAR$$PANSICHAR in sysutils.o
  _system, referenced from:
      _UNIX_$$_FPSYSTEM$RAWBYTESTRING$$LONGINT in unix.o
  _tcflow, referenced from:
      _TERMIO_$$_TCFLOW$LONGINT$LONGINT$$LONGINT in termio.o
  _tcflush, referenced from:
      _TERMIO_$$_TCFLUSH$LONGINT$LONGINT$$LONGINT in termio.o
  _tcsendbreak, referenced from:
      _TERMIO_$$_TCSENDBREAK$LONGINT$LONGINT$$LONGINT in termio.o
  _tcsetpgrp, referenced from:
      _TERMIO_$$_TCSETPGRP$LONGINT$LONGINT$$LONGINT in termio.o
  _time, referenced from:
      _SYSTEM_$$_RANDOMIZE in system.o
      _SYSUTILS_$$_GETEPOCHTIME$$INT64 in sysutils.o
      _BASEUNIX_$$_FPTIME$$INT64 in baseunix.o
      _UNIX_$$_GETTZINFO$$TTZINFO in unix.o
      _UNIX_$$_REFRESHTZINFO in unix.o
  _uname, referenced from:
      _UNIX_$$_GETHOSTNAME$$SHORTSTRING in unix.o
  _unlink, referenced from:
      _SYSTEM_$$_DO_ERASE$PANSICHAR$BOOLEAN in system.o
      _SYSUTILS_$$_DELETEFILE$RAWBYTESTRING$$BOOLEAN in sysutils.o
      _BASEUNIX_$$_FPUNLINK$RAWBYTESTRING$$LONGINT in baseunix.o
  _utime, referenced from:
      _SYSUTILS_$$_FILESETDATE$RAWBYTESTRING$INT64$$LONGINT in sysutils.o
      _BASEUNIX_$$_FPUTIME$RAWBYTESTRING$PUTIMBUF$$LONGINT in baseunix.o
  _vfork, referenced from:
      _SYSUTILS_$$_EXECUTEPROCESS$RAWBYTESTRING$RAWBYTESTRING$TEXECUTEFLAGS$$LONGINT in sysutils.o
      _UNIX_$$_POPEN_INTERNAL$TEXT$RAWBYTESTRING$CHAR$$LONGINT in unix.o
      _UNIX_$$_POPEN_INTERNAL$file$RAWBYTESTRING$CHAR$$LONGINT in unix.o
  _vm_allocate, referenced from:
      _SYSTEM_$$_SYSOSALLOC$QWORD$$POINTER in system.o
      _SYSTEM_$$_SYSOSREALLOC$POINTER$QWORD$QWORD$$POINTER in system.o
  _vm_deallocate, referenced from:
      _SYSTEM_$$_SYSOSFREE$POINTER$QWORD in system.o
  _waitpid, referenced from:
      _BASEUNIX_$$_FPWAITPID$LONGINT$LONGINT$LONGINT$$LONGINT in baseunix.o
      _UNIX_$$_WAITPROCESS$LONGINT$$LONGINT in unix.o
  _write, referenced from:
      _SYSTEM_$$_DO_WRITE$LONGINT$POINTER$LONGINT$$LONGINT in system.o
      _BASEUNIX_$$_FPWRITE$LONGINT$formal$QWORD$$INT64 in baseunix.o
      _UNIX_$$_IOPIPE$TEXT$$LONGINT in unix.o
  dyld_stub_binder, referenced from:
      <initial-undefines>
An error occurred while linking
pp.pas(295,36) Error: Error while linking
pp.pas(295,36) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make[3]: *** [ppc] Error 1
make[2]: *** [cycle] Error 2
make[1]: *** [compiler_cycle] Error 2
make: *** [build-stamp.arm-ios] Error 2

Sounds that I'm missing something.

Any ideas?
« Last Edit: February 16, 2024, 05:08:48 pm by lebao3105 »

dbannon

  • Hero Member
  • *****
  • Posts: 2854
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Unable to make iOS cross compiler
« Reply #1 on: February 16, 2024, 06:38:32 am »
lebao, I suggest you just might be in uncharted waters here. I'll be watching how you go so please report back.

I have absolutely no experience in cross compiling from MacOS. None. But I do a bit from Linux. You have a large list of unresolved symbols there, that almost certainly means missing libraries. Probably iOS libraries.

When cross compiling to, eg, raspberry pi, I grab a heap of Pi libraries and put them in an appropriate place on my Linux box, make sure fpc.cfg knows where.  So, for you, if those libraries do exist in your MacOS box, perhaps your FPC config file does not know where to look ?  If you don't have those libraries there, then you need them, I have absolutely no idea how you handle that.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

PierceNg

  • Sr. Member
  • ****
  • Posts: 377
    • SamadhiWeb
Re: Unable to make iOS cross compiler
« Reply #2 on: February 16, 2024, 09:06:18 am »
I last built cross compilers for iOS and simulator on Monterey x86_64 using below scripts. Adapt for your environment.

For device:

Code: Text  [Select][+][-]
  1. cd $HOME/work/pascal/src/00_git/main
  2. FPC_SOURCES=`pwd`
  3. XCODE_BASE=/Application/Xcode.app/Contents/Developer
  4. TOOLCHAIN=$XCODE_BASE/Toolchains/XcodeDefault.xctoolchain/usr/bin
  5. MACSDK=`xcrun --show-sdk-path`
  6. IOSVER=16.2
  7. export IOSSDK=`xcrun --show-sdk-path --sdk iphoneos`
  8. make -s distclean
  9. make all \
  10.   OPT="-ap -FD${TOOLCHAIN} -Fl${MACSDK}/usr/lib" \
  11.   CROSSOPT="-ap -XR${IOSSDK} -FD${TOOLCHAIN} -Fl${IOSSDK}/usr/lib -ao-isysroot${IOSSDK}" \
  12.   CPU_TARGET=aarch64 OS_TARGET=ios \
  13.   PP=ppcx64
  14. make crossinstall OPT="-ap" \
  15.   CROSSOPT="-ap -XR${IOSSDK}" \
  16.   CPU_TARGET=aarch64 OS_TARGET=ios \
  17.   INSTALL_PREFIX=$HOME/pkg/fpc331 \
  18.   PP=$PWD/compiler/ppcrossa64

For simulator; take note of EXTRALIBPATH where libcextra.a should be:

Code: Text  [Select][+][-]
  1. cd $HOME/work/pascal/src/00_git/main
  2. FPC_SOURCES=`pwd`
  3. XCODE_BASE=/Application/Xcode.app/Contents/Developer
  4. TOOLCHAIN=$XCODE_BASE/Toolchains/XcodeDefault.xctoolchain/usr/bin
  5. MACSDK=`xcrun --show-sdk-path`
  6. IOSVER=16.2
  7. export IOSSDK=`xcrun --show-sdk-path --sdk iphonesimulator`
  8. make -s distclean
  9. make all \
  10.   OPT="-ap -FD${TOOLCHAIN} -Fl${MACSDK}/usr/lib" \
  11.   CROSSOPT="-ap -XR${IOSSDK} -FD${TOOLCHAIN} -Fl${IOSSDK}/usr/lib -Fl${EXTRALIBPATH} -k-lcextra -ao-isysroot${IOSSDK}" \
  12.   CPU_SOURCE=x86_64 OS_SOURCE=darwin \
  13.   CPU_TARGET=x86_64 OS_TARGET=iphonesim
  14.   PP=ppcx64
  15. make crossinstall \
  16.   OPT="-ap" \
  17.   CROSSOPT="-ap -XR${IOSSDK} -FD${TOOLCHAIN} -Fl${IOSSDK}/usr/lib -Fl${EXTRALIBPATH} -k-lcextra -ao-isysroot${IOSSDK}" \
  18.   CPU_TARGET=x86_64 OS_TARGET=iphonesim \
  19.   INSTALL_PREFIX=$HOME/pkg/fpc331 \
  20.   PP=$PWD/compiler/ppcrossx64
  21.  

Source for lcextra.c:

Code: C  [Select][+][-]
  1. // https://cknotes.com/ipad-simulator-undefined-symbols-for-architecture-x86_64-_readdirinode64/
  2. // Functions that appear to be missing when targeting the Xcode iOS Simulators
  3.  
  4. #include <dirent.h>
  5.  
  6. extern struct dirent * readdir$INODE64( DIR * dir );
  7. struct dirent * readdir$INODE64( DIR * dir )
  8. {
  9. return readdir( dir );
  10. }

Script to build libcextra.a:

Code: Text  [Select][+][-]
  1. #!/bin/sh
  2. TARGET=x86_64-apple-ios-simulator
  3. IOSSDK=`xcrun --sdk iphonesimulator --show-sdk-path`
  4. mkdir x86_64-iphonesim
  5. clang -c --target=$TARGET -isysroot $IOSSDK lcextra.c
  6. ar crs x86_64-iphonesim/libcextra.a lcextra.o

lebao3105

  • Newbie
  • Posts: 6
Re: Unable to make iOS cross compiler
« Reply #3 on: February 16, 2024, 04:57:17 pm »
The script provided by PierceNg works. It turns out that I've missed linker libraries search path.

To test, I created a simple program that just prints a text line. Compiling it was considered to be pain. Used system's fpc.cfg as dbannon suggests, I added a new unit search path for the newly built rtl package (it's been a while since I last used FPC), also added -Tios (build target) as the compiler somehow said the ppu was built for other platform?

The build success, but when I run on iOS it exits with "Killed" message, returning code 137. I read the compile log and found this:
Code: [Select]
[0.031] (FPINTRES) PPU Source: fpintres.pp not available
[0.031] (FPINTRES) PPU Source: intres.inc not available
[0.031] (FPINTRES) Load from FPINTRES (interface) unit SYSTEM
[0.031] (FPINTRES) Adding dependency: FPINTRES depends on SYSTEM
[0.031] (FPINTRES) Finished loading unit FPINTRES
[0.031] Searching file test.pas... found
[0.031] test.pas(3,6) (TEST)     Parsing implementation of test.pas
[0.031] Parsing internally generated code: procedure main(const ARGC:LongInt;const ARGV:^^AnsiChar;const ARGP:^^AnsiChar); CDecl;begin __FPC_IMPL_EXTERNAL_REDIRECT__FPC_SYSTEMMAIN(&ARGC,&ARGV,&ARGP) end;
[0.031] procedure/function $main(const LongInt;const ^^AnsiChar;const ^^AnsiChar); CDecl;
[0.031] (TEST)     Unloading resource unit FPINTRES (not needed)

Sorry for the late response, I was in school.


lebao3105

  • Newbie
  • Posts: 6
Re: Unable to make iOS cross compiler
« Reply #4 on: February 16, 2024, 05:07:25 pm »
I solved the running issue by signing it with ldid. Thanks everyone for helping me!

 

TinyPortal © 2005-2018