Swift build on ppc64le platform

Hi,
I have been working towards getting the swift source code built on my power
(ppc64le) platform on Ubuntu16.04 OS.
I am observing build issues and looking for some help here. Please redirect
me if this is not the right place for these questions.

I would like to understand the pre-requisites and the hardware
configurations required to build this language.
The error I am getting look like memory issues as the process is being
killed abruptly. I am attaching the log herewith for reference.

Thanks,
Meghali Dhoble(See attached file: build.28augLog)

build.28augLog (61.9 KB)

I don't see anything like that in the log. It looks like an ordinary compiler error relating to our custom calling convention.

You need to either
1. implement swiftcc in LLVM's ppc64 backend and then teach Clang that it's legal there or
2. configure Swift to not try to use it.

In the short term, I suspect that (2) is the right approach. Graydon was at least thinking about doing some work recently that would be aimed at making it easier to do this kind of configuration; CC'ing him explicitly to see if there's been progress there.

John.

···

On Aug 28, 2017, at 9:08 AM, Meghali Dhoble via swift-dev <swift-dev@swift.org> wrote:
Hi,
I have been working towards getting the swift source code built on my power (ppc64le) platform on Ubuntu16.04 OS.
I am observing build issues and looking for some help here. Please redirect me if this is not the right place for these questions.

I would like to understand the pre-requisites and the hardware configurations required to build this language.
The error I am getting look like memory issues as the process is being killed abruptly. I am attaching the log herewith for reference.

Thanks John, for the response.
We have a patch added already for ppc64 support at llvm, however still the
failures seen,
I will try to opt for 2nd option and see if that helps.

Thanks,
Meghali

···

From: John McCall <rjmccall@apple.com>
To: Meghali Dhoble <dhoblem@us.ibm.com>
Cc: swift-dev <swift-dev@swift.org>, Graydon Hoare
            <ghoare@apple.com>
Date: 08/28/2017 09:59 PM
Subject: Re: [swift-dev] Swift build on ppc64le platform
Sent by: rjmccall@apple.com

      On Aug 28, 2017, at 9:08 AM, Meghali Dhoble via swift-dev < swift-dev@swift.org> wrote:

      Hi,
      I have been working towards getting the swift source code built on my
      power (ppc64le) platform on Ubuntu16.04 OS.
      I am observing build issues and looking for some help here. Please
      redirect me if this is not the right place for these questions.

      I would like to understand the pre-requisites and the hardware
      configurations required to build this language.
      The error I am getting look like memory issues as the process is
      being killed abruptly. I am attaching the log herewith for reference.

I don't see anything like that in the log. It looks like an ordinary
compiler error relating to our custom calling convention.

You need to either
1. implement swiftcc in LLVM's ppc64 backend and then teach Clang that it's
legal there or
2. configure Swift to not try to use it.

In the short term, I suspect that (2) is the right approach. Graydon was
at least thinking about doing some work recently that would be aimed at
making it easier to do this kind of configuration; CC'ing him explicitly to
see if there's been progress there.

John.

Thanks John, for the response.
We have a patch added already for ppc64 support at llvm, however still the failures seen,

Did you change Clang?

John.

···

On Sep 6, 2017, at 3:28 AM, Meghali Dhoble <dhoblem@us.ibm.com> wrote:
I will try to opt for 2nd option and see if that helps.

Thanks,
Meghali

<graycol.gif>John McCall ---08/28/2017 09:59:28 PM---> On Aug 28, 2017, at 9:08 AM, Meghali Dhoble via swift-dev <swift-dev@swift.org> wrote: > Hi,

From: John McCall <rjmccall@apple.com>
To: Meghali Dhoble <dhoblem@us.ibm.com>
Cc: swift-dev <swift-dev@swift.org>, Graydon Hoare <ghoare@apple.com>
Date: 08/28/2017 09:59 PM
Subject: Re: [swift-dev] Swift build on ppc64le platform
Sent by: rjmccall@apple.com

On Aug 28, 2017, at 9:08 AM, Meghali Dhoble via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:
Hi,
I have been working towards getting the swift source code built on my power (ppc64le) platform on Ubuntu16.04 OS.
I am observing build issues and looking for some help here. Please redirect me if this is not the right place for these questions.

