public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* How to test aarch64 when building a cross-compiler?
@ 2019-11-25 19:17 Andrew Dean via gcc
  2019-11-25 20:16 ` Christophe Lyon
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Dean via gcc @ 2019-11-25 19:17 UTC (permalink / raw)
  To: gcc

Based on https://www.gnu.org/software/hurd/hurd/glibc.html, I'm using glibc/scripts/build-many-glibcs.py targeting aarch64-linux-gnu as so:

build-many-glibcs.py build_dir checkout --keep all

build-many-glibcs.py build_dir host-libraries --keep all -j 12

build-many-glibcs.py build_dir compilers aarch64-linux-gnu --keep all -j 12 --full-gcc
build-many-glibcs.py build_dir glibcs aarch64-linux-gnu --keep all -j 12

This completes successfully. However, when I then try to run the gcc tests like so:
runtest --outdir . --tool gcc --srcdir /path/to/gcc/gcc/testsuite aarch64.exp --target aarch64-linux-gnu --target_board aarch64-sim --tool_exec /path_to/build_dir/install/compilers/aarch64-linux-gnu/bin/aarch64-glibc-linux-gnu-gcc --verbose -v

I get errors like this:

aarch64-glibc-linux-gnu-gcc: fatal error: cannot read spec file 'rdimon.specs': No such file or directory

I can see that the rdimon.specs flag is added based on this line in aarch64-sim.exp:

set_board_info ldflags 	"[libgloss_link_flags] [newlib_link_flags] -specs=rdimon.specs"

I've tried searching for how to address this, but so far unsuccessfully. Does anybody know what I'm missing here?

Thanks,
Andrew

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to test aarch64 when building a cross-compiler?
  2019-11-25 19:17 How to test aarch64 when building a cross-compiler? Andrew Dean via gcc
@ 2019-11-25 20:16 ` Christophe Lyon
  2019-11-25 20:28   ` [EXTERNAL] " Andrew Dean via gcc
  0 siblings, 1 reply; 10+ messages in thread
From: Christophe Lyon @ 2019-11-25 20:16 UTC (permalink / raw)
  To: Andrew Dean; +Cc: gcc

On Mon, 25 Nov 2019 at 20:17, Andrew Dean via gcc <gcc@gcc.gnu.org> wrote:
>
> Based on https://www.gnu.org/software/hurd/hurd/glibc.html, I'm using glibc/scripts/build-many-glibcs.py targeting aarch64-linux-gnu as so:
>
> build-many-glibcs.py build_dir checkout --keep all
>
> build-many-glibcs.py build_dir host-libraries --keep all -j 12
>
> build-many-glibcs.py build_dir compilers aarch64-linux-gnu --keep all -j 12 --full-gcc
> build-many-glibcs.py build_dir glibcs aarch64-linux-gnu --keep all -j 12
>
> This completes successfully. However, when I then try to run the gcc tests like so:
> runtest --outdir . --tool gcc --srcdir /path/to/gcc/gcc/testsuite aarch64.exp --target aarch64-linux-gnu --target_board aarch64-sim --tool_exec /path_to/build_dir/install/compilers/aarch64-linux-gnu/bin/aarch64-glibc-linux-gnu-gcc --verbose -v
>
> I get errors like this:
>
> aarch64-glibc-linux-gnu-gcc: fatal error: cannot read spec file 'rdimon.specs': No such file or directory
>
> I can see that the rdimon.specs flag is added based on this line in aarch64-sim.exp:

Where does aarch64-sim.exp comes from?

>
> set_board_info ldflags  "[libgloss_link_flags] [newlib_link_flags] -specs=rdimon.specs"
>
I think this is for baremetal/newlib targets, ie. aarch64-elf, not for
aarch64-linux-gnu.

> I've tried searching for how to address this, but so far unsuccessfully. Does anybody know what I'm missing here?
>
> Thanks,
> Andrew

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [EXTERNAL] Re: How to test aarch64 when building a cross-compiler?
  2019-11-25 20:16 ` Christophe Lyon
@ 2019-11-25 20:28   ` Andrew Dean via gcc
  2019-11-25 20:40     ` Adhemerval Zanella
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Dean via gcc @ 2019-11-25 20:28 UTC (permalink / raw)
  To: Christophe Lyon; +Cc: gcc

