Recent

Author Topic: ARM Cross-Compiling under MAC OS X  (Read 14058 times)

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
ARM Cross-Compiling under MAC OS X
« on: August 22, 2011, 11:42:03 am »

Hi all,
Has anyone experienced compiling for arm under MAC OS X? When I execute the following command I get this error message.

sudo make crossinstall CPU_TARGET=arm OS_TARGET=darwin CROSSBINDIR=/home/user/lazarus/fpc/binutils/ OPT=-dFPC_ARMEL INSTALL_PREFIX=/usr/local

signal.inc(194,6) Fatal: Can't open include file "arm/sig_cpu.inc"
Fatal: Compilation aborted
make[5]: *** [system.ppu] Error 1
make[4]: *** [fpc_smart] Error 2
make[3]: *** [darwin_smart] Error 2
make[2]: *** [rtl_smart] Error 2
make[1]: *** [build-stamp.arm-darwin] Error 2
make: *** [crossinstall] Error 2

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 828
Re: ARM Cross-Compiling under MAC OS X
« Reply #1 on: August 22, 2011, 12:03:55 pm »
Are you trying to compile for Mac OS X/ARM (i.e. iOS), or for Linux/ARM? Generic binutils cannot compile for iOS afaik, that's only supported if you use the iOS SDK assembler linker.

If you want to target Linux/ARM, add OS_TARGET=linux to your make command. In that case you should also determine what kind of processor your ARM board has and specify it (or a compatible processor) using the -CpXXX parameters in the CROSSOPT= setting.

If you want to target iOS, first install an iOS SDK if you haven't done so yet (requires $99/year subscription from Apple), then follow the instructions at http://wiki.freepascal.org/iPhone/iPod_development (although you may have to apply the patch at http://bugs.freepascal.org/bug_view_advanced_page.php?bug_id=19370 to the installation script to be able to finisht the installation).

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: ARM Cross-Compiling under MAC OS X
« Reply #2 on: August 22, 2011, 01:27:56 pm »
Thanks for the info, compiled the Linux/Arm for the Mac. The compiler stated that "as" not found but I compiled the binutils and copied the desired directory. Any idea?

/Users/user/lazarus/packager/registration/lazaruspackageintf.pas(110) Error: Assembler /usr/local/bin/as not found, switching to external assembling
« Last Edit: August 22, 2011, 01:31:53 pm by IndianaJones »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: ARM Cross-Compiling under MAC OS X
« Reply #3 on: August 22, 2011, 01:57:08 pm »
Where did you place the compiled binutils? You should prefix them to arm-linux-as and so on.

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: ARM Cross-Compiling under MAC OS X
« Reply #4 on: August 22, 2011, 03:12:44 pm »

I placed the binutils in the /Users/cemzafer/lazarus/fpc/binutils and these are the symbolic links
ar -> /usr/local/bin/arm-linux-ar
ld -> /usr/local/bin/arm-linux-ld
as -> /usr/local/bin/arm-linux-as

Everything seems to me okey but it gives the following error.
/Users/cemzafer/lazarus/packager/registration/lazaruspackageintf.pas(110) Error: Assembler /Users/cemzafer/lazarus/fpc/binutils/as not found, switching to external assembling

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: ARM Cross-Compiling under MAC OS X
« Reply #5 on: August 22, 2011, 03:54:25 pm »
What are you trying to build? Have you set the target operating system and architecture in the Project Options?

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: ARM Cross-Compiling under MAC OS X
« Reply #6 on: August 22, 2011, 04:24:29 pm »

I am trying to build androidlcl, selecting the target operating system and architecture gives the same result.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: ARM Cross-Compiling under MAC OS X
« Reply #7 on: August 23, 2011, 01:01:30 pm »
I would try the following:

1> Set the build mode of androidlcl to Android (if not already)

2> Compile with -va and post here the last 100 lines. Right click the messages window and select "Copy all and hidden to clipboard" because usually Lazarus hides a lot of compiler messages

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: ARM Cross-Compiling under MAC OS X
« Reply #8 on: September 02, 2011, 12:29:33 pm »

Hi,
I have install the arm-elf-binutils and arm-elf-gcc packages via macports. When I try to compile androidlcltest, it gives these errors. (some compile error lines are merged.)
Can someone ever tested linux-arm cross-compiling with mac os x?
Thanks.