I would like to understand the pre-requisites and the hardware configurations required to build this language.
The error I am getting look like memory issues as the process is being killed abruptly. I am attaching the log herewith for reference.

I don't see anything like that in the log. It looks like an ordinary compiler error relating to our custom calling convention.

You need to either
1. implement swiftcc in LLVM's ppc64 backend and then teach Clang that it's legal there or
2. configure Swift to not try to use it.

In the short term, I suspect that (2) is the right approach. Graydon was at least thinking about doing some work recently that would be aimed at making it easier to do this kind of configuration; CC'ing him explicitly to see if there's been progress there.

John.

Hi John,
No, I haven't made any changes for Clang. What specific changes you think I
need to have for Clang?

One observation I have for LLVM and Clang that even though I have
installed them directly using "apt-get install" ; the build-script looks
for the SRC_ROOT/llvm and llvm/tools/clang folders. Also the build-script
runs the build on top of these folders.
I understand if we have system installed dependencies then those should be
used instead of the building it from source; please correct me if I am
wrong here.

PS: As of now I am building using -m option, the build command
is: ./utils/build-script -m -R

Thanks,
Meghali

···

From: John McCall <rjmccall@apple.com>
To: Meghali Dhoble <dhoblem@us.ibm.com>
Cc: Graydon Hoare <ghoare@apple.com>, swift-dev
            <swift-dev@swift.org>
Date: 09/07/2017 12:29 AM
Subject: Re: [swift-dev] Swift build on ppc64le platform
Sent by: rjmccall@apple.com

      On Sep 6, 2017, at 3:28 AM, Meghali Dhoble <dhoblem@us.ibm.com> wrote:

      Thanks John, for the response.
      We have a patch added already for ppc64 support at llvm, however
      still the failures seen,

Did you change Clang?

John.

      I will try to opt for 2nd option and see if that helps.

      Thanks,
      Meghali

      <graycol.gif>John McCall ---08/28/2017 09:59:28 PM---> On Aug 28,
      2017, at 9:08 AM, Meghali Dhoble via swift-dev <swift-dev@swift.org>
      wrote: > Hi,

      From: John McCall <rjmccall@apple.com>
      To: Meghali Dhoble <dhoblem@us.ibm.com>
      Cc: swift-dev <swift-dev@swift.org>, Graydon Hoare <ghoare@apple.com>
      Date: 08/28/2017 09:59 PM
      Subject: Re: [swift-dev] Swift build on ppc64le platform
      Sent by: rjmccall@apple.com

                  On Aug 28, 2017, at 9:08 AM, Meghali Dhoble via swift-dev <swift-dev@swift.org> wrote:

                  Hi,
                  I have been working towards getting the swift source code
                  built on my power (ppc64le) platform on Ubuntu16.04 OS.
                  I am observing build issues and looking for some help
                  here. Please redirect me if this is not the right place
                  for these questions.

                  I would like to understand the pre-requisites and the
                  hardware configurations required to build this language.
                  The error I am getting look like memory issues as the
                  process is being killed abruptly. I am attaching the log
                  herewith for reference.

      I don't see anything like that in the log. It looks like an ordinary
      compiler error relating to our custom calling convention.

      You need to either
      1. implement swiftcc in LLVM's ppc64 backend and then teach Clang
      that it's legal there or
      2. configure Swift to not try to use it.

      In the short term, I suspect that (2) is the right approach. Graydon
      was at least thinking about doing some work recently that would be
      aimed at making it easier to do this kind of configuration; CC'ing
      him explicitly to see if there's been progress there.

      John.

Hi John,
No, I haven't made any changes for Clang. What specific changes you think I need to have for Clang?

In lib/Basic/Targets.cpp, you need your target's checkCallingConvention to say that CC_Swift is okay. You also need to make your ABIInfo implementation in lib/CodeGen/TargetInfo.cpp subclass SwiftABIInfo and implement its methods appropriately for what your target supports.

John.

···

On Sep 11, 2017, at 8:57 AM, Meghali Dhoble <dhoblem@us.ibm.com> wrote:

One observation I have for LLVM and Clang that even though I have installed them directly using "apt-get install" ; the build-script looks for the SRC_ROOT/llvm and llvm/tools/clang folders. Also the build-script runs the build on top of these folders.
I understand if we have system installed dependencies then those should be used instead of the building it from source; please correct me if I am wrong here.

PS: As of now I am building using -m option, the build command is: ./utils/build-script -m -R

Thanks,
Meghali

<graycol.gif>John McCall ---09/07/2017 12:29:29 AM---> On Sep 6, 2017, at 3:28 AM, Meghali Dhoble <dhoblem@us.ibm.com> wrote: > Thanks John, for the resp

From: John McCall <rjmccall@apple.com>
To: Meghali Dhoble <dhoblem@us.ibm.com>
Cc: Graydon Hoare <ghoare@apple.com>, swift-dev <swift-dev@swift.org>
Date: 09/07/2017 12:29 AM
Subject: Re: [swift-dev] Swift build on ppc64le platform
Sent by: rjmccall@apple.com

On Sep 6, 2017, at 3:28 AM, Meghali Dhoble <dhoblem@us.ibm.com <mailto:dhoblem@us.ibm.com>> wrote:
Thanks John, for the response.
We have a patch added already for ppc64 support at llvm, however still the failures seen,

Did you change Clang?

John.
I will try to opt for 2nd option and see if that helps.

Thanks,
Meghali

<graycol.gif>John McCall ---08/28/2017 09:59:28 PM---> On Aug 28, 2017, at 9:08 AM, Meghali Dhoble via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote: > Hi,

From: John McCall <rjmccall@apple.com <mailto:rjmccall@apple.com>>
To: Meghali Dhoble <dhoblem@us.ibm.com <mailto:dhoblem@us.ibm.com>>
Cc: swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>>, Graydon Hoare <ghoare@apple.com <mailto:ghoare@apple.com>>
Date: 08/28/2017 09:59 PM
Subject: Re: [swift-dev] Swift build on ppc64le platform
Sent by: rjmccall@apple.com <mailto:rjmccall@apple.com>

On Aug 28, 2017, at 9:08 AM, Meghali Dhoble via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:
Hi,
I have been working towards getting the swift source code built on my power (ppc64le) platform on Ubuntu16.04 OS.
I am observing build issues and looking for some help here. Please redirect me if this is not the right place for these questions.

I would like to understand the pre-requisites and the hardware configurations required to build this language.
The error I am getting look like memory issues as the process is being killed abruptly. I am attaching the log herewith for reference.

I don't see anything like that in the log. It looks like an ordinary compiler error relating to our custom calling convention.

You need to either
1. implement swiftcc in LLVM's ppc64 backend and then teach Clang that it's legal there or
2. configure Swift to not try to use it.

In the short term, I suspect that (2) is the right approach. Graydon was at least thinking about doing some work recently that would be aimed at making it easier to do this kind of configuration; CC'ing him explicitly to see if there's been progress there.

John.

Hi,
We are trying to build Apple Swift on ppc64le Ubuntu16.04. We built it on ppc64le using a build script at the following link:-

With this we were able to run the 'swiftc' and REPL environment for some basic "Hello World" type of code. However for complex codes, like import Foundation, it fails(probably due to Package manager issues). When we use "import Foundation" with swift, compile error occurs as below is seen:
(swift) import Foundation <REPL Input>:1:8: error: no such module 'Foundation' import Foundation ^

We are trying to build Swift 4.2(since Swift v4.1 has been released now and no further development is happening on this branch.) on Power8/LE (ppc64le) using the build-toolchain, in order to build the Swift package manager and other tools.

We are seeing a crash which is traceable till following function in HeapObject.cpp file:
static HeapObject * swift_retain (HeapObject *object) { SWIFT_RT_TRACK_INVOCATION(object, swift_retain); if (isValidPointerForNativeRetain(object)) object->refCounts.increment(1); return object; }

Beyond this debugging using simple print statements is tricky and the code flow is unclear. Breakpoints cannot be set since building code in debug mode is not possible as it runs out of resources and hangs.

Any help here would be greatly appreciated. Any more outputs, errors can be shared.
Looking forward to port Apple Swift on Ubuntu16.04.

Please stop trying to maintaing multiple threads at once for this work.