> > This completes successfully. However, when I then try to run the gcc tests like
> so:
> > runtest --outdir . --tool gcc --srcdir /path/to/gcc/gcc/testsuite
> > aarch64.exp --target aarch64-linux-gnu --target_board aarch64-sim
> > --tool_exec
> > /path_to/build_dir/install/compilers/aarch64-linux-gnu/bin/aarch64-gli
> > bc-linux-gnu-gcc --verbose -v
> >
> > I get errors like this:
> >
> > aarch64-glibc-linux-gnu-gcc: fatal error: cannot read spec file
> > 'rdimon.specs': No such file or directory
> >
> > I can see that the rdimon.specs flag is added based on this line in aarch64-
> sim.exp:
> 
> Where does aarch64-sim.exp comes from?

/usr/share/dejagnu/baseboards/aarch64-sim.exp

> 
> >
> > set_board_info ldflags  "[libgloss_link_flags] [newlib_link_flags] -
> specs=rdimon.specs"
> >
> I think this is for baremetal/newlib targets, ie. aarch64-elf, not for aarch64-
> linux-gnu.

Hmm.. build-many-glibcs.py doesn't like either aarch64-elf or aarch64-linux-elf...
I get a KeyError in build_compilers and build_glibcs when it tries to look up the config with either of those values.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [EXTERNAL] Re: How to test aarch64 when building a cross-compiler?
  2019-11-25 20:28   ` [EXTERNAL] " Andrew Dean via gcc
@ 2019-11-25 20:40     ` Adhemerval Zanella
  2019-11-25 20:44       ` Ramana Radhakrishnan
  0 siblings, 1 reply; 10+ messages in thread
From: Adhemerval Zanella @ 2019-11-25 20:40 UTC (permalink / raw)
  To: gcc



On 25/11/2019 17:28, Andrew Dean via gcc wrote:
>>> This completes successfully. However, when I then try to run the gcc tests like
>> so:
>>> runtest --outdir . --tool gcc --srcdir /path/to/gcc/gcc/testsuite
>>> aarch64.exp --target aarch64-linux-gnu --target_board aarch64-sim
>>> --tool_exec
>>> /path_to/build_dir/install/compilers/aarch64-linux-gnu/bin/aarch64-gli
>>> bc-linux-gnu-gcc --verbose -v
>>>
>>> I get errors like this:
>>>
>>> aarch64-glibc-linux-gnu-gcc: fatal error: cannot read spec file
>>> 'rdimon.specs': No such file or directory
>>>
>>> I can see that the rdimon.specs flag is added based on this line in aarch64-
>> sim.exp:
>>
>> Where does aarch64-sim.exp comes from?
> 
> /usr/share/dejagnu/baseboards/aarch64-sim.exp
> 
>>
>>>
>>> set_board_info ldflags  "[libgloss_link_flags] [newlib_link_flags] -
>> specs=rdimon.specs"
>>>
>> I think this is for baremetal/newlib targets, ie. aarch64-elf, not for aarch64-
>> linux-gnu.
> 
> Hmm.. build-many-glibcs.py doesn't like either aarch64-elf or aarch64-linux-elf...
> I get a KeyError in build_compilers and build_glibcs when it tries to look up the config with either of those values.
> 

Unfortunately the build-many-glibcs.py does not have support for baremetal
build yet (since it is a tool created to build cross-compiling toolchain
using glibc).

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [EXTERNAL] Re: How to test aarch64 when building a cross-compiler?
  2019-11-25 20:40     ` Adhemerval Zanella
@ 2019-11-25 20:44       ` Ramana Radhakrishnan
  2019-11-25 21:43         ` Andrew Dean via gcc
  0 siblings, 1 reply; 10+ messages in thread
From: Ramana Radhakrishnan @ 2019-11-25 20:44 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: gcc mailing list

On Mon, Nov 25, 2019 at 8:40 PM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 25/11/2019 17:28, Andrew Dean via gcc wrote:
> >>> This completes successfully. However, when I then try to run the gcc tests like
> >> so:
> >>> runtest --outdir . --tool gcc --srcdir /path/to/gcc/gcc/testsuite
> >>> aarch64.exp --target aarch64-linux-gnu --target_board aarch64-sim
> >>> --tool_exec
> >>> /path_to/build_dir/install/compilers/aarch64-linux-gnu/bin/aarch64-gli
> >>> bc-linux-gnu-gcc --verbose -v
> >>>
> >>> I get errors like this:
> >>>
> >>> aarch64-glibc-linux-gnu-gcc: fatal error: cannot read spec file
> >>> 'rdimon.specs': No such file or directory
> >>>
> >>> I can see that the rdimon.specs flag is added based on this line in aarch64-
> >> sim.exp:
> >>
> >> Where does aarch64-sim.exp comes from?
> >
> > /usr/share/dejagnu/baseboards/aarch64-sim.exp
> >
> >>
> >>>
> >>> set_board_info ldflags  "[libgloss_link_flags] [newlib_link_flags] -
> >> specs=rdimon.specs"
> >>>
> >> I think this is for baremetal/newlib targets, ie. aarch64-elf, not for aarch64-
> >> linux-gnu.
> >