/opt/local/arm-elf/bin/arm-linux-ld: failed to merge target specific data of file /opt/local/arm-elf/lib/libc.a(lib_a-fstatr.o)
/opt/local/arm-elf/bin/arm-linux-ld: error: Source object /opt/local/arm-elf/lib/libc.a(lib_a-lseekr.o) has EABI version 0, but target /Users/indiana/android/androidlcl/android/libs/armeabi/libandroidlcltest.so has EABI version 5
/opt/local/arm-elf/bin/arm-linux-ld: failed to merge target specific data of file /opt/local/arm-elf/lib/libc.a(lib_a-lseekr.o)
/opt/local/arm-elf/bin/arm-linux-ld: error: Source object /opt/local/arm-elf/lib/libc.a(lib_a-openr.o) has EABI version 0, but target /Users/indiana/android/androidlcl/android/libs/armeabi/libandroidlcltest.so has EABI version 5
/opt/local/arm-elf/bin/arm-linux-ld: failed to merge target specific data of file /opt/local/arm-elf/lib/libc.a(lib_a-openr.o)
/opt/local/arm-elf/bin/arm-linux-ld: error: Source object /opt/local/arm-elf/lib/libc.a(lib_a-readr.o) has EABI version 0, but target /Users/indiana/android/androidlcl/android/libs/armeabi/libandroidlcltest.so has EABI version 5
/opt/local/arm-elf/bin/arm-linux-ld: failed to merge target specific data of file /opt/local/arm-elf/lib/libc.a(lib_a-readr.o)
/Users/indiana/freepascal/lib/fpc/2.7.1/units/arm-linux/rtl/cprt0.o: In function `_start':
(.text+0x4c): undefined reference to `__libc_start_main'
/Users/indiana/freepascal/lib/fpc/2.7.1/units/arm-linux/rtl/cprt0.o: In function `_haltproc_eabi':
(.text+0x88): undefined reference to `_fini'
/Users/indiana/freepascal/lib/fpc/2.7.1/units/arm-linux/rtl/cprt0.o: In function `_haltproc_eabi':
(.text+0x90): undefined reference to `_init'
/Users/indiana/freepascal/lib/fpc/2.7.1/units/arm-linux/rtl/cwstring.o: In function `CWSTRING_$WIDE2ANSIMOVE$PWIDECHAR$ANSISTRING$LONGINT':
cwstring.pp:(.text.n_cwstring_$wide2ansimove$pwidechar$ansistring$longint+0x198): undefined reference to `iconv'
cwstring.pp:(.text.n_cwstring_$wide2ansimove$pwidechar$ansistring$longint+0x280): undefined reference to `iconv'
/Users/indiana/freepascal/lib/fpc/2.7.1/units/arm-linux/rtl/cwstring.o: In function `CWSTRING_$ANSI2WIDEMOVE$PCHAR$WIDESTRING$LONGINT':
cwstring.pp:(.text.n_cwstring_$ansi2widemove$pchar$widestring$longint+0x17c): undefined reference to `iconv'
cwstring.pp:(.text.n_cwstring_$ansi2widemove$pchar$widestring$longint+0x244): undefined reference to `iconv'
/Users/indiana/freepascal/lib/fpc/2.7.1/units/arm-linux/rtl/cwstring.o: In function `CWSTRING_$INITTHREAD':
cwstring.pp:(.text.n_cwstring_$initthread+0x14): undefined reference to `iconv_open'
cwstring.pp:(.text.n_cwstring_$initthread+0x5c): undefined reference to `iconv_open'
/Users/indiana/freepascal/lib/fpc/2.7.1/units/arm-linux/rtl/cwstring.o: In function `CWSTRING_$FINITHREAD':
cwstring.pp:(.text.n_cwstring_$finithread+0x70): undefined reference to `iconv_close'
cwstring.pp:(.text.n_cwstring_$finithread+0xe0): undefined reference to `iconv_close'
/Users/indiana/freepascal/lib/fpc/2.7.1/units/arm-linux/rtl/initc.o: In function `INITC_$FPGETCERRNO$$LONGINT':
initc.pp:(.text.n_initc_$fpgetcerrno$$longint+0x8): undefined reference to `__errno_location'
/opt/local/arm-elf/lib/libc.a(lib_a-strtol.o): In function `_strtol_r':
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_cross_arm-elf-gcc/arm-elf-gcc/work/gcc-4.6.0/newlib/libc/stdlib/strtol.c:186: undefined reference to `__umodsi3'
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_cross_arm-elf-gcc/arm-elf-gcc/work/gcc-4.6.0/newlib/libc/stdlib/strtol.c:187: undefined reference to `__udivsi3'
[231.745] Error while linking
[231.745] There were 1 errors compiling module, stopping
[231.749] Compilation aborted
Error: /usr/local/bin/ppcarm returned an error exitcode (normal if you did not specify a source file to be compiled)
TMainIDE.DoOpenEditorFile ignoring special file: /Users/indiana/android/androidlcl/

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 828
Re: ARM Cross-Compiling under MAC OS X
« Reply #9 on: September 02, 2011, 12:51:36 pm »
Those errors have nothing to do with Mac OS X. You are simply trying to combine libraries for a generic Linux EABI target (with an undefined EABI version = 0) with Android-specific code (which happens to use EABI version 5), which cannot work.

You probably have to use the -XR command line parameter to tell the compiler to instruct the linker to only search for libraries in the Android SDK.

 

TinyPortal © 2005-2018