public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Wileam Yonatan Phan <wileamyp@outlook.com>
To: Andrew Stubbs <ams@codesourcery.com>,
	"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: Clarification on newlib version for building AMDGCN offloading backend
Date: Fri, 30 Jun 2023 21:06:28 +0000	[thread overview]
Message-ID: <BY5PR14MB3911CD03E9D345A1E857B864CE2AA@BY5PR14MB3911.namprd14.prod.outlook.com> (raw)
In-Reply-To: <edc77785-3484-f5f0-ce65-08e62cbafd43@codesourcery.com>

Hi Andrew,

Just wanna follow up on the progress of this endeavor of enabling GCC with AMDGCN offloading in Spack. So far I think I've got everything working, except for the part where libgomp is pulled from the wrong place at runtime, because Spack prefers using RPATH to LD_LIBRARY_PATH. As outlined in the Spack PR comments, the proposed fix is modifying the *link_gomp field inside <install-prefix>/lib/gcc/amdgcn-amdhsa/<gcc-version>/specs to add the rpath flags for libgomp. But I'm honestly unsure if this should be done at configure time, build time, or install time.

The Spack PR can be accessed here: <https://github.com/spack/spack/pull/35919>

Please advise,
Wil

From: Andrew Stubbs <ams@codesourcery.com>
Sent: Thursday, March 30, 2023 04:45
To: Wileam Yonatan Phan <wileamyp@outlook.com>; gcc@gcc.gnu.org <gcc@gcc.gnu.org>
Subject: Re: Clarification on newlib version for building AMDGCN offloading backend 
 
On 29/03/2023 19:18, Wileam Yonatan Phan wrote:
> Hi Andrew,
> 
> I just built GCC 12.2.0 with AMDGCN offloading successfully with Spack!
> However, when I tried to test it with an OpenACC test code that I have, I encountered the following error message:
> 
> wyp@basecamp:~/work/testcodes/f90-acc-ddot$ gfortran -fopenacc -foffload=amdgcn-unknown-amdhsa="-march=gfx900" ddot.f90
> as: unrecognized option '-triple=amdgcn--amdhsa'
> mkoffload: fatal error: x86_64-pc-linux-gnu-accel-amdgcn-unknown-amdhsa-gcc returned 1 exit status
> compilation terminated.
> lto-wrapper: fatal error: /home/wyp/work/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-12.2.0/gcc-12.2.0-w7lclfarefmge3uegn2a5vw37bnwhwto/libexec/gcc/x86_64-pc-linux-gnu/12.2.0//accel/amdgcn-unknown-amdhsa/mkoffload returned 1 exit status
> compilation terminated.
> /usr/bin/ld: error: lto-wrapper failed
> collect2: error: ld returned 1 exit status

My guess is that it's trying to use the wrong assembler. Usually this 
means there is a problem with your installation procedure and/or your 
PATH. I think you should be able to investigate further using -v and/or 
strace. The correct one should be named 
$DESTDIR/usr/local/amdgcn-amdhsa/bin/as, but this will be different if 
you configured GCC with a custom --prefix location. If you have 
relocated the toolchain since installation then the toolchain will 
attempt to locate libraries and tools relative to the gcc binary. If it 
does not find them there then it looks in the "usual places", and those 
usually contain an "as" suitable only for the host system.

If you find an error on the Wiki instructions please let me know and I 
will correct them.

Andrew

  reply	other threads:[~2023-06-30 21:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06 19:23 Wileam Yonatan Phan
2023-03-07 15:38 ` Andrew Stubbs
2023-03-07 18:42   ` Wileam Yonatan Phan
2023-03-29 18:18     ` Wileam Yonatan Phan
2023-03-30  8:45       ` Andrew Stubbs
2023-06-30 21:06         ` Wileam Yonatan Phan [this message]
2023-07-03  9:02           ` Stubbs, Andrew

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BY5PR14MB3911CD03E9D345A1E857B864CE2AA@BY5PR14MB3911.namprd14.prod.outlook.com \
    --to=wileamyp@outlook.com \
    --cc=ams@codesourcery.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).