Yes -specs=rdimon.specs and other such flags are for use only on
bare-metal targets.

> > Hmm.. build-many-glibcs.py doesn't like either aarch64-elf or aarch64-linux-elf...
> > I get a KeyError in build_compilers and build_glibcs when it tries to look up the config with either of those values.
> >
>
> Unfortunately the build-many-glibcs.py does not have support for baremetal
> build yet (since it is a tool created to build cross-compiling toolchain
> using glibc).

And glibc doesn't work bare-metal ......

regards
Ramana

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [EXTERNAL] Re: How to test aarch64 when building a cross-compiler?
  2019-11-25 20:44       ` Ramana Radhakrishnan
@ 2019-11-25 21:43         ` Andrew Dean via gcc
  2019-11-25 21:55           ` Ramana Radhakrishnan
  2019-11-26 20:53           ` Jeff Law
  0 siblings, 2 replies; 10+ messages in thread
From: Andrew Dean via gcc @ 2019-11-25 21:43 UTC (permalink / raw)
  To: Ramana Radhakrishnan, Adhemerval Zanella; +Cc: gcc mailing list

> > >>> I get errors like this:
> > >>>
> > >>> aarch64-glibc-linux-gnu-gcc: fatal error: cannot read spec file
> > >>> 'rdimon.specs': No such file or directory
> > >>>
> > >>> I can see that the rdimon.specs flag is added based on this line
> > >>> in aarch64-
> > >> sim.exp:
> > >>
> > >> Where does aarch64-sim.exp comes from?
> > >
> > > /usr/share/dejagnu/baseboards/aarch64-sim.exp
> > >
> > >>
> > >>>
> > >>> set_board_info ldflags  "[libgloss_link_flags] [newlib_link_flags]
> > >>> -
> > >> specs=rdimon.specs"
> > >>>
> > >> I think this is for baremetal/newlib targets, ie. aarch64-elf, not
> > >> for aarch64- linux-gnu.
> > >
> 
> Yes -specs=rdimon.specs and other such flags are for use only on bare-metal
> targets.
> 
> > > Hmm.. build-many-glibcs.py doesn't like either aarch64-elf or aarch64-linux-
> elf...
> > > I get a KeyError in build_compilers and build_glibcs when it tries to look up
> the config with either of those values.
> > >
> >
> > Unfortunately the build-many-glibcs.py does not have support for
> > baremetal build yet (since it is a tool created to build
> > cross-compiling toolchain using glibc).
> 
> And glibc doesn't work bare-metal ......
> 
> regards
> Ramana
I guess that means that the dejagnu baseboard "aarch64-sim" is only meant to do bare-metal testing? How would one build/test GCC hosted on x86_64 and targeting aarch64 then? Is there a different simulator approach I should be using?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [EXTERNAL] Re: How to test aarch64 when building a cross-compiler?
  2019-11-25 21:43         ` Andrew Dean via gcc
@ 2019-11-25 21:55           ` Ramana Radhakrishnan
  2019-11-26 20:53           ` Jeff Law
  1 sibling, 0 replies; 10+ messages in thread
From: Ramana Radhakrishnan @ 2019-11-25 21:55 UTC (permalink / raw)
  To: Andrew Dean; +Cc: Adhemerval Zanella, gcc mailing list

On Mon, Nov 25, 2019 at 9:43 PM Andrew Dean <Andrew.Dean@microsoft.com> wrote:
>
> > > >>> I get errors like this:
> > > >>>
> > > >>> aarch64-glibc-linux-gnu-gcc: fatal error: cannot read spec file
> > > >>> 'rdimon.specs': No such file or directory
> > > >>>
> > > >>> I can see that the rdimon.specs flag is added based on this line
> > > >>> in aarch64-
> > > >> sim.exp:
> > > >>
> > > >> Where does aarch64-sim.exp comes from?
> > > >
> > > > /usr/share/dejagnu/baseboards/aarch64-sim.exp
> > > >
> > > >>
> > > >>>
> > > >>> set_board_info ldflags  "[libgloss_link_flags] [newlib_link_flags]
> > > >>> -
> > > >> specs=rdimon.specs"
> > > >>>
> > > >> I think this is for baremetal/newlib targets, ie. aarch64-elf, not
> > > >> for aarch64- linux-gnu.
> > > >
> >
> > Yes -specs=rdimon.specs and other such flags are for use only on bare-metal
> > targets.
> >
> > > > Hmm.. build-many-glibcs.py doesn't like either aarch64-elf or aarch64-linux-
> > elf...
> > > > I get a KeyError in build_compilers and build_glibcs when it tries to look up
> > the config with either of those values.
> > > >
> > >
> > > Unfortunately the build-many-glibcs.py does not have support for
> > > baremetal build yet (since it is a tool created to build
> > > cross-compiling toolchain using glibc).
> >
> > And glibc doesn't work bare-metal ......
> >
> > regards
> > Ramana
> I guess that means that the dejagnu baseboard "aarch64-sim" is only meant to do bare-metal testing? How would one build/test GCC hosted on x86_64 and targeting aarch64 then? Is there a different simulator approach I should be using?

For cross-compilers with Linux, you've got 2 options - write up a
board file to use qemu in user-emulation mode or indeed system
emulation mode or use real hardware and construct something using ssh
/ scp.

R

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [EXTERNAL] Re: How to test aarch64 when building a cross-compiler?
  2019-11-25 21:43         ` Andrew Dean via gcc
  2019-11-25 21:55           ` Ramana Radhakrishnan
@ 2019-11-26 20:53           ` Jeff Law
  2019-11-27 20:21             ` Andrew Dean via gcc
  1 sibling, 1 reply; 10+ messages in thread
From: Jeff Law @ 2019-11-26 20:53 UTC (permalink / raw)
  To: Andrew Dean, Ramana Radhakrishnan, Adhemerval Zanella; +Cc: gcc mailing list

On 11/25/19 2:43 PM, Andrew Dean via gcc wrote:
>>>>>> I get errors like this:
>>>>>>
>>>>>> aarch64-glibc-linux-gnu-gcc: fatal error: cannot read spec file
>>>>>> 'rdimon.specs': No such file or directory
>>>>>>
>>>>>> I can see that the rdimon.specs flag is added based on this line
>>>>>> in aarch64-
>>>>> sim.exp:
>>>>>
>>>>> Where does aarch64-sim.exp comes from?
>>>>
>>>> /usr/share/dejagnu/baseboards/aarch64-sim.exp
>>>>
>>>>>
>>>>>>
>>>>>> set_board_info ldflags  "[libgloss_link_flags] [newlib_link_flags]
>>>>>> -
>>>>> specs=rdimon.specs"
>>>>>>
>>>>> I think this is for baremetal/newlib targets, ie. aarch64-elf, not
>>>>> for aarch64- linux-gnu.
>>>>
>>
>> Yes -specs=rdimon.specs and other such flags are for use only on bare-metal
>> targets.
>>
>>>> Hmm.. build-many-glibcs.py doesn't like either aarch64-elf or aarch64-linux-
>> elf...
>>>> I get a KeyError in build_compilers and build_glibcs when it tries to look up
>> the config with either of those values.
>>>>
>>>
>>> Unfortunately the build-many-glibcs.py does not have support for
>>> baremetal build yet (since it is a tool created to build
>>> cross-compiling toolchain using glibc).
>>
>> And glibc doesn't work bare-metal ......
>>
>> regards
>> Ramana
> I guess that means that the dejagnu baseboard "aarch64-sim" is only meant to do bare-metal testing? How would one build/test GCC hosted on x86_64 and targeting aarch64 then? Is there a different simulator approach I should be using?
I've used qemu for this kind of testing.  In my environment I have root
filesystems with native binaries/libraries.  I can just chroot into
those filesystems and qemu handles everything.

In theory one wouldn't even need to chroot into the filesystems if you
set the library paths right.

jeff

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [EXTERNAL] Re: How to test aarch64 when building a cross-compiler?
  2019-11-26 20:53           ` Jeff Law
