Recent

Author Topic: Cross-compile linux64 to mac32?  (Read 7369 times)

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Cross-compile linux64 to mac32?
« on: October 13, 2017, 11:39:43 am »
Is it possible?

___

Yes it is!

http://wiki.lazarus.freepascal.org/Cross_compiling_OSX_on_Linux

___

No it is not??

Quote
Note: These instructions are for i386 Linux; trying this on x64 Linux has failed. Update 2013-12-13: cross compiling from Linux for OS X no longer works at all for 10.8 and above. The compiler works fine but viable linker tools (cctools for linux) are not available for Linux anymore. Please adjust instructions if you find a solution for this.
« Last Edit: October 13, 2017, 11:43:50 am by cpicanco »
Be mindful and excellent with each other.
https://github.com/cpicanco/

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: Cross-compile linux64 to mac32?
« Reply #1 on: October 13, 2017, 12:37:44 pm »
Use fpcupdeluxe  ;)

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Re: Cross-compile linux64 to mac32?
« Reply #2 on: October 13, 2017, 05:38:08 pm »
Thanks DonAlfredo, but how to use fpcupdeluxe? Is there step-by-step instructions?
Be mindful and excellent with each other.
https://github.com/cpicanco/

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: Cross-compile linux64 to mac32?
« Reply #3 on: October 13, 2017, 07:39:13 pm »
If all goes well, it should be as easy as:
1: use fpcupdeluxe to install trunk in some directory (press trunk button)
2: use fpcupdeluxe to install a cross-compiler for target darwin/i386
3: this will fail due to missing tools/libs
4: allow fpcupdeluxe to download all and try again
You should now be able to cross.

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Re: Cross-compile linux64 to mac32?
« Reply #4 on: October 14, 2017, 04:28:21 pm »
Thank you DonAlfredo! Now I realized fpcupdeluxe is a gui! Will try to compile it on linux! Should I clone directly from github?
Be mindful and excellent with each other.
https://github.com/cpicanco/

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Re: Cross-compile linux64 to mac32?
« Reply #5 on: October 14, 2017, 04:49:19 pm »
Is it possible to install a cross compiler for an existing installation? I am guessing I need to change the install path in "InstallDir Select"
Be mindful and excellent with each other.
https://github.com/cpicanco/

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: Cross-compile linux64 to mac32?
« Reply #6 on: October 15, 2017, 09:21:51 am »
You can use the ready made binaries. See releases.
I have never tested pointing fpcupdeluxe to existing source. Just let fpcupdeluxe make its own download/install. That will work for sure.

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Re: Cross-compile linux64 to mac32?
« Reply #7 on: October 15, 2017, 08:05:42 pm »
I have tried both fpc 3.0.4 and trunk. Then tried install cross-compilers darwin-i386 and darwin-x8664:

Quote
make 'FPC=/home/rafael/fpcupdeluxe/fpcsrc/compiler/ppcrossx64' rtlclean rtl CYCLELEVEL=3
make -C /home/rafael/fpcupdeluxe/fpcsrc/rtl clean
make -C darwin clean
make -C /home/rafael/fpcupdeluxe/fpcsrc/rtl 'OPT=-vw-n-h-l-d-u-t-p-c-    ' all
make -C darwin all
/home/rafael/fpcupdeluxe/fpcsrc/compiler/ppcrossx64 -dNOMOUSE -Ur -dFPC_USE_LIBC -Tdarwin -XPx86_64-apple-darwin15- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../x86_64 -Fi../unix -Fi../bsd -Fi../bsd/x86_64 -Fi../darwin/x86_64 -FD/home/rafael/fpcupdeluxe/cross/bin/x86-darwin -FE. -FU/home/rafael/fpcupdeluxe/fpcsrc/rtl/units/x86_64-darwin -vw-n-h-l-d-u-t-p-c- -dx86_64 -dRELEASE -XPx86_64-apple-darwin15- -Xd -Fl/home/rafael/fpcupdeluxe/cross/lib/x86-darwin/MacOSX10.11.sdk/usr/lib -Fl/home/rafael/fpcupdeluxe/cross/lib/x86-darwin/MacOSX10.11.sdk/usr/lib/system -Us -Sg ../bsd/system.pp
/home/rafael/fpcupdeluxe/cross/bin/x86-darwin/x86_64-apple-darwin15-clang: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/rafael/fpcupdeluxe/cross/bin/x86-darwin/x86_64-apple-darwin15-clang)
system.pp(387) Error: Error while assembling exitcode 1
system.pp(387) Fatal: There were 2 errors compiling module, stopping
Fatal: Compilation aborted
Makefile:2829: recipe for target 'system.ppu' failed
make[5]: *** [system.ppu] Error 1
Makefile:2505: recipe for target 'darwin_all' failed
make[4]: *** [darwin_all] Error 2
Makefile:4327: recipe for target 'rtl' failed
make[3]: ***
Error 2
Makefile:4229: recipe for target 'cycle' failed
make[2]: *** [cycle] Error 2
Makefile:2908: recipe for target 'compiler_cycle' failed
make[1]: *** [compiler_cycle] Error 2
Makefile:2940: recipe for target 'build-stamp.x86_64-darwin' failed
make: *** [build-stamp.x86_64-darwin] Error 2
fpcupdeluxe: ERROR: FPCCrossInstaller (BuildModuleCustom: FPC): Running cross compiler fpc make all for x86_64-darwin failed with an error code.


ERROR: Fpcupdeluxe fatal error !
Building cross-tools failed ... ??? ... aborting.
Be mindful and excellent with each other.
https://github.com/cpicanco/

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Re: Cross-compile linux64 to mac32?
« Reply #8 on: October 15, 2017, 08:07:19 pm »
Also fpcupdeluxe did download cross-binutils.
Be mindful and excellent with each other.
https://github.com/cpicanco/

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: Cross-compile linux64 to mac32?
« Reply #9 on: October 15, 2017, 08:11:26 pm »
Did you install clang on your system ?

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Re: Cross-compile linux64 to mac32?
« Reply #10 on: October 16, 2017, 01:56:38 pm »
Yes, clang was installed.
Be mindful and excellent with each other.
https://github.com/cpicanco/

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Re: Cross-compile linux64 to mac32?
« Reply #11 on: October 16, 2017, 02:03:04 pm »
May I ask if the cross-utils for linux were built using Ubuntu? If yes, I think they should be built using Debian. If you build with Debian, there is a high chance it will work in any debian based system, including Ubuntu unstable.
Be mindful and excellent with each other.
https://github.com/cpicanco/

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Re: Cross-compile linux64 to mac32?
« Reply #12 on: October 16, 2017, 02:07:07 pm »
Also, libstdc++6 is already the newest version in my debian based system.
Be mindful and excellent with each other.
https://github.com/cpicanco/

munair

  • Hero Member
  • *****
  • Posts: 798
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: Cross-compile linux64 to mac32?
« Reply #13 on: October 16, 2017, 02:16:14 pm »
May I ask if the cross-utils for linux were built using Ubuntu? If yes, I think they should be built using Debian. If you build with Debian, there is a high chance it will work in any debian based system, including Ubuntu unstable.
You may easily run into dependency or even library compatibility problems if you build from Debian stable targeting Debian Testing or Unstable and derivatives like Ubuntu and Mint. Even backports on Debian stable may cause instability (as I experienced more than once).
keep it simple

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Re: Cross-compile linux64 to mac32?
« Reply #14 on: October 16, 2017, 02:56:40 pm »
May I ask if the cross-utils for linux were built using Ubuntu? If yes, I think they should be built using Debian. If you build with Debian, there is a high chance it will work in any debian based system, including Ubuntu unstable.
You may easily run into dependency or even library compatibility problems if you build from Debian stable targeting Debian Testing or Unstable and derivatives like Ubuntu and Mint. Even backports on Debian stable may cause instability (as I experienced more than once).

Humm... I said that because fpc is built agaist debian (as far as I known). So, why mixing things up?
Be mindful and excellent with each other.
https://github.com/cpicanco/

 

TinyPortal © 2005-2018