Cross compiling for MorphOS apps
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    walkero
    Posts: 102 from 2006/3/1
    Hello guys,
    I would like to ask if there is a good tutorial on how to setup a cross compiling development environment for MorphOS apps. I mean, if someone would like to develop and compile his MorphOS apps from Linux, or an other OS.

    Thank you in advance.
  • »07.10.19 - 09:36
    Profile Visit Website
  • MorphOS Developer
    jacadcaps
    Posts: 2971 from 2003/3/5
    From: Canada
    As mentioned by bigfoot, we'll be releasing scripts to build the SDK on Linux as well as pre-built binaries soon.
  • »07.10.19 - 11:51
    Profile Visit Website
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    walkero
    Posts: 102 from 2006/3/1
    I am interested on creating a cross compiling development environment, based on docker, which can be used on every major OS (Windows, Linux, MacOS). I created something similar for AROS (https://github.com/walkero-gr/dde4aros) which is under testing.

    The benefits of such an environment are many and the users will not need to mess with any installation, except of the docker and pull the necessary images.

    Looking forward for your release.

    Thank you for the hard work you do.
  • »07.10.19 - 20:45
    Profile Visit Website
  • Caterpillar
    Caterpillar
    sTix
    Posts: 39 from 2003/12/7
    Quote:

    walkero wrote:
    I am interested on creating a cross compiling development environment, based on docker, which can be used on every major OS (Windows, Linux, MacOS). I created something similar for AROS (https://github.com/walkero-gr/dde4aros) which is under testing.

    The benefits of such an environment are many and the users will not need to mess with any installation, except of the docker and pull the necessary images.

    Looking forward for your release.

    Thank you for the hard work you do.


    I found this very useful:

    https://github.com/AmigaPorts/docker-amiga-gcc
  • »08.10.19 - 18:20
    Profile
  • Caterpillar
    Caterpillar
    Marlon
    Posts: 31 from 2018/2/9
    From: Sweden
    Quote:

    jacadcaps wrote:
    As mentioned by bigfoot, we'll be releasing scripts to build the SDK on Linux as well as pre-built binaries soon.


    Where can i find SDK.global? It's in none of the sdk downloads.

    Makefile:2: ../../../SDK.global: No such file or directory
  • »16.10.19 - 11:31
    Profile Visit Website
  • MorphOS Developer
    jacadcaps
    Posts: 2971 from 2003/3/5
    From: Canada
    You can't, it likely shouldn't be there. Just 'touch' it.
  • »16.10.19 - 11:34
    Profile Visit Website
  • Caterpillar
    Caterpillar
    Marlon
    Posts: 31 from 2018/2/9
    From: Sweden
    I'm getting this while trying to compile binutils:
    Code:
    In file included from ../../binutils-2.32/bfd/elf32-ppc.c:30:
    ./elf32-target.h:1006:26: error: 'bfd_elf32_bfd_reloc_type_lookup' undeclared here (not in a function); did you mean '_bfd_norelocs_bfd_reloc_type_lookup'?
    BFD_JUMP_TABLE_RELOCS (bfd_elf32),
  • »16.10.19 - 11:45
    Profile Visit Website
  • MorphOS Developer
    Nadir
    Posts: 157 from 2003/3/17
    Quote:

    Marlon wrote:
    I'm getting this while trying to compile binutils:
    Code:
    In file included from ../../binutils-2.32/bfd/elf32-ppc.c:30:
    ./elf32-target.h:1006:26: error: 'bfd_elf32_bfd_reloc_type_lookup' undeclared here (not in a function); did you mean '_bfd_norelocs_bfd_reloc_type_lookup'?
    BFD_JUMP_TABLE_RELOCS (bfd_elf32),



    Hi,

    I'm not really sure what goes on here. Did you unpack the tarballl and apply the diff (the makefile should do that for you)?
  • »16.10.19 - 14:35
    Profile
  • Caterpillar
    Caterpillar
    Marlon
    Posts: 31 from 2018/2/9
    From: Sweden
    Quote:

    Nadir wrote:
    Quote:

    Marlon wrote:
    I'm getting this while trying to compile binutils:
    Code:
    In file included from ../../binutils-2.32/bfd/elf32-ppc.c:30:
    ./elf32-target.h:1006:26: error: 'bfd_elf32_bfd_reloc_type_lookup' undeclared here (not in a function); did you mean '_bfd_norelocs_bfd_reloc_type_lookup'?
    BFD_JUMP_TABLE_RELOCS (bfd_elf32),



    Hi,

    I'm not really sure what goes on here. Did you unpack the tarballl and apply the diff (the makefile should do that for you)?



    Yeah, I just unpacked the sdk-source, went into binutils and typed "make"

    Here's the full log: http://dl.amigadev.com/setup-cross-sdk.log

    [ Edited by Marlon 16.10.2019 - 16:09 ]
  • »16.10.19 - 15:09
    Profile Visit Website
  • Caterpillar
    Caterpillar
    Marlon
    Posts: 31 from 2018/2/9
    From: Sweden
    Anyone able to help? Will there be an update of the SDK source tarball or will you release a patch? Can I use the binutils from the previous SDK or is it incompatible?
  • »17.10.19 - 12:40
    Profile Visit Website
  • MorphOS Developer
    jacadcaps
    Posts: 2971 from 2003/3/5
    From: Canada
    Just gave it a try on Ubuntu 18/x64 with GCC 7.4.0 as default compiler. Built w/o issues. May be down to your compiler or environment variables. Try in a clean VM perhaps?
  • »17.10.19 - 13:41
    Profile Visit Website
  • MorphOS Developer
    Nadir
    Posts: 157 from 2003/3/17
    Quote:

    Marlon wrote:
    Anyone able to help? Will there be an update of the SDK source tarball or will you release a patch? Can I use the binutils from the previous SDK or is it incompatible?



    Your problem seems to be that -DMORPHOS_TARGET isn't set when compiling.

    For instance: it should look like this:

    libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../binutils-2.32/bfd -DBINDIR=\"/gg/bin\" -I. -I../../binutils-2.32/bfd -I../../binutils-2.32/bfd/../include -DHAVE_powerpc_elf32_morphos_vec -DHAVE_elf32_le_vec -DHAVE_elf32_be_vec -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -I../../binutils-2.32/bfd/../zlib -DMORPHOS_TARGET -MT elf32-ppc.lo -MD -MP -MF .deps/elf32-ppc.Tpo -c ../../binutils-2.32/bfd/elf32-ppc.c -o elf32-ppc.o

    It works fine on our build system as well as on my local Debian box from a clean public source tarball. Please use the makefile in the binutils directory and comment away the line

    "include $(ROOTPATH)SDK.global" by adding a #

    My guess is that you try to build without this makefile and thus fail to add this definition.

    Best,

    Nicholai


    [ Edited by Nadir 17.10.2019 - 14:03 ]
  • »17.10.19 - 13:55
    Profile
  • Caterpillar
    Caterpillar
    Marlon
    Posts: 31 from 2018/2/9
    From: Sweden
    Quote:

    Nadir wrote:
    Quote:

    Marlon wrote:
    Anyone able to help? Will there be an update of the SDK source tarball or will you release a patch? Can I use the binutils from the previous SDK or is it incompatible?



    Your problem seems to be that -DMORPHOS_TARGET isn't set when compiling.

    For instance: it should look like this:

    libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../binutils-2.32/bfd -DBINDIR=\"/gg/bin\" -I. -I../../binutils-2.32/bfd -I../../binutils-2.32/bfd/../include -DHAVE_powerpc_elf32_morphos_vec -DHAVE_elf32_le_vec -DHAVE_elf32_be_vec -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -I../../binutils-2.32/bfd/../zlib -DMORPHOS_TARGET -MT elf32-ppc.lo -MD -MP -MF .deps/elf32-ppc.Tpo -c ../../binutils-2.32/bfd/elf32-ppc.c -o elf32-ppc.o

    It works fine on our build system as well as on my local Debian box from a clean public source tarball. Please use the makefile in the binutils directory and comment away the line

    "include $(ROOTPATH)SDK.global" by adding a #

    My guess is that you try to build without this makefile and thus fail to add this definition.

    Best,

    Nicholai


    I build with the provided Makefile that unpacks the binutils tarball and patches it. It is a completely clean Ubuntu 19.04 environment and have created an empty file called SDK.global in the path required by the Makefile.

    I will try commenting out the include $(ROOTPATH) rather than creating the SDK.global file and report back, but I doubt that would do any difference.
  • »17.10.19 - 14:59
    Profile Visit Website
  • Caterpillar
    Caterpillar
    Marlon
    Posts: 31 from 2018/2/9
    From: Sweden
    Quote:

    jacadcaps wrote:
    Just gave it a try on Ubuntu 18/x64 with GCC 7.4.0 as default compiler. Built w/o issues. May be down to your compiler or environment variables. Try in a clean VM perhaps?


    It's a clean Ubuntu 19.04/x64 VM with GCC 8.3.0
  • »17.10.19 - 15:00
    Profile Visit Website
  • Caterpillar
    Caterpillar
    Marlon
    Posts: 31 from 2018/2/9
    From: Sweden
    Okay, you were right about the CFLAGS, thanks for pointing me in the right direction, they were overridden in my environment for some reason. I cleared them and now it compiles properly.

    However, "make install" complains about missing "./mkdist"

    Code:
    make[5]: Leaving directory '/work/tmp/binutils/build/ld'
    make[4]: Leaving directory '/work/tmp/binutils/build/ld'
    make[3]: Leaving directory '/work/tmp/binutils/build/ld'
    make[2]: Nothing to be done for 'all-target'.
    make[2]: Leaving directory '/work/tmp/binutils/build'
    make[1]: Leaving directory '/work/tmp/binutils/build'
    touch build/.morphos-build-stamp
    ./mkdist
    make: ./mkdist: Command not found
    make: *** [Makefile:38: dist/.morphos-dist-stamp] Error 127
  • »17.10.19 - 15:23
    Profile Visit Website
  • Caterpillar
    Caterpillar
    Marlon
    Posts: 31 from 2018/2/9
    From: Sweden
    I should perhaps change this:
    Code:
    	(cd dist; ixrun Install)
    # (cd build && $(MAKE) install)

    To this:
    Code:
    #	(cd dist; ixrun Install)
    (cd build && $(MAKE) install)

    ?
  • »17.10.19 - 15:31
    Profile Visit Website
  • MorphOS Developer
    jacadcaps
    Posts: 2971 from 2003/3/5
    From: Canada
    Please take in mind that the source release isn't targeted at cross compilation. I am generally building the SDK on MorphOS and test there. bigfoot should be releasing his cross build script soon - that hopefully won't require any modifications to build.
  • »17.10.19 - 16:39
    Profile Visit Website
  • Caterpillar
    Caterpillar
    Marlon
    Posts: 31 from 2018/2/9
    From: Sweden
    Quote:

    jacadcaps wrote:
    Please take in mind that the source release isn't targeted at cross compilation. I am generally building the SDK on MorphOS and test there. bigfoot should be releasing his cross build script soon - that hopefully won't require any modifications to build.


    I'm creating a crosstools script myself, and a docker environment for those who'd like to use it as well.

    https://github.com/AmigaPorts/morphos-cross-toolchain

    Current version is only gcc-6 + SDK from 2018, so I'm updating it to latest sdk + gcc-9 now.
  • »17.10.19 - 16:49
    Profile Visit Website
  • Yokemate of Keyboards
    Yokemate of Keyboards
    amigadave
    Posts: 2794 from 2006/3/21
    From: Northern Calif...
    This should be very useful for programmers who only have room for one system, if they can run MorphOS3.12 (unsupported) on their Quad G5 PowerMac, and then boot into Linux PPC64 to cross compile MorphOS software on the same machine. I'm assuming that the various versions of gcc that are now supported are available for Linux PPC64, so that all 4 cores can be used when cross compiling software for MorphOS3.12.

    If I'm only going to do Hollywood programming as a beginner for a while, will I benefit much by getting a Quad Core PCIe G5 PowerMac and running some version of Linux to program from, instead of just using the MorphOS version of Hollywood, and running it on my existing 2.7GHz G5 PowerMac, running MorphOS3.12? After I become fairly proficient at Hollywood programming, I do plan to go back to learning how to program in C/C++, but it might be many months before I need to do that. Depends on what programming projects I decide to attempt.
    MorphOS - The best Next Gen Amiga choice.
  • »17.10.19 - 23:41
    Profile