@ 2019-11-27 20:21             ` Andrew Dean via gcc
  2019-11-27 20:42               ` Andreas Schwab
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Dean via gcc @ 2019-11-27 20:21 UTC (permalink / raw)
  To: Jeff Law, Ramana Radhakrishnan, Adhemerval Zanella; +Cc: gcc mailing list



> On 11/25/19 2:43 PM, Andrew Dean via gcc wrote:
> >>>>>> I get errors like this:
> >>>>>>
> >>>>>> aarch64-glibc-linux-gnu-gcc: fatal error: cannot read spec file
> >>>>>> 'rdimon.specs': No such file or directory
> >>>>>>
> >>>>>> I can see that the rdimon.specs flag is added based on this line
> >>>>>> in aarch64-
> >>>>> sim.exp:
> >>>>>
> >>>>> Where does aarch64-sim.exp comes from?
> >>>>
> >>>> /usr/share/dejagnu/baseboards/aarch64-sim.exp
> >>>>
> >>>>>
> >>>>>>
> >>>>>> set_board_info ldflags  "[libgloss_link_flags]
> >>>>>> [newlib_link_flags]
> >>>>>> -
> >>>>> specs=rdimon.specs"
> >>>>>>
> >>>>> I think this is for baremetal/newlib targets, ie. aarch64-elf, not
> >>>>> for aarch64- linux-gnu.
> >>>>
> >>
> >> Yes -specs=rdimon.specs and other such flags are for use only on
> >> bare-metal targets.
> >>
> >>>> Hmm.. build-many-glibcs.py doesn't like either aarch64-elf or
> >>>> aarch64-linux-
> >> elf...
> >>>> I get a KeyError in build_compilers and build_glibcs when it tries
> >>>> to look up
> >> the config with either of those values.
> >>>>
> >>>
> >>> Unfortunately the build-many-glibcs.py does not have support for
> >>> baremetal build yet (since it is a tool created to build
> >>> cross-compiling toolchain using glibc).
> >>
> >> And glibc doesn't work bare-metal ......
> >>
> >> regards
> >> Ramana
> > I guess that means that the dejagnu baseboard "aarch64-sim" is only meant
> to do bare-metal testing? How would one build/test GCC hosted on x86_64 and
> targeting aarch64 then? Is there a different simulator approach I should be
> using?
> I've used qemu for this kind of testing.  In my environment I have root
> filesystems with native binaries/libraries.  I can just chroot into those
> filesystems and qemu handles everything.
> 
> In theory one wouldn't even need to chroot into the filesystems if you set the
> library paths right.
> 
> jeff

Thanks, Jeff. qemu did the trick. Specifically, I did the following:

1. sudo apt-get install qemu-user-static
2. export LD_LIBRARY_PATH=${BuildRoot}/install/glibcs/aarch64-linux-gnu/lib64:${BuildRoot}/install/compilers/aarch64-linux-gnu/aarch64-glibc-linux-gnu/lib64 
3. sudo ln -s ${BuildRoot}/install/glibcs/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 /lib/ld-linux-aarch64.so.1
4. Run the gcc tests as previously described
5. Remove the symlink
6. Restore the previous value of LD_LIBRARY_PATH

There are still a few test failures that we will need to investigate, but this was a huge leap forward.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [EXTERNAL] Re: How to test aarch64 when building a cross-compiler?
  2019-11-27 20:21             ` Andrew Dean via gcc
@ 2019-11-27 20:42               ` Andreas Schwab
  0 siblings, 0 replies; 10+ messages in thread
From: Andreas Schwab @ 2019-11-27 20:42 UTC (permalink / raw)
  To: Andrew Dean via gcc
  Cc: Jeff Law, Ramana Radhakrishnan, Adhemerval Zanella, Andrew Dean

On Nov 27 2019, Andrew Dean via gcc wrote:

> 2. export LD_LIBRARY_PATH=${BuildRoot}/install/glibcs/aarch64-linux-gnu/lib64:${BuildRoot}/install/compilers/aarch64-linux-gnu/aarch64-glibc-linux-gnu/lib64 
> 3. sudo ln -s ${BuildRoot}/install/glibcs/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 /lib/ld-linux-aarch64.so.1

Just set QEMU_LD_PREFIX to your sysroot.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-11-27 20:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-25 19:17 How to test aarch64 when building a cross-compiler? Andrew Dean via gcc
2019-11-25 20:16 ` Christophe Lyon
2019-11-25 20:28   ` [EXTERNAL] " Andrew Dean via gcc
2019-11-25 20:40     ` Adhemerval Zanella
2019-11-25 20:44       ` Ramana Radhakrishnan
2019-11-25 21:43         ` Andrew Dean via gcc
2019-11-25 21:55           ` Ramana Radhakrishnan
2019-11-26 20:53           ` Jeff Law
2019-11-27 20:21             ` Andrew Dean via gcc
2019-11-27 20:42               ` Andreas Schwab